Tuesday, August 7, 2012

Matlab plot to avi movie


t = 0:pi/200:2*pi;
y = sin(t);
% h = plot(t,y,'YDataSource','y');
h = plot(t,y);
i=0;
for k = 1:.1:10
    i = i+1;
y = sin(t.*k);
set(h,'XData',t,'YData',y) % Evaluate y in the function workspace
drawnow;
    M(i)=getframe;
    pause(.05)
end
%%
movie2avi(M,'MatlabAnimation','fps',4,'compression','None','Quality',10)

No comments:

Post a Comment