1
$\begingroup$

So I have not been able to find any examples of the Manipulate feature for two ODE's. I would like to plot a graph of x[t] vs. y[t] and manipulate the initial conditions, v and theta. Thank you very much for any help you can offer.

k=.313
g=9.81;
NDSolve[{x''[t] == -k x'[t] Sqrt[y'[t]^2 + x'[t]^2], 
y''[t] == -k y'[t] Sqrt[y'[t]^2 + x'[t]^2] - g, x[0] == 0, 
y[0] == 0, x'[0] == v Cos[theta], y'[0] == v Sin[theta]}, {x, 
y}, {t, 0, 10}]
$\endgroup$
1
$\begingroup$

How is this?

sol[v_?NumberQ, theta_?NumberQ] := Module[{}, 
sol1[t_] = ({x[t], y[t]} /. NDSolve[{x''[t] == -k x'[t] Sqrt[y'[t]^2 + x'[t]^2], y''[t] == -k y'[t] Sqrt[y'[t]^2 + x'[t]^2] - g, x[0] == 0, y[0] == 0, x'[0] == v Cos[theta], y'[0] == v Sin[theta]}, {x, y}, {t, 0, 10}])[[1]];
ParametricPlot[Evaluate[sol1[t]], {t, 0, 10}, AspectRatio -> 1]
]

Manipulate[sol[v, theta], {v, 0, 1}, {theta, 0, 1}]
$\endgroup$

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.