I'm trying to make the plot of a potential visible in my figure while I plot the time evolution of the wave function of a particle in the potential.
V=diag(xvec.^2); %V is potential and xvec is a vector
figure(1) hold on plot(xvec,V);
And after this point I want "hold on" command to be turned off for the animation to make sense, but the plot of the potential V to still appear in my figure, while the loop below iterates through the time evolution.
for t=0:dt:100*dt v=exp(-i*E(1:N)*t/hbar); Psi=v'*ev(:,1:N)'/sqrt(N); plot(xvec,abs(Psi).^2/dx) axis([-0.1*a 1.1*a 0 4]) text(2.5*a,0.45,num2str(t)) pause(.2) end
Best Answer