open(vid)

minAx=0;
maxAx=K;

for i=1:10:T_pde+1
    clf
    sgtitle('t='+string(i-1)+' h')
    subplot(1,2,1)
    plot(-L:delta:L,U_plot(:,i)/delta,'LineWidth',1)
    hold on    
    plot(-L:delta:L,I_plot(:,i)/delta,'LineWidth',1)
    hold on
    plot(x,u1(i,:),'k:','LineWidth',1)
     hold on
    plot(x,u2(i,:),'k:','LineWidth',1)

    subplot(1,2,2)
    plot(-L:delta:L,Tcell_plot(:,i)/delta,'LineWidth',1)
    hold on
    plot(-L:delta:L,c_plot(:,i)/10,'LineWidth',1)
    hold on
    plot(x,u3(i,:),'k:','LineWidth',1)
    hold on
    plot(x,u4(i,:)/10,'k:','LineWidth',1)

    plot(-L:delta:L,c_plot(:,i),'LineWidth',1)
    hold on
    plot(x,u4(i,:),'k:','LineWidth',1)

    frame=getframe(h);
    writeVideo(vid,frame);
end


close(vid)