3
$\begingroup$

I have a function:

u[r_] := 1/2*(uj + u∞) - 
  1/2*(uj - u∞)*Tanh[1/4*Rθ*(r/R - R/r)]

Where:

uj = 1;
u∞ = 0;
R = 1;

I want to plot:

Plot[(u[r/R] - u∞)/(uj - u∞), {r, 0, 3}, 
 PlotRange -> All]

But for three different values of parameters , some like that:

Plot[(u[r/R] - u∞)/(uj - u∞), {r, 0, 3}, 
 PlotRange -> All] /.{Rθ->10,Rθ->5,Rθ->2.5}

How to do that?

$\endgroup$
  • 1
    $\begingroup$ It is better to write your function such that the parameters are also arguments to your function: u[uj_, u∞_, R_, Rθ_, r_] := 1/2*(uj + u∞) - 1/2*(uj - u∞)*Tanh[1/4*Rθ*(r/R - R/r)] $\endgroup$ – J. M.'s ennui Feb 27 '19 at 0:34
3
$\begingroup$
Plot[Evaluate[(u[r/R] - u∞)/(uj - u∞) /. {{Rθ -> 10}, {Rθ ->  5}, {Rθ -> 2.5}}], {r, 0, 3}, 
 PlotRange -> All]

enter image description here

Also:

Plot[Evaluate[Table[(u[r/R] - u∞)/(uj - u∞), {Rθ, {10, 5, 2.5}}]], {r, 0, 3}, 
   PlotRange -> All]

same picture

$\endgroup$
1
$\begingroup$

Here is another way to get the desired result as pointed out in the comment,

uj = 1; u\[Infinity] = 0; R = 1;

u[r_, R\[Theta]_] :=  1/2*(uj + u\[Infinity]) - 
  1/2*(uj - u\[Infinity])*Tanh[1/4*R\[Theta]*(r/R - R/r)]

Plot[Evaluate[u[r, #] & /@ {10, 5, 2.5}], {r, 0, 3}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.