-1
$\begingroup$
h = .01; g = 9.8; x[0] = 0; y[0] = 0; V[0] = 40
Vy[0] = 40 Sin[40 °]
Vy[n_] := Vy[n - 1] - g*h
Vx[n_] := 40 Cos[40 °]
x[n_] := x[n - 1] + 40 Cos[40 °]*h
y[n_] := y[n - 1] + Vy[n - 1]*h
t == (V[0]*2*Sin[40 °])/g
R == (V[0]^2*Sin[2*40 °])/g
Ymax == Sin[40 °]^2*V[0]^2/(2 g)
ParametricPlot[{y[n], x[n]}, {n, 0, 5}]

I'm trying to plot y[n] vs x[n] but keep getting an error message and Mathematica keeps crashing. I did use ParametricPlot, but get a "Recursion depth" error message. I am also unsure of what my start and end points for n should be.

| improve this question | | | | |
$\endgroup$
  • $\begingroup$ What is the error message and from what expression are you getting it? Add the answers to these questions to your question; don't answer me by posting a comment. $\endgroup$ – m_goldberg Mar 22 '15 at 3:04
  • $\begingroup$ Y[0] calls y[-1] which is undefined. It also calls Vy[0], which calls Vy[-1] which is also undefined. $\endgroup$ – Sjoerd C. de Vries Mar 25 '15 at 19:50
0
$\begingroup$

Your functions x and y appear to be only defined on integers, so you can only plot them over the integers. One way is to use ListPlot.

h = .01; g = 9.8; x[0] = 0; y[0] = 0; V[0] = 40;
Vy[0] = 40 Sin[40 \[Degree]];
Vy[n_] := Vy[n - 1] - g*h;
Vx[n_] := 40 Cos[40 \[Degree]];
x[n_] := x[n - 1] + 40 Cos[40 \[Degree]]*h;
y[n_] := y[n - 1] + Vy[n - 1]*h;
ListPlot@Table[{x[s], y[s]}, {s, 1, 10, 1}]
| improve this answer | | | | |
$\endgroup$

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