Help plotting a projectile motion graph
显示 更早的评论
Hello, I'm trying to plot a projectile motion graph at the given angles using this code.
clear all
angle=[0.4, 0.6, pi/4, 1.0, 1.2];
V0=120;
g=-9.8
t=0:.01:500;
Ax=0;
Ay=g;
x=V0*cos(angle);
y=V0*sin(angle)-9.8*t;
plot(x,y);
I'm a novice when I comes to coding, could someone help me fix this code so that I could plot 5 projectile motion graphs for the 5 given angles
2 个评论
Shawn Wachter
2021-1-30
Perhaps the following line needs correction: y=V0*sin(angle)-9.8*t;.
I think you want to use t**2, as shown here: y=V0*sin(angle)-9.8*t^2;
Hope this helps!
Image Analyst
2021-1-30
Yes, that's what I showed him 8 years ago in the Answer section below.
y = yVelocity .* t + (1/2) * Ay .* t.^2;
In the future, you can get credit in terms of reputation points if you post an Answer in the answer section below, but not up here in the comments section which is used to ask posters to clarify their question.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!