Help with a simple matlab code
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Oleg Komarov
le 17 Avr 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])
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Quantum Mechanics dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!