clear
t_0 = 0; t_f = 1; N = 320; M = 320;

[u,u_exact,xi,x,t] = naive_explicit_upwind(t_0,t_f,M,N);

figure(1)
clf
for j=0:32
  plot(x,u(:,1+j*10))
  hold on
  plot(x,u_exact(:,1+j*10),':')
  axis([0,2*pi,0,1.4])
  figure(1)
  hold off
  pause(1)
end

figure(2)
clf
plot(xi,t)
hold on
plot(pi/2+.8*t,t,':')
hold off
xlabel('location of discontinuity','FontSize',16);
ylabel('time','FontSize',16);
title('solid: approximate, dotted: exact','FontSize',16)
figure(2)

clear
t_0 = 0; t_f = 1; N = 10; M = 10;

[u1,u1_exact,xi1,x1,t1] = naive_explicit_upwind(t_0,t_f,M,N);
N = 2*N; M = 2*M;
[u2,u2_exact,xi2,x2,t2] = naive_explicit_upwind(t_0,t_f,M,N);
N = 2*N; M = 2*M;
[u3,u3_exact,xi3,x3,t3] = naive_explicit_upwind(t_0,t_f,M,N);
N = 2*N; M = 2*M;
[u4,u4_exact,xi4,x4,t4] = naive_explicit_upwind(t_0,t_f,M,N);
N = 2*N; M = 2*M;
[u5,u5_exact,xi5,x5,t5] = naive_explicit_upwind(t_0,t_f,M,N);
N = 2*N; M = 2*M;
[u6,u6_exact,xi6,x6,t6] = naive_explicit_upwind(t_0,t_f,M,N);
N = 2*N; M = 2*M;
[u7,u7_exact,xi7,x7,t7] = naive_explicit_upwind(t_0,t_f,M,N);

figure(3)
clf
plot(x1,u1(:,length(t1)),'LineWidth',2);
hold on
plot(x2,u2(:,length(t2)),'LineWidth',2);
plot(x3,u3(:,length(t3)),'LineWidth',2);
plot(x4,u4(:,length(t4)),'LineWidth',2);
plot(x5,u5(:,length(t5)),'LineWidth',2);
plot(x6,u6(:,length(t6)),'LineWidth',2);
plot(x7,u7(:,length(t7)),'LineWidth',2);
plot(x6,u6_exact(:,length(t6)),'--','LineWidth',2);







    


