% main run file % save runu.m and uN.m in the same directory % change parameters to meet your problem % type >>run clear; x=0:.1:10; % optional determine cn symbolically if(0) syms x n f1=x/5; f2=(10-x)/5; cn=(2/10)*(int(f1,x,0,5) + int(f2,x,5,10)) cn=(2/10)*(int(f1*sin(n*pi*x/10),x,0,5) + int(f2*sin(n*pi*x/10),x,5,10)) cn=simplify(cn) return; end tlist=0:.5:25; for j=1:length(tlist) t=tlist(j); u=uN(x,t,30); figure(1);clf; plot(x,u,'b.'); axis([0 10 -2 2]); M(j)=getframe; end