Reputation: 1
I have a code in MATLAB that I want to plot, but I am facing an error. Does anyone know how to fix this code?
a = 1;
E_0 = 0;
k_x = linspace(-pi/a, pi/a, 100);
k_y = linspace(-pi/a, pi/a, 100);
k_z = linspace(-pi/a, pi/a, 100);
E_k = zeros(length(k_x),length(k_y),length(k_z));
for i = 1:length(k_x)
for j = 1:length(k_y)
for k=1:length(k_z)
E_k(i,j,k) = E_0 + 8*(cos(k_x(i)*a/2)*cos(k_y(j)*a/2)*cos(k_z(k)*a/ 2));
end
end
end
I'm looking to get energy levels.
Upvotes: -1
Views: 20