% Number state filtered coherent state, NSFCS (Sec. II.F) % A coherent state with one number state |m> removed from the superposition, % then renormalized. clear; % Clear memory clc; % Clear the command window/screen d = 15; m = 4; % number state |4> will be absent from the distribution I = eye(d); alpha = 0.8; % amplitude of the coherent state nsfs = 0; % initialization for x = 0:d-1 if x == m nsfs = nsfs + 0*I(:,x+1); else nsfs = nsfs + exp(-norm(alpha)^2/2)*alpha^x/sqrt(prod(1:x))*I(:,x+1); end end NSFS = nsfs/norm(nsfs) % normalize the state (note the 5th element is 0)