Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Issue with plotting multiple data points on same graph

조회 수: 1 (최근 30일)
Oscar Vobr
Oscar Vobr 2020년 6월 3일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi, I am having trouble plotting data points on the same graph. Seperately they are function fine, but when graphed together, one set of data points does not change on the y-axis. Included is all related code to the issue. The issue is with the plot (t,a), the a part staying on zero on the y axis when graphed together with a_d
v0 = 50;
theta = 25;
N = 250; %number of time steps
a = zeros(1,N);
a(1) = -9.8;
a(2) = -9.8;
Tmax = 2*v0*sind(theta)/g;
t = linspace(0,2.5*Tmax,N); %seconds: Time axis
for n = 3:N
a(n) = -9.8;
end
figure (4)
plot(t,a_d,'r')
hold on
plot(t,a)
title('Magnitude of Acceleration with drag and no drag plotted against time')
hold off

답변 (1개)

Geoff Hayes
Geoff Hayes 2020년 6월 3일
Oscar - look closely at the y-axis for the first image (that which plots both elements). There seems to be a factor of 10^4 so the ticks that we see are not 0, -5, -10, and -15 but 0, -5 x 10^4, -10 x 10^4, and -15 x 10^4. Since the blue line is at y=-9.8, then it makes sense that it is drawn at (or very close) to zero. You should probably confirm whether the -9.8 is correct and/or the calculation of the a_d elements (perhaps they are too large?).

이 질문은 마감되었습니다.

태그

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by