This is my code.

myPlot[a_, b_] := ParametricPlot3D[Sin[x], {x, a, b}];

Manipulate[Show[myPlot[a, b]], {a, -1, 1}, {b, -1, 1}]

I want to manipulate a,b, so that the entire plot will change as we change a,b. However there are errors. Do you know how to fix it ? Thanks

  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – bbgodfrey Feb 11 '15 at 6:12
myPlot[a_, b_] := ParametricPlot3D[{1, x, Sin[x]}, {x, a, b}];

Manipulate[Show[myPlot[a, b]], {{a, -1}, -1, Pi}, {{b, 1}, -1, Pi}]

Mathematica graphics


The errors occur whenever a==b since the domain of the plot is just a point which is not allowed. Consequently, you must handle a==b as a special case. It also helps to fix the PlotRange.

myPlot[a_, b_] := ParametricPlot3D[
   {1, x, Sin[x]}, {x, a, b},
   PlotRange -> {{0, 2}, {-1, Pi}, {-1, 1}}];

     Point[{1, a, Sin[a]}],
     Axes -> True,
     PlotRange -> {{0, 2}, {-1, Pi}, {-1, 1}}],
    a == b}},
  myPlot[a, b]],
 {{a, -1}, -1, Pi, Appearance -> "Labeled"},
 {{b, 1}, -1, Pi, Appearance -> "Labeled"}]

enter image description here


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.