필터 지우기
필터 지우기

The way to get a graph in case of discretized system

조회 수: 2 (최근 30일)
Jinsu Kim
Jinsu Kim 2018년 10월 18일
댓글: Jinsu Kim 2018년 10월 18일
Hi guys, I want to get a scatter plot (actually I prefer solid line graph) in the discretized time step system.
Simplified situation is below:
% Initial conditions
t = 0 ;
T = 273 ; % [Kelvin]
dt = 0.2 ; % [time step]
% For loop
for i = 1:100
t = t + dt ;
T = 0.5 + T ;
end
What I want to get is a graph of T(y-axis) profile over the time, t(x-axis). In addition, is there any way to get updated graph after every each for loop calculation is end? (I want to be new data point is overlaid on an existing graph.)
Thanks for reading :D

채택된 답변

madhan ravi
madhan ravi 2018년 10월 18일
편집: madhan ravi 2018년 10월 18일
I managed to store the values of t and T but the loop plot seems to be frustrating:
t(1) = 0 ;
% T=zeros(1,100);
% dt=T;
T(1) = 273 ; % [Kelvin]
dt = 0.2 ; % [time step]
% For loop
for i = 2:100
t(i) = t(i-1) + dt ;
T(i) = 0.5 + T(i-1) ;
end
T
t
  댓글 수: 4
Jinsu Kim
Jinsu Kim 2018년 10월 18일
Got it. Have a good day!
madhan ravi
madhan ravi 2018년 10월 18일
편집: madhan ravi 2018년 10월 18일
you‘re welcome , you too!

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

추가 답변 (1개)

Steven Lord
Steven Lord 2018년 10월 18일
Use an animatedline. You probably want to determine the final limits of your axes and set them ahead of time using axis so the axes doesn't change limits each time you add a point beyond the boundary of the axes.
  댓글 수: 1
Jinsu Kim
Jinsu Kim 2018년 10월 18일
Thanks for letting me know such a fancy function.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by