필터 지우기
필터 지우기

How to plot derivative vectors on a parabolic trajectory?

조회 수: 2 (최근 30일)
Alexander Hellberg
Alexander Hellberg 2021년 3월 15일
답변: Shubham Rawat 2021년 3월 22일
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!

답변 (1개)

Shubham Rawat
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!

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by