TransWikia.com

How to plot a ParametricPlot graph

Mathematica Asked by siraphat on April 30, 2021

I want to plot 1100(r[t]-14) vs θ[t]. How can I plot the functions of r[t] and θ[t] from NDsolve? This is my code to find r[t] and θ[t]:

m = 81;
g = 9.81;
h = 12;
l = 15;
d = 15;
a = (d - h) [Pi]/180;

s = NDSolve[{(m*g*
   Sin[[Theta][t]]) - (m*(r''[t] - r[t] (([Theta]'[t])^2))) == 
1100 (r[t] - 14), g*Cos[[Theta][t]] == 
r[t]*[Theta]''[t] + 2*r'[t]*[Theta]'[t], [Theta][0] == 
ArcSin[a/l], [Theta]'[0] == 0, r[0] == 15, r'[0] == 0}, {r, [Theta]}, {t, 0, 100}]

And this is code that I use to make the plot:

ParametricPlot[ Evaluate[{1100*(r[t] - 14), [Theta][t]} /. s], {t, 0, 2}, PlotPoints -> 200]

One Answer

Clear["Global`*"]

m = 81;
g = 9.81;
h = 12;
l = 15;
d = 15;
a = (d - h) π/180;

s = NDSolve[
   {(m*g*Sin[θ[t]]) - (m*(r''[t] - r[t] ((θ'[t])^2))) ==
      1100 (r[t] - 14), 
    g*Cos[θ[t]] == r[t]*θ''[t] + 2*r'[t]*θ'[t],
    θ[0] == ArcSin[a/l], θ'[0] == 0, r[0] == 15, 
    r'[0] == 0},
   {r, θ}, {t, 0, 100}];

Manipulate[
 ParametricPlot[{1100 (r[t] - 14), θ[t]} /. s[[1]], {t, 0, 
   tmax},
  AspectRatio -> 1,
  ColorFunction -> Function[{x, y, t}, ColorData["Rainbow"][t]],
  PlotLegends -> BarLegend[{"Rainbow", {0, tmax}}]],
 {{tmax, 10}, 1, 100, 1, Appearance -> "Labeled"}]

enter image description here

Answered by Bob Hanlon on April 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP