Filter löschen
Filter löschen

Hello, I get an error when trying to make a 3d plot using the mesh and meshgrid functions. I don't understand the Property Value Pairs Expected' error that I get.

2 Ansichten (letzte 30 Tage)
m = 9.10938188e-31; % Mass of an electron in kg
L = 9; % Well width in nm
[x,y] = meshgrid([0:0.1:9],[0:0.1:9]);
psi_11 = @(x,y) (2/L).*sin((1*pi.*x)/L).*sin((1*pi.*y)/L); % Wave function of the electron in the box
psi_12 = @(x,y) (2/L).*sin((1*pi.*x)/L).*sin((2*pi.*y)/L);
psi_21 = @(x,y) (2/L).*sin((2*pi.*x)/L).*sin((1*pi.*y)/L);
psi_22 = @(x,y) (2/L).*sin((2*pi.*x)/L).*sin((2*pi.*y)/L);
psi_23 = @(x,y) (2/L).*sin((2*pi.*x)/L).*sin((3*pi.*y)/L);
psi_32 = @(x,y) (2/L).*sin((3*pi.*x)/L).*sin((2*pi.*y)/L);
psi_33 = @(x,y) (2/L).*sin((3*pi.*x)/L).*sin((3*pi.*y)/L);
rho_11 = @(x,y) real(psi_11(x,y).*conj(psi_11(x,y))); % Probability density of the electron in the box
rho_12 = @(x,y) real(psi_12(x,y).*conj(psi_12(x,y)));
rho_21 = @(x,y) real(psi_21(x,y).*conj(psi_21(x,y)));
rho_22 = @(x,y) real(psi_22(x,y).*conj(psi_22(x,y)));
rho_23 = @(x,y) real(psi_23(x,y).*conj(psi_23(x,y)));
rho_32 = @(x,y) real(psi_32(x,y).*conj(psi_32(x,y)));
rho_33 = @(x,y) real(psi_33(x,y).*conj(psi_33(x,y)));
figure(1)
hold on
a_1 = mesh(x,y,psi_11(x,y),'k'); c_1 = "\psi_11(x,y)"; % psi_11, psi_12, psi_21, psi_22, psi_23,
a_2 = mesh(x,y,psi_12(x,y),'r'); c_2 = "\psi_12(x,y)"; % psi_32, and psi_33 are functions of x and y
a_3 = mesh(x,y,psi_21(x,y),'g'); c_3 = "\psi_21(x,y)";
a_4 = mesh(x,y,psi_22(x,y),'b'); c_4 = "\psi_22(x,y)";
a_5 = mesh(x,y,psi_23(x,y),'m'); c_5 = "\psi_23(x,y)";
a_6 = mesh(x,y,psi_32(x,y),'y'); c_6 = "\psi_32(x,y)";
a_7 = mesh(x,y,psi_33(x,y),'c'); c_7 = "\psi_33(x,y)";
xlabel('x (nm)')
ylabel('y (nm)')
zlabel('\psi_n_xn_y(x,y)')
legend([a_1,a_2,a_3,a_4,a_5,a_6,a_7], [c_1,c_2,c_3,c_4,c_5,c_6,c_7], 'Location', 'Best')
figure (2)
hold on
b_1 = mesh(x,y,rho_11(x,y),'k'); d_1 = "\rho_11(x,y)"; % rho_11, rho_12, rho_21, rho_22,rho_23,
b_2 = mesh(x,y,rho_12(x,y),'r'); d_2 = "\rho_12(x,y)"; % rho_32, and rho_33 are functions of x and y
b_3 = mesh(x,y,rho_21(x,y),'g'); d_3 = "\rho_21(x,y)";
b_4 = mesh(x,y,rho_22(x,y),'b'); d_4 = "\rho_22(x,y)";
b_5 = mesh(x,y,rho_23(x,y),'m'); d_5 = "\rho_23(x,y)";
b_6 = mesh(x,y,rho_32(x,y),'m'); d_6 = "\rho_32(x,y)";
b_7 = mesh(x,y,rho_33(x,y),'m'); d_7 = "\rho_33(x,y)";
xlabel('x (nm)')
ylabel('y (nm)')
zlabel('\rho_n_xn_y(x,y)')
legend([b_1,b_2,b_3,b_4,b_5,b_6,b_7], [d_1,d_2,d_3,d_4,d_5,d_6,d_7], 'Location', 'Best')

Antworten (1)

KSSV
KSSV am 28 Jan. 2022
Replace the line:
a_1 = mesh(x,y,psi_11(x,y),'k');
with
a_1 = mesh(x,y,psi_11(x,y));
You have already provided color data i.e. Z data.

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by