How to plot derivative vectors on a parabolic trajectory?

2 views (last 30 days)
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!

Answers (1)

Shubham Rawat
Shubham Rawat on 22 Mar 2021
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!

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!