Why is my plot plotting blank?

조회 수: 27 (최근 30일)
Shuqing Qi
Shuqing Qi 2021년 2월 2일
댓글: Timo Dietz 2021년 2월 3일
Why I keep getting blank for my graph? I figured out that if I change plot(i,P_t(i+1)) to plot(i,P_t(i+1),'.');hold on, it will work. But only I want is a smooth line printed.

답변 (1개)

Timo Dietz
Timo Dietz 2021년 2월 2일
Each loop you are plotting one point, only. So you either have to "hold on" the figure to prevent erasing all data before the next point to plot (this would give you some kind of scatter plot) or you have to plot the array at the end of the function.
So to get a line the last row in the function should look like
plot([1:Year+1], P_t)
You got the point?
  댓글 수: 3
Shuqing Qi
Shuqing Qi 2021년 2월 2일
Thank you so much! I got it!
Timo Dietz
Timo Dietz 2021년 2월 3일
Glad that I could help you. Please accept the answer to close the topic.

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

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by