wr = 2*pi*10e9; % Rabi frequency [rad/s]

del = wr; % Detuning [rad/s]

t = linspace(0,100e-12,20000); % [s]

e = 1.6e-19; % [C]

M = e*0.5e-9; % Dipole moment [C*m]



c = 2.998e8; % [m/s]

lambda = 800e-9; % [m]

f = c/lambda;

w0 = 2*pi*f;



W = sqrt(del^2+wr^2/4);

Pe = 1/5*sin(W*t).^2;

Pg = 1-Pe;

subplot(211);

plot(t*1e12,Pg); hold on;

plot(t*1e12,Pe,'r--');

legend('Ground state','Excited state','Location','Best');

xlabel('Time [ps]');

ylabel('Populations'); 

grid on;

title('\Omega_r = 2{\pi}{\cdot}10GHz; and detuning \Delta = \Omega_r');



Cg = cos(W*t)+j*del/W*sin(W*t);

Ce = j*wr/W*sin(W*t);



subplot(212);

d = M*Cg.*conj(Ce).*exp(j*w0*t);

d = d+conj(d);

plot(t*1e12,d);

xlabel('Time [ps]');

ylabel('Dipole moment expectation [C*m]');

grid on;

title('Note numerical aliasing on ~400THz carrier!');