I cannot get my parabola to form a complete arc, I believe there is an issue with how i have laid out my code and if possible could somone direct me on how to get the graph to update as the cooridanates come in?
I used gemini 3.6 flash, hope this helps.
"By wrapping ListLinePlot inside Dynamic[ListLinePlot[dataset, …]] above the loop, you tell Mathematica:
" “Watch the variable dataset. Every single time AppendTo[dataset, {x, y}] adds a new point inside the loop, redraw this plot instantly on screen.” "
I would increase the time, for example
time = 22;
and then cut off the excess plot below the x axis using PlotRange:
Show[m, b, PlotRange -> {0, Max[dataset[[All, 2]]] + 5},
PlotRangePadding -> None]
You can build your dataset with Table, instead of For:
dataset = Table[{ux*t, (uy*t) + (1/2*a*t^2)},
{t, 0, 21}]
I see where your going but then the parabola wont be even and if i was modeling it under diffrent angles it would require more configureation, Thanks for the help
I am aiming to make it modeled as it would actually fly in order to possibly experiment with making resistance and plotting a parabola at that angle i feel does not acheive what i want and is not how projectile motion works as velocity isent a constant, Also i do not use AI generated code.
Is there a reason you don’t want to use NDSolve to solve for the trajectory? This will make it pretty easy when you want to incorporate drag as well, and you can use WhenEvent to StopIntegration when the projectile hits the ground.
Im not super experienced with mathematica so i wasent aware of that function but i use kinematics equasions to have it as close as it is modeled in reality, and im thinking of the x axis as less of a ground level at this point but just as a guide to getting it to match up, Thanks for the help!
Here’s a little bit to get you started
ClearAll["`*"]
a = {0, -9.8};
(*returns interpolating function of trajectory*)
pathFun[xinital_, yinital_, u_, Angle_] :=
With[{x0 = {xinital, yinital},
v0 = u*{Cos[Angle Degree], Sin[Angle Degree]}},
Module[{t},
NDSolveValue[{x''[t] == a, x'[0] == v0, x[0] == x0,
WhenEvent[x[t][[2]] <= yinital, "StopIntegration"]},
x, {t, 0, Infinity}]
]
]
(*plots pathFun until it hits the ground*)
makePlot[xinital_, yinital_, u_, Angle_] := Module[{trajectory, tLand},
trajectory = pathFun[xinital, yinital, u, Angle];
tLand = trajectory["Domain"][[1, 2]];
ParametricPlot[trajectory[t], {t, 0, tLand},
AspectRatio -> 1/GoldenRatio]
]
And then when you want to incorporate drag, you can add a drag force term to the differential equation that is solved in NDSolveValue.