How to plot derivative vectors on a parabolic trajectory?
2 次查看(过去 30 天)
显示 更早的评论
Greetings
I have to plot a symple parabolic trajectory with the derivative vectors in different point. So far I have:
v = 20;
g = -9.81;
h = 50;
a = (1/2) * g;
b = v;
c = h;
tFinal = roots([a, b, c]);
t = [0:0.1:120];
x = v*t;
y = h + v*t + g*t.^2*(1/2);
dx = v;
dy= v +g*t;
plot(x, y)
axis([0 120 0 75])
hold on;
How can I add the velocity vectors for discrete (not important where) values of the trajectory?
Thank you so much!
0 个评论
回答(1 个)
Shubham Rawat
2021-3-22
Hi Alexander,
You may look at this code. I have created tangents at some points of the curve.
%at these point of time creating tangents
t2 = [0:1:120];
%determining slopes at each time frame
slope = (v+g*t2)/v;
delx = 7; %delta x
%points of tangents at each t2
x2 = v*t2;
x22 = x2 + delx;
y2 = h + v*t2 + g*t2.^2*(1/2);
y22 = y2 + slope*delx;
%plotting the tangent
plot([x2;x22], [y2;y22], 'Color', 'r');
Hope this Helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!