1
$\begingroup$

i was trying to plot this image (for the values of B: 0, 1, 1/2 , 3/2): enter image description here

Using this code:

ClearAll[x, y]
y[s_, B_] := (1 + B*B + 2*B*Sin[s])^(1/2)
x[s_?NumericQ, B_?NumericQ] := NIntegrate[(1 + B*Sin[t])/y[t, B], {t, 0, s}]
undulary = 
ParametricPlot[
{x[s, 0], y[s, 0]},
{x[s, 1], y[s, 1]},{x[s, 1/2], y[s, 1/2]},{x[s, 3/2], y[s, 3/2]},
{s, 0, 4*Pi}, 
AxesLabel -> {"x ", "y "}, AspectRatio -> 1/7]

But it's not working. does anyone know how to correct the code? Thank you! I really apreciate it.

$\endgroup$

1 Answer 1

4
$\begingroup$

Edit

Since the parametric curves travel different distances, the values for s have to be adjusted to fill the plot (if required). Here I have chosen some numbers by trial and error.

Show[
 MapThread[
  ParametricPlot[
    Evaluate[{x[s, #1], y[s, #1]}]
    , {s, 0, 2 (#1 + 3)*Pi}
    , AxesLabel -> {"x ", "y "}
    , AspectRatio -> 1/4
    , PlotStyle -> ColorData[97][#2]
    , PlotRange -> {{0, 12}, {-0.1, 2.5}}
    ] &
  , {{0, 1/2, 1, 3/2}, {1, 2, 3, 4}}
  ]
 ]

enter image description here

Original

Show[ParametricPlot[
  Evaluate[{x[s, #], y[s, #]} & /@ {0, 1/2, 1, 3/2}],
  {s, 0, 4*Pi},
  AxesLabel -> {"x ", "y "}, AspectRatio -> 1/4,
  PlotRange -> All]
 ]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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