clear all; close all;

% Pulse description
A0  = 1;
tau = 0.5;
f0  = 2;
w0  = 2*pi*f0;

N = 1e4;
t = 100*tau*linspace(-1,1,N);
c = exp(1j*w0*t);

A = A0*exp(-1/2*t.^2/tau^2);
E = A.*c;

Er = real(E);
plot(t,Er); hold on;

% Dispersion
k2 = 10;
z = 1;

Ad = A0*sqrt(tau^2/(tau^2+1j*k2*z))*exp(-1/2*t.^2/(tau^2+1j*k2*z));
Ed = Ad.*c;
Edr = real(Ed);
plot(t,Edr,'r');
