plot the recent data with drawnow in level-2 matlab file s-function
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Benutzer Name
el 17 de Ag. de 2018
Comentada: majety
el 17 de Ag. de 2018
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 comentarios
Respuesta aceptada
majety
el 17 de Ag. de 2018
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 comentarios
majety
el 17 de Ag. de 2018
try to add 'clf', so that it clears your figure before you plot over it again.
pause(0.01);figure(1);clf;
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!