x= [-5:.01:5];

for i=1:length(x)
    if x(i) <=1 && x(i) >= -1
        init(i) = 1;
        
    else
        init(i) = 0;
    end
end

hold on
plot(x,init,'g')

for t = .02:1:10.02
    
    u = .5.*(erf((1-x)./sqrt(4*t)) - erf((-1-x)./sqrt(4*t)));
    plot(x,u)
    
end

hold off