Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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}]
share|improve this question
add comment

1 Answer

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}]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.