The way to get a graph in case of discretized system
2 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (1 件)
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.
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!