Hello,
I have changed the code as below:
dt=0.01;
Nx = 101;
Nt= 101;
t=0;
H=zeros(1, Nx);
u=zeros(1, Nx);
for nt=1:Nt % time loop
t=(nt-1)*dt;
for i=1:Nx
H(i) = ...
u(i) = ...
end
for k=1:10
if k*0.1 == nt
newH(k,1:Nx)=H(1:Nx);
newu(k,1:Nx)=u(1:Nx);
else
continue
end
end
end
for i=1:10
hold on;
figure (1);
hplot1 = plot(x,newH(i,1:Nx),'lineWidth',1.3);
hold on
hplot1 = plot(x,newu(i,1:Nx),'lineWidth',1.3);
hold on
end