Message Boards Message Boards

GROUPS:

Manipulate in a ParametricPlot

Posted 11 months ago
1791 Views
|
6 Replies
|
2 Total Likes
|

Hello, I used ParamtericPlot for obtaining curves by Euler elasticity theory. The shape of the curve depends on alpha variable which is initial angle in this issue. I am trying to use Manipulate in a ParametricPlot and changing alpha, but something is wrong (the shape of the curve is constant, but I don't know how to plot it without prior defining alpha). I would really appreciate your help and advise. Regards

 l = 300;
    \[Alpha] = 130 Degree;
    k = Sin[\[Alpha]/2]^2;
    m = 2;
    \[Lambda]L = (2*m*EllipticK[k])/l;
    x1L[s_] := -s + 
       2/\[Lambda]L (EllipticE[
           JacobiAmplitude[s*\[Lambda]L + EllipticK[k], k], k] - 
          EllipticE[JacobiAmplitude[EllipticK[k], k], k]);
    x2L[s_] := -2 k/\[Lambda]L (JacobiCN[EllipticK[k] + (s*\[Lambda]L), 
         k]);
     Manipulate[
     ParametricPlot[{x1L[s], x2L[s]}, {s, 0, l}, AxesLabel -> {x, y}, 
      LabelStyle -> {FontSize -> 10, Darker[Black], Bold}, 
      PlotLegends -> "xlocal"], {\[Alpha], 0, 2 Pi}]
6 Replies
Posted 7 months ago

Thanks a lot. It worked perfectly.

Move the definitions of t21, t31, t23, t33 inside the Manipulate, otherwise they will not get updated:

Manipulate[t21 = (2*Pi/lambda[[1]])*l22; t31 = (2*Pi/lambda[[1]])*l33;
  t23 = (2*Pi/lambda[[5]])*l22;
 t33 = (2*Pi/lambda[[5]])*l33; 
 Plot[{2*Y1*Tan[t11] + Y2*Tan[t21] + Y9*Tan[t31], 
   2*Y1*Tan[t13] + Y2*Tan[t23] + Y9*Tan[t33], 
   t11*Y1 + t21*(Y2/2)*(Sec[t21]^2/Sec[t11]^2) + 
    t31*(Y9/2)*(Sec[t31]^2/Sec[t11]^2) - b1, 
   t13*Y1 + t23*(Y2/2)*(Sec[t23]^2/Sec[t13]^2) + 
    t33*(Y9/2)*(Sec[t33]^2/Sec[t13]^2) - b3},
  {Y2, 0.008, 0.05}],
 {Y9, 0.008, 0.05}, {l33, 0.008, 0.012}, {l22, 0.008, 0.012}]

Hi. I would like to plot four equations with four variables by using the manipulate function. But the code was not able to plot the four equations. Can you please check the syntax and tell me what's wrong?

Y2=.;Y9=.;l22=.;l33=.;Y1=0.02;l1=0.0105698;lambda={0.0426,0.0401,0.0403,0.0423,0.0413};b1=0.0804031;b3=0.0258706;
    t21=(2*Pi/lambda[[1]])*l22;t31=(2*Pi/lambda[[1]])*l33;t23=(2*Pi/lambda[[5]])*l22;
    t33=(2*Pi/lambda[[5]])*l33;t11=(2*Pi/lambda[[1]])*l1;t13=(2*Pi/lambda[[5]])*l1;
  Manipulate[Plot[{2*Y1*Tan[t11]+Y2*Tan[t21]+Y9*Tan[t31],
      2*Y1*Tan[t13]+Y2*Tan[t23]+Y9*Tan[t33],
      t11*Y1+t21*(Y2/2)*(Sec[t21]^2/Sec[t11]^2)+t31*(Y9/2)*(Sec[t31]^2/Sec[t11]^2)-b1,
      t13*Y1+t23*(Y2/2)*(Sec[t23]^2/Sec[t13]^2)+t33*(Y9/2)*(Sec[t33]^2/Sec[t13]^2)-b3},
     {Y2,0.008,0.05}],{Y9,0.008,0.05},{l33,0.008,0.012},{l22,0.008,0.012}] 

Hi Alexandra,

change the PlotRange to {{-300, 300}, {-100, 100}} , then you see that the right end of the curves moves along the horizontal axis from right to left, the left end stays at the origin.

Posted 11 months ago

Thank you for your response. In fact, using this code, the boundary condition is changed (the right end of the curve should move along the horizontal axis). However, it is very helpful for me, I will study this code and try to adapt it to my needs.

Try this, but it seems that there is some difficulty at alpha = Pi: Complex Infinity encountered.

l = 300;

k[\[Alpha]_] := Sin[\[Alpha]/2]^2;
m = 2;
\[Lambda]L = (2*m*EllipticK[k[\[Alpha]]])/l;
x1L[s_] := -s + 
   2/\[Lambda]L (EllipticE[
       JacobiAmplitude[s*\[Lambda]L + EllipticK[k[\[Alpha]]], 
        k[\[Alpha]]], k[\[Alpha]]] - 
      EllipticE[JacobiAmplitude[EllipticK[k[\[Alpha]]], k[\[Alpha]]], 
       k[\[Alpha]]]);
x2L[s__] := -2 k[\[Alpha]]/\[Lambda]L (JacobiCN[
     EllipticK[k[\[Alpha]]] + (s*\[Lambda]L), k[\[Alpha]]]);
Manipulate[
 ParametricPlot[{x1L[s], x2L[s]} /. \[Alpha] -> aa, {s, 0, l}, 
  AxesLabel -> {x, y}, 
  LabelStyle -> {FontSize -> 10, Darker[Black], Bold}, 
  PlotRange -> {-60, 60}], {{aa, Pi/2}, 0, 2 Pi}]

x1L[.2] /. \[Alpha] -> Pi
x2L[.2] /. \[Alpha] -> Pi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract