Help with a simple matlab code
6 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Oleg Komarov
on 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])
More Answers (0)
See Also
Categories
Find more on Quantum Mechanics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!