plot the recent data with drawnow in level-2 matlab file s-function
6 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I plot a flat surface and rotate it with "drawnow" in a figure. I used to do this in a "level-2 matlab file s-function" for my Simulink simulation. It works in principal , but the figure updates the recent plot every t_out. It is like I would use the "hold on" command in a normal script. After some time its just a cylinder because Matlab saves every plot. How can I get only the recent plot in the figure, like a flat surf who rotates ?
0 件のコメント
採用された回答
majety
2018 年 8 月 17 日
You can number the figure as figure(1) and keep plotting your circle to the same figure. Make sure you get the length of your axes right so that the animation looks good. Also remember that you can use "hold off" if you don't want a cylinder from your piled up circles.
Example:
for theta = 0:pi/50:2*pi;
x = 20 *cos(theta);
y = 20*sin(theta);
originx = 0;
originy = 0;
pause(0.01);figure(1);
plot([x,originx],[y,originy],'b','LineWidth',2);hold on;
plot(x,y,'k+','LineWidth',2);hold off;
xlim([-30,30]);ylim([-30,30]);
end
2 件のコメント
majety
2018 年 8 月 17 日
try to add 'clf', so that it clears your figure before you plot over it again.
pause(0.01);figure(1);clf;
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!