MATLAB: Animation help needed with

animationMATLAB

Animation help needed
I'm trying to display 10 graphs in a sequence as an animation, running from t=1 to t=10. Here's my code,
close all;
clear all;
l=0.33;R=100;T=68;m=0.000125;w0=0.1;t=0;mu=m/l;c=sqrt(T/mu);r=1/2;x0=l*r;
for t = 1:10
for x=1:34;
for n=1:5000;
wxt=((4*w0)/pi)*exp(-R*(t*0.001))*((l/(pi*n^2*x0))...
*sin((n*pi*x0)/l))*sin((n*pi*((x-1)*0.01))/l)*cos((sqrt((c*n*pi/l)^2-R^2)*(t*0.001)));
wxtrec(n)=wxt;
end
w=sum(wxtrec);
wrec(x)=w;
end
end
plot(1:34,wrec(t+10))
axis equal
M(t) = getframe
%plot(1:34,wrec)
The bottom plot works by its self, displaying the graph of t=10, but I can't seem to make the animation work.
Any help would be really appreciated.

Best Answer

l =0.33;R=100;T=68;m=0.000125;w0=0.1;t=0;mu=m/l;c=sqrt(T/mu);r=1/2;x0=l*r;
for t = 1:10
for x=1:34;
for n=1:5000;
wxt=((4*w0)/pi)*exp(-R*(t*0.001))*((l/(pi*n^2*x0))...
*sin((n*pi*x0)/l))*sin((n*pi*((x-1)*0.01))/l)*cos((sqrt((c*n*pi/l)^2-R^2)*(t*0.001)));
wxtrec(n)=wxt;
end
w=sum(wxtrec);
wrec(x)=w;
end
plot(1:34,wrec)
M(t) = getframe
end
%plot(1:34,wrec(t+10))
%axis equal
%M(t) = getframe
%plot(1:34,wrec)
movie(M)