Help with a simple matlab code

6 次查看(过去 30 天)
Hi!
I need to write this coode to plot and calculate quantum energy levels in a quantumwell, for my laboration report.
However, I am really new to matlab, so i dont really know what im doing wrong.... All I get in the square root functions are linear dots, and matlab returns a constant value for the functions...
Code:
b=6.0;
h=6.582122e-16;
m = 0.067*9.109390e-31;
V=0.2;
E = 0:0.02:0.4;
f1=sqrt(2*m*(b^2)*(E)/(h^2));
g1=((E-V)/E);
t1=(E/(E-V));
f = tan(f1);
g = (g1)^(0.5);
t = -(t1)^(0.5);
plot(E,f,E,g,E,t)
axis([0 0.4 -10 10])
grid

采纳的回答

Oleg Komarov
Oleg Komarov 2011-4-17
b = 6.0;
h = 6.582122e-16;
m = 0.067*9.109390e-31;
V = 0.2;
E = 0:0.02:0.4;
f1 = sqrt(2*m*b^2*E/h^2);
g1 = (E-V)./E;
t1 = E./(E-V);
f = tan(f1);
g = g1.^.5;
t = -t1.^0.5;
plot(E,f,E,g,E,t)
axis([0 0.4 -10 10])

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Quantum Mechanics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by