CODE:
=======================================================================================
HAMILTON FUNCTION:
% Hamiltonian function to generate Hamiltonian Matrix
% Input: fR -> recoil frecuency; a1-> depth, N-> momentum states
% Output: H -> Hamiltonian Matrix
function H = hamiltonian(fR,a1,N)
% defining size of H
n = 2*N + 1;
% generating identity matrix of size n using diag
H = diag(n);
% defining diagonal values of H
diagH = 4*(-N:N).^2;
% looping through matrix to set values
for i=1:n
% seting diagonal value
H(i,i) = diagH(i);
% seting lower to diagonal and upper to diagonal value = -a1
if i<n
% lower to diagonal
H(i+1,i) = -a1;
% upper to diagonal
H(i,i+1) = -a1;
end
end
% Multiplying matrix with fR
H = fR .* H;
end
=======================================================================================
MAIN SCRIPT:
% MATLAB Script
% a. description of hamiltonian
help hamiltonian
% b. call hamiltonian
fR = 1;
a = 2.5;
N = 10;
% calling function
H0 = hamiltonian(fR,a,N);
% c. eig to compute eigenvalues and vectors
[V, D] = eig(H0);
% d. ploting first eigenvector of H0
% defining p
p = -N:N;
bar(p,V(:,1));
xlabel("X");
ylabel("Eigen Vector");
title("First Eigen vector of H0");
% e. ploting second eigenvector of H0
% new figure
figure();
bar(p,V(:,2));
xlabel("X");
ylabel("Eigen Vector");
title("Second Eigen vector of H0");
=======================================================================================
OUTPUT:
Exercise 1. [30 points.] A cloud of ultracold atoms trapped in an optical lattice is described...