function stringeq2
    clear;clf;
    tmax=20;
    w=1/2;
    t=0:tmax/100:tmax;
    x=-3:0.01:6;
    for k=1:length(t)
        plot(x,dalambert(x,t(k)))
        axis([-3,6,-0.5,0.5])
        M(k)=getframe
    end
    movie(M,2)
    
        
    function y=dalambert(x,t)
        for j=1:length(x)
            if t==0 z=0;
            else s=x(j)-w*t:w*t/20:x(j)+w*t;
                z=trapz(s,psi(s));
            end
            y(j)=(phi(x(j)-w*t)+phi(x(j)+w*t))/2+z/(2*w);
        end
    end
    
    function y=phi(x)
        if x>=1 & x<=2
            y=20*(x-1)^3*(2-x)^3;
        else y=0;
        end
    end

    function y=psi(x)
        for i=1:length(x)
            y(i)=sin(3*x(i))/20;
        end
    end


end

