【问题标题】:Solving time-dependent Schrodinger equation using MATLAB ode45使用 MATLAB ode45 求解瞬态薛定谔方程
【发布时间】:2016-06-23 03:02:04
【问题描述】:

时间相关哈密顿量的薛定谔方程为:

我尝试为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.

【问题讨论】:

    标签: matlab matrix


    【解决方案1】:

    H 在您的情况下只是一个单位矩阵,因此我们可以将其与psi 向量相乘以返回psi 向量本身。然后,我们将i*hbar 带到等式的右侧,这样最终的等式就是ode45 接受的形式。最后我们用下面的代码求解psi

    function schrodinger_equation
    
      psi0 = [0;1];
      hbar = 1;
      t = [0 100];
      [T,psi] = ode45(@(t,psi)dpsi(t,psi,hbar),t,psi0);
    
      for i = 1:length(psi0)
        figure
        plot(T,real(psi(:,i)),T,imag(psi(:,i)))
        xlabel('t')
        ylabel('Re(\psi) or Im(\psi)')
        title(['\psi_0 = ' num2str(psi0(i))])
        legend('Re(\psi)','Im(\psi)','Location','best')
      end
    
    end
    
    function rhs = dpsi(t,psi,hbar)
      rhs = 1/(1i*hbar)*cos(t).*ones(2,1);
    end
    

    请注意,我已经分别绘制了psi 的两个分量,并且对于每个这样的图,我还分别绘制了实部和虚部。以下是psi0 的两个不同值的图:

    【讨论】:

    • 这是否意味着您不必在 ode45 中进行插值? ode45 内部的 $cos(t)$ 项是否不同?
    • cos(t) 术语肯定是在 dpsi 函数中看到的。
    • 谢谢。如果我的时间依赖性不是那么简单,以至于H 不能像单位矩阵一样表示怎么办?我该怎么办?例如H = [t 1;3t t^2]?
    • 我能想到的最直接的方法是将Hpsi向量相乘,并将结果的分量分配给dpsi函数中的rhs
    • 这可能行得通。那么我是否只需将每个组件传递到 ode45 中,然后 ode45 无需进行插值就可以理解时间依赖性?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多