% Number states (Sec. II.A) % A number state |n> is a column of the identity matrix: the (n+1)th column. clear; % Clear memory clc; % Clear the command window/screen d = 5; % dimension of the field I = eye(d); % Identity matrix of dimension d Vacuum = I(:,1) % First column of identity matrix: vacuum state |0> Ket1 = I(:,2) % Second column of identity matrix: single-photon state |1> Ket2 = I(:,3) % Third column of identity matrix: two-photon state |2>