%COherent State hcros -. 0 simulations 1
%Expression

clc
clear
%Variables and limits
pprime=3.5;
xprime=4.5;

h=.5;
%x=linspace(0,1,100);

x=linspace(-10,10);
p=linspace(-10,10);
n=100;
diff=h/n;
%Surface plots
[X,P]=meshgrid(x,x);
for j=1:n
    hcross=h-j*diff;

probab=exp((-1/(2*hcross)).*((X-xprime).^2 + (P-pprime).^2));
surf(X,P,probab);
title('Probability distribution vs x-p plane');
zlabel('Probab.');
xlabel('Position(x)');
ylabel('Momentum(p)');

M(j) = getframe(gcf);
end
time=10;
fps=25;
movie(M,time,fps)
