Help with a simple matlab code

6 Ansichten (letzte 30 Tage)
Stefan Oros
Stefan Oros am 17 Apr. 2011
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

Akzeptierte Antwort

Oleg Komarov
Oleg Komarov am 17 Apr. 2011
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])

Weitere Antworten (0)

Kategorien

Mehr zu Quantum Mechanics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by