/ concept-collection / numbl-quantum-optics
Sign in
concept-collection / numbl-quantum-optics
numbl-quantum-optics / ex17_coupled_cavities.m
31 lines · 1.5 KBBlameHistoryRaw
1% Coupled cavities: energy exchange between two field modes (Sec. VI.A)
2% One photon starts in cavity 1, cavity 2 is empty. The photon is
3% periodically transferred between the two cavities.
4% P10(t) = cos^2(Jt), P01(t) = sin^2(Jt)
6clear; % Clear memory
7clc; % Clear the command window/screen
8d = 10; % dimension of the cavity field
9hbar = 1;
10W1 = 1; % resonance frequency of the first cavity
11W2 = 1; % resonance frequency of the second cavity
12J = 0.1; % inter-cavity coupling constant
13A = diag(sqrt(1:d-1), 1); % Annihilation operator
14Ad = A'; % Creation operator
15I_f = eye(d); % identity operator for the fields
16H = hbar*W1*kron(Ad*A,I_f) + hbar*W2*kron(I_f,Ad*A) + hbar*J*(kron(Ad,A)+kron(A,Ad));
17S10 = kron(I_f(:,2),I_f(:,1)); % cavity 1 has |1>, cavity 2 has |0>
18S01 = kron(I_f(:,1),I_f(:,2)); % cavity 1 has |0>, cavity 2 has |1>
19Psi = S10; % initial state
20dt = 0.1; % time step
21U = expm(-i*H*dt/hbar); % unitary time-evolution operator
22T = 0:dt:50; % total evolution time
23for t = 1:length(T)
24 P10(t) = norm(S10'*Psi)^2; % prob. photon in cavity 1
25 P01(t) = norm(S01'*Psi)^2; % prob. photon in cavity 2
26 Psi = U*Psi; % time evolution
27 Psi = Psi/norm(Psi); % normalization
28end
29plot(T, P10, 'r', T, P01, 'k') % cavity 1 red, cavity 2 black
30title('Photon exchange between coupled cavities (J = 0.1)')
31xlabel('t'); ylabel('Probability'); legend('P_{10}', 'P_{01}')
moveopenescclose