Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: Exporting(Saving) an animated plot
Replies: 4   Last Post: Jan 1, 2014 6:43 PM

 Messages: [ Previous | Next ]
 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.

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('CTRL-C 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

Date Subject Author
12/26/13 Dila
12/26/13 Nasser Abbasi
12/26/13 Nasser Abbasi
12/26/13 Dila
1/1/14 Steven Lord