Phys 311 – NDSolve example

2-dimensional motion with linear drag

Manipulate[
soln1=NDSolve[
{y''[t]==-9.8,
x''[t]==0,
x'[0]==v0*Cos[theta],
y'[0]==v0*Sin[theta],
x[0]==0,
y[0]==0},
{y,x},{t,0,10}
];
soln2=NDSolve[
{y''[t]==-9.8-(b/m)*y'[t],
x''[t]==0-(b/m)*x'[t],
x'[0]==v0*Cos[theta],
y'[0]==v0*Sin[theta],
x[0]==0,
y[0]==0},
{y,x},{t,0,10}];
ParametricPlot[
{{x[t],y[t]}/.soln1,{x[t],y[t]}/.soln2},
{t,0,tMax},
PlotRange->{{0,1},{0,0.5}},
PlotStyle->{{Blue,Thick,Dashed},{Orange,Thick}},
Frame->True,
FrameLabel->{ "x (m)","y (m)"},
GridLines->{{0.2,0.4,0.6,0.8},{ 0.1,0.2,0.3,0.4}},
GridLinesStyle->Directive[LightBlue,AbsoluteThickness[1.3]],
ImageSize->600,
LabelStyle->(FontSize->12)
],
{{theta,π/4,"θ"},0,π/2, Appearance->"Labeled"},
{{v0,3,"(Subscript[v, 0])"},0,3, Appearance->"Labeled"},
{{b,0,"b"},0,10, Appearance->"Labeled"},
{{m,1,"m"},0.1,10, Appearance->"Labeled"},
{{tMax,0.7,"t"},0.000001,0.7, Appearance->"Labeled"}
]