c = 3E8; % speed of light [m/s]

lambda0 = 1550E-9; % Center frequency, 1550nm

tau = 1E-12; % Half pulse length, tau

w0 = 2*pi*c/lambda0;



Npoints = 1000;

Tlen = 1.5*tau;

t = Tlen*linspace(-1,1,Npoints);

E = (abs(t)<tau).*exp(j*w0*t);



plot(t,real(E)); grid on;