I'm trying to solve a quantum harmonic oscillator numerically and I followed Matlab steps to crack the equation, however, it doesn't work. Any other idea for another method or where the mistake could be? the equation is d2psi/dx2=(constant-x^2)*psi Thanks for advanced
syms y(x)
k=23; m=9.1093821545*1e-31; w=sqrt(k/m);hb=(6.6260695729*1e-34)/(2*pi);E0=hb*w*.5;
[V] = odeToVectorField(diff(y, 2) == (hb*w*.5-.5*k*x.^2).*y);
x1=-sqrt(hb*w/k);
x2=-x1;
M = matlabFunction(V,'vars',{x,'Y'});
[m,n] = ode45(M,[x1 x2],[0. 0.]);

 採用された回答

Torsten
Torsten 2017 年 11 月 27 日

0 投票

k=23;
m=9.1093821545*1e-31;
w=sqrt(k/m);
hb=(6.6260695729*1e-34)/(2*pi);
E0=hb*w*.5;
M=@(x,y)[y(2);(hb*w*.5-.5*k*x^2)*y(1)];
x1=-sqrt(hb*w/k);
x2=-x1;
[m,n] = ode45(M,[x1 x2],[0.; 0.]);
Result will be that y(1) and y(2) are identically zero.
Best wishes
Torsten.

2 件のコメント

david feldstein
david feldstein 2017 年 11 月 27 日
any hint to solve ? d2y/dx2=(constant-x.^2)*y thanks
Torsten
Torsten 2017 年 11 月 27 日
But this is the code to solve the equation
d2y/dx2=(constant-x.^2)*y
y(1) will be y, y(2) will be dy/dx.
Best wishes
Torsten.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeQuantum Mechanics についてさらに検索

質問済み:

2017 年 11 月 27 日

コメント済み:

2017 年 11 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by