Dila
Posts:
2
Registered:
12/26/13


Exporting(Saving) an animated plot
Posted:
Dec 26, 2013 4:58 PM


Hi,
I have a code which plots an animated graph of flowing waves.
And my wish is to save it as .gif or .avi, or just export it somehow to include in a presentation.
My code is added below.
Thanks for your consideration.. Dila.
clc clear all hold off
k = 2*pi*1; w = k*343; L = 2.2; x = 3:0.001:3;
% Dipole: normalized variables p = [exp(j*k*abs(x)).*sign(x)]; u = exp(j*k*abs(x));
t = 0;
figure subplot(211) hp = plot(x,real(p*exp(j*w*t))); title('normalized p(x,t)') set(hp,'EraseMode','xor'); grid axis([3 3 1 1]) hold on plot([0 0],[1 1],'b') hold off
subplot(212) hu = plot(x,real(u*exp(j*w*t))); set(hu,'EraseMode','xor'); grid axis([3 3 1 1]) title('normalized u(x,t)') hold on plot([0 0],[1 1],'b') xlabel('CTRLC to terminate') hold off
while 1 t = t+0.0001; set(hp,'YData',real(p*exp(j*w*t))); set(hu,'YData',real(u*exp(j*w*t))); pause(0.03) drawnow end

