# Using Manipulate On Parametric Plots

I was trying to animate a state space plot to change with respect to some sliders and here is what I have tried so far. Right now I am just getting a bunch of errors and I'm not sure how to fix fix it:

Manipulate[ ParametricPlot[{First[\[Theta][t] /. Sol[d, naught, w, g]], First[\[Theta]'[t] /. Sol[d, naught, w, g]]},{t, 0, 50},AxesStyle -> 12, AxesLabel -> {\[Theta], \[Theta]'}, PlotStyle -> Blue, AspectRatio -> 1, ColorFunction -> (ColorData["Rainbow"][#3] &)],{w, 1.5, 5}, {{g, 9.81}, 1, 100}, {naught, 1, 10}, {d, 1, 10}]

Sol[d_, naught_, w_, g_] := NDSolve[{\[Theta]''[
t] == (naught/d)*\[Theta]'[t]*Cos[t]*
Cos[\[Theta][t]] + (naught/d)*Sin[\[Theta][t]]*
Sin[t] - (g/(d*w^2))*Sin[\[Theta][t]], \[Theta][0] ==
0.1, \[Theta]'[0] == 0}, {\[Theta]'[t], \[Theta][t]} , {t, 0, 50}]


Sorry, the code is messy let me know if you can figure out whats wrong with it! thanks!

Edit: Here is my updated code the first plot works but the second plot isn't plotting anything.

(* Numerically Solves both theta and theta dot*)
Sol[d_, naught_, w_, g_] :=
NDSolve[{\[Theta]''[
t] == (naught/d)*\[Theta]'[t]*Cos[t]*
Cos[\[Theta][t]] + (naught/d)*Sin[\[Theta][t]]*
Sin[t] - (g/(d*w^2))*Sin[\[Theta][t]], \[Theta][0] ==
0.1, \[Theta]'[0] == 0}, {\[Theta]'[t], \[Theta][t]} , {t, 0, 50}]

(* Defines the funcitons to be plotted*)
Theta[d_, naught_, w_, g_] :=
Evaluate[\[Theta][t] /. Sol[d, naught, w, g]]
Theta'[d_, naught_, w_, g_] :=
Evaluate[\[Theta]'[t] /. Sol[d, naught, w, g]]

(*Test Plot*)
Manipulate[
Plot[{Theta[d, naught, w, g], Theta'[d, naught, w, g]}, {t, 0, 50},
AxesStyle -> 12, AxesLabel -> {\[Tau], \[Theta]}],
{w, 1.5, 5}, {{g, 9.81}, 0, 100}, {naught, 0, 10}, {d, 1, 10}]

(*Thing I want to plot*)
Manipulate[
ParametricPlot[{Theta[d, naught, w, g], Theta'[d, naught, w, g]}, {t,
0, 50},
AxesStyle -> 12, AxesLabel -> {\[Theta], \[Theta]'},
PlotStyle -> Blue, AspectRatio -> 1,
ColorFunction -> (ColorData["Rainbow"][#3] &)],
{w, 1.5, 2}, {{g, 9.81}, 9, 10}, {naught, 1, 2}, {d, 1, 2}]

• Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
– Community Bot
Commented Nov 22, 2023 at 1:40
• Have you tried constructing a plot without the manipulate just by plugging in some numbers? Do you get if you just plug in some numbers? Which function is throwing the errors? Commented Nov 22, 2023 at 1:41
• Yes I get numbers/ a plot if I just plot specific numbers or both the function and its derivative on the same plot (I can also manipulate both of these functions on the same plot). Commented Nov 22, 2023 at 1:50

\$Version

(* "13.3.1 for Mac OS X ARM (64-bit) (July 24, 2023)" *)

Clear["Global*"]

Sol[d_?NumericQ, naught_?NumericQ, w_?NumericQ, g_?NumericQ] :=
NDSolve[
{θ''[t] == (naught/d)*θ'[t]*Cos[t]*Cos[θ[t]] +
(naught/d)*Sin[θ[t]]*Sin[t] - (g/(d*w^2))*Sin[θ[t]],
θ[0] == 1/10, θ'[0] == 0}, {θ'[t], θ[t]}, {t, 0, 50}][[1]]

Manipulate[
ParametricPlot[
Evaluate[{θ[t], θ'[t]} /. Sol[d, naught, w, g]],
{t, 0, 50},
AxesStyle -> 12,
AxesLabel -> (Style[#, 14] & /@ {θ, θ'}),
PlotStyle -> Blue,
AspectRatio -> 1, ColorFunction -> (ColorData["Rainbow"][#3] &),
PlotLegends -> BarLegend[{"Rainbow", {0, 50}},
LegendLabel -> Style[HoldForm[t], 14]]],
{{w, 2}, 1.5, 5, 0.025, Appearance -> "Labeled"},
{{g, 9.81}, 1, 100, 1, Appearance -> "Labeled"},
{{naught, 5}, 1, 10, 0.1, Appearance -> "Labeled"},
{{d, 5}, 1, 10, 0.1, Appearance -> "Labeled"}]
`

• Amazing thank you it works! Commented Nov 22, 2023 at 2:58