getting an error: ''unable to resolve the name handles.edit_t"
1 次查看(过去 30 天)
显示 更早的评论
% General Parameters
t=str2double(get(handles.edit_t,'string'));
lattice=str2double(get(handles.edit_lattice,'String'));
%starting with 3D representation
% creating the necessary k-vectors for the calculation
k_x= linspace(-2*pi/(lattice), 2*pi/(lattice), 100);
k_y= linspace(-2*pi/(lattice), 2*pi/(lattice), 100);
[k_meshx,k_meshy]= meshgrid(k_x, k_y);
%Energy values with the preset parameters in 3D representation
energy_mesh=NaN([size(k_meshx,1), size(k_meshx,2),2]);
b1=2.13;
b2=1.138;
for a=1:size(k_meshx,1)
energy_mesh(:,a,1)=t*sqrt(3+2*cos(2*b1*k_meshy)+4*cos(b2*k_meshx)*cos(b1*k_meshy));
energy_mesh(:,a,2)=-t*sqrt(3+2*cos(2*b1*k_meshy)+4*cos(b2*k_meshx)*cos(b1*k_meshy));
end
% Graphic representation
set(handles.axes_mesh,'color','w')
set(handles.axes_mesh,'NextPlot','replace')
surf(k_meshx,k_meshy,real(energy_mesh(:,:,1)),'parent', handles.axes_mesh,'FaceAlpha',0.6)
set(handles.axes_mesh,'NextPlot','add')
hold on
surf(k_meshx,k_meshy,real(energy_mesh(:,:,2)),'parent', handles.axes_mesh,'FaceAlpha',0.6)
colormap('jet')
shading interp
% plot of brillouin zone (black) and triangular path (red) of the dispersion plot
plot3(2*pi/(sqrt(3)*lattice)*[1,0,-1,-1,0,1,1], 2*pi/(3*lattice)*[1,2,1,-1,-2,-1,1],'k-','Linewidth',2,'parent',handles.axes_mesh)
plot3(2*pi/(lattice*sqrt(3))*[0,1,1,0], 2*pi/(3*lattice)*[0,0,1,0],'r-','Linewidth',2,'parent',handles.axes_mesh)
hx=xlabel('k_x','parent', handles.axes_mesh);
hy=ylabel('k_y','parent', handles.axes_mesh);
hz=zlabel('E(k)','parent', handles.axes_mesh);
axis equal
grid off
hold off
1 个评论
Jan
2021-2-14
The shown code fails in the 1st line already. Then the rest of the code is not useful to identify the problem.
What is handles in your code?
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!