0
薛定諤方程與時間相關的哈密頓是:解決時薛定諤方程ODE45
我嘗試實施薛定諤方程爲ode45
時間哈密頓求解器。但是,因爲哈密爾頓函數$ H(t)$取決於時間。我不知道如何做插值ode45
。你能給我一些提示嗎?
psi0 = [0 1];
H = [1 0;0 1]*cos(t); %this is wrong, I do not know how to implement this and pass it to ode45
hbar = 1;
t = [0:1:100];
[T, psi] = ode45(dpsi, t, psi);
function dpsi = f(t, psi, H, psi0)
dpsi = (1/i)*H*psi;
我也嘗試拿出矩陣插值的 MATLAB: Interpolation that involve a matrix的解決方案。
這是否意味着你不必做插在ODE45? $ cos(t)$術語在ode45內部有所不同嗎? – kyle
'cos(t)'這個術語當然可以解釋爲你在'dpsi'函數中看到的。 – edwinksl
謝謝。如果我的時間依賴性不是那麼簡單以至於'H'不能表示成一個單位矩陣?我該怎麼辦?例如'H = [t 1; 3t t^2]'? – kyle