Help with a simple matlab code

6 ビュー (過去 30 日間)
Stefan Oros
Stefan Oros 2011 年 4 月 17 日
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])
  1 件のコメント
Stefan Oros
Stefan Oros 2011 年 4 月 17 日
Thanks alot!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeQuantum Mechanics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by