1
$\begingroup$

I am trying to plot a given vector (which is not a function) using ParametricPlot3D but couldn't make it show the surface. I tried using Evaluate, Function and Through but it didn't work.

x = {(r0+c Sin[(r-r0)/c]) Cos[t], (r0+c Sin[(r-r0)/c]) Sin[t], c (Cos[(r-r0)/c]-1)};
Manipulate[
 ParametricPlot3D[x, {r, r0 - w/2, r0 + w/2}, {t, 0, \[Pi]}], {{w, 1},
   0.5, 2}, {{r0, 1}, 0.5, 2}, {{c, 1}, 0.1, 10}]

Thanks for your help!

$\endgroup$
1
$\begingroup$

Better (and more readable) to make clear definitions:

First:

f[r0_, r_, c_, 
   t_] := {(r0 + c Sin[(r - r0)/c]) Cos[
     t], (r0 + c Sin[(r - r0)/c]) Sin[t], c (Cos[(r - r0)/c] - 1)};

Then:

Manipulate[
 ParametricPlot3D[
  f[r0, r, c, t], {r, r0 - w/2, r0 + w/2}, {t, 0, \[Pi]}], {{w, 1}, 
  0.5, 2}, {{r0, 1}, 0.5, 2}, {{c, 1}, 0.1, 10}]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks! I will do that. Apart from readability, can you tell why mine didn't work? $\endgroup$ – IdoL Mar 26 at 11:07
  • 1
    $\begingroup$ Manipulate is like Module, so the variables get "localized", so you have to pass them "outside" to your x (resp. my f) $\endgroup$ – mgamer Mar 26 at 15:36

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.