In my data, t = (0:0.01:0.64)', a is a colunm of constants (-9.81) of length 63. I want to plot a vs. t. It's supposed to be a horizontal line, but I got a graph with fluctuations around -9.81. How can I fix this? I used this code:
plot(t(1:length(a)),a)

댓글 수: 3

KSSV
KSSV 2020년 8월 21일
How did you plot? Show us the code and picture.
Walter Roberson
Walter Roberson 2020년 8월 21일
What shows up for unique(diff(a))
Jiaqi Wang
Jiaqi Wang 2020년 8월 21일
Thank you! I think the problem was the calculation kept a long format of the answer of a, which resulted in a minor difference in a.

댓글을 달려면 로그인하십시오.

 채택된 답변

KSSV
KSSV 2020년 8월 21일

0 개 추천

t = (0:0.01:0.64)' ;
a = -9.81*ones(size(t)) ;
plot(t,a)

추가 답변 (1개)

Alan Stevens
Alan Stevens 2020년 8월 21일

0 개 추천

Just
t = (0:0.01:0.64)';
a = -9.81*ones(size(t));
plot(t,a)
gives a horizontal line.

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2020년 8월 21일

댓글:

2020년 8월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by