% Carrier 

w0 = 2*pi;



% Parameters of initial Gaussian envelope

A0 = 1;

tau = 1;



% Dispersion properties

K = 2*pi;

k1 = 1; % inverse of group velocity

k2 = 0;



% Fixed position, give time behavior

Z = 40;

t = linspace(-10,100,1e4);

tp = t-k1*Z;



% Wave

A = A0*sqrt(tau^2/(tau^2+j*k2*Z))*exp(-1/2*tp.^2./(tau^2+j*k2*Z));

C = exp(j*(w0*t-K*Z));



plot(t,real(A));

xlim([min(t) max(t)]);

ylim(A0*[-1 1]);

title('At fixed observation point, signal as function of time');