# Energy eigenvalues plot of a Hamiltonian(Weyl)

조회 수: 39(최근 30일)
Vira Roy 2022년 1월 2일
댓글: Vira Roy 2022년 1월 3일
Question: I have a Hamiltonian which I have to construct in a meshgrid and then plot the energy eigenvalues to get a surf plot. I am not able to get the desired plot.
caution: Slightly bit on the physics side of things.
What I should get: Hamiltonian: I have constructed the Hamiltonian correctly(afaik) and am solving for each triplets if x, y and z and later plot it. I can't back the similar plot. Any help with this regard would be so helpful. Thank You.
My Attempt:
%Parameters
m = 0.5;
b = 1;
bp = 0;
% x-y-z values
x = -pi : pi/16 : pi;
y = -pi : pi/16 : pi;
z = -pi : pi/16 : pi;
M = length(x);
[px,py,pz] = meshgrid(x,y,z);
%Pauli Matrices
sigma_x = [0,1;1,0];
sigma_y = [0,-1j;1j,0];
sigma_z = [1,0;0,-1];
%identity matrix
I = [1,0;0,1];
a11 = m .* I + b .* sigma_z ;
a22 = -m .*I + b .*sigma_z ;
%Pre-allocation
E = nan(M,M,M,4);
%hamiltonian
for i = 1:M
for j = 1:M
for k = 1:M
sigma_dot_p = sigma_x .* px(i,j,k) + sigma_y .* py(i,j,k) + sigma_z .* pz(i,j,k);
H = [a11,sigma_dot_p; ...
sigma_dot_p,a22];
E(i,j,k,:) = eig(H);
end
end
end
figure;
surf(y,z,E(:,:,1,1));
hold on
surf(y,z,E(:,:,1,2));
hold on
surf(y,z,E(:,:,1,3));
hold on
surf(y,z,E(:,:,1,4));
xlabel('y')
ylabel('z')
zlabel('Energy') 댓글을 달려면 로그인하십시오.

### 채택된 답변

David Goodmanson 2022년 1월 3일
편집: David Goodmanson 2022년 1월 3일
Hi Vira,
The plot has no room for px so I assumed it was zero. px=0 corresponds to E(17,:,:,:). Then everything seems to come out all right.
You don't show a value for nu in the hamiltonian so I assumed it was 1. It made no difference in this case but I changed the meshgrid command to
[px,py,pz] = nd(x,y,z);
because when there are three or more dimensions it's more straightforward to not have the first two of them switched. Everything is the same except the plot commands are now
figure(1);
surf(y,z,squeeze(E(17,:,:,1)),'facealpha',.5,'edgecolor','none');
hold on
surf(y,z,squeeze(E(17,:,:,2)),'facealpha',.5,'edgecolor','none');
surf(y,z,squeeze(E(17,:,:,3)),'facealpha',.5,'edgecolor','none');
surf(y,z,squeeze(E(17,:,:,4)),'facealpha',.5,'edgecolor','none');
hold off
xlabel('y')
ylabel('z')
zlabel('Energy')
when you stay with the same figure, 'hold on' is a toggle so you don't need to repeat it. On the other hand it's best to include 'hold off' at the end.
##### 댓글 수: 1표시숨기기 없음
Vira Roy 2022년 1월 3일
Hello David,
Thanks a ton and you were right about all the assumptions. Sorry for my bad to not put the required inputs.

댓글을 달려면 로그인하십시오.

R2021a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!