求解具有恒定质量的二维薛定谔方程附matlab代码

简介: 求解具有恒定质量的二维薛定谔方程附matlab代码

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法       神经网络预测       雷达通信      无线传感器        电力系统

信号处理              图像处理               路径规划       元胞自动机        无人机

⛄ 内容介绍

在量子力学中,薛定谔方程是研究粒子行为的基本方程之一。它描述了粒子的波函数随时间的演化,并提供了关于粒子在不同位置和动量上的概率分布的信息。在本文中,我们将讨论如何求解具有恒定质量的二维薛定谔方程。

二维薛定谔方程的一般形式如下:

iħ∂ψ/∂t = -ħ²/2m(∂²ψ/∂x² + ∂²ψ/∂y²) + V(x, y)ψ

其中,i是虚数单位,ħ是约化普朗克常数,t是时间,m是粒子的质量,(x, y)是粒子的位置,V(x, y)是势能函数,ψ是波函数。

为了求解这个方程,我们可以采用分离变量的方法。假设波函数可以表示为两个单变量函数的乘积形式,即ψ(x, y) = X(x)Y(y)。将这个形式代入方程中,并将方程两边除以ψ(x, y),我们可以得到:

(iħ/X)dX/dx + (iħ/Y)dY/dy = -ħ²/2m(X''/X + Y''/Y) + V(x, y)

由于等式两边只依赖于不同的变量,所以它们必须等于一个常数,我们将其记为E。这样我们就可以将方程分解为两个单变量方程:

(iħ/X)dX/dx + V(x)X = EX

(iħ/Y)dY/dy + V(y)Y = EY

解这两个方程,我们可以得到X(x)和Y(y)的解。然后,我们可以将它们乘在一起,得到波函数的解ψ(x, y)。

值得注意的是,势能函数V(x, y)在不同的问题中会有不同的形式。在一些简单的情况下,它可能是一个常数,表示一个均匀势场。在其他情况下,它可能是一个依赖于位置的函数,表示一个非均匀势场。根据具体问题的不同,我们需要选择适当的势能函数来求解方程。

一旦我们找到了波函数的解,我们就可以计算粒子在不同位置上的概率分布。根据量子力学的原理,波函数的模的平方给出了粒子在给定位置上的概率密度。通过对波函数的模的平方进行归一化,我们可以得到粒子在整个空间中的总概率为1。

总结起来,求解具有恒定质量的二维薛定谔方程是一个重要的问题,在量子力学研究中具有广泛的应用。通过采用分离变量的方法,我们可以将方程分解为两个单变量方程,并求解它们以得到波函数的解。这样我们就可以计算粒子在不同位置上的概率分布,从而了解粒子的行为。

希望本文对读者理解求解具有恒定质量的二维薛定谔方程有所帮助。在实际应用中,我们可能会遇到更加复杂的情况,需要采用其他方法来求解方程。然而,分离变量法是一个重要的起点,它为我们理解量子力学中的基本概念和现象提供了一个坚实的基础。

核心代码

function[E,psi]=Schroed2D_PWE_f(x,y,V0,Mass,n,Nx,Ny,NGx,NGy)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Constants %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%h=6.62606896E-34;               %% Planck constant [J.s]hbar=h/(2*pi);e=1.602176487E-19;              %% electron charge [C]m0=9.10938188E-31;              %% electron mass [kg]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Interpolation on a grid that have 2^N points %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%NGx = 2*floor(NGx/2);           %% round to lower even numberNGy = 2*floor(NGy/2);           %% round to lower even number[X,Y] = meshgrid(x,y);xx=linspace(x(1),x(end),Nx);yy=linspace(y(1),y(end),Ny);[XX,YY] = meshgrid(xx,yy);V=interp2(X,Y,V0,XX,YY);dx=x(2)-x(1);dxx=xx(2)-xx(1);dy=y(2)-y(1);dyy=yy(2)-yy(1);Ltotx=xx(end)-xx(1);Ltoty=yy(end)-yy(1);[XX,YY] = meshgrid(xx,yy);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Building of the potential in Fourier space %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Vk = fftshift(fft2(V))*dxx*dyy/Ltotx/Ltoty;Vk =Vk(Ny/2-NGy+1:Ny/2+NGy+1 , Nx/2-NGx+1:Nx/2+NGx+1);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Reciprocal lattice vectors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Gx = (-NGx/2:NGx/2)'*2*pi/Ltotx;Gy = (-NGy/2:NGy/2)'*2*pi/Ltoty;NGx=length(Gx);NGy=length(Gy);NG=NGx*NGy;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Building Hamiltonien %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%idx_x = repmat((1:NGx), [NGy 1 ]);idx_x = idx_x(:);idx_y = repmat((1:NGy)', [1 NGx]);idx_y = idx_y(:);%idx_X = (idx_x-idx_x') + NGx;      %% work only in Octave%idx_Y = (idx_y-idx_y') + NGy;      %% work only in Octaveidx_X = (repmat(idx_x,[1 NG])-repmat(idx_x',[NG 1])) + NGx;     %% work in Octave and Matlabidx_Y = (repmat(idx_y,[1 NG])-repmat(idx_y',[NG 1])) + NGy;     %% work in Octave and Matlabidx = sub2ind(size(Vk), idx_Y(:), idx_X(:));idx = reshape(idx, [NG NG]);GX = diag(Gx(idx_x));GY = diag(Gy(idx_y));D2 = GX.^2 + GY.^2 ;H =  hbar^2/(2*m0*Mass)*D2  +  Vk(idx)*e ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Solving Hamiltonien %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%H = sparse(H);[psik, Ek] = eigs(H,n,'SM');E = diag(Ek)  / e;%E=abs(E);E=real(E);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Transforming & Scaling the waves functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%for i=1:n    PSI = reshape(psik(:,i),[NGy,NGx]);    PSI = invFFT2D(PSI,Ny,Nx)/(dxx*dyy) ;    psi_temp = interp2(XX,YY,PSI,X,Y);    psi(:,:,i) = psi_temp / sqrt( trapz( y' , trapz(x,abs(psi_temp).^2 ,2) , 1 )  );  % normalisation of the wave function psiend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% here is a small patch due to differences between Octave and Matlab% Matlab order the eigen values while Octave reverse itif E(1)>E(2)  psi=psi(:,:,end:-1:1);  E=E(end:-1:1);endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function [Vxy] = invFFT2D(Vk2D,Ny,Nx)Nkx=length(Vk2D(1,:));Nky=length(Vk2D(:,1));Nx1=Nx/2-floor(Nkx/2);Nx2=Nx/2+ceil(Nkx/2);Ny1=Ny/2-floor(Nky/2);Ny2=Ny/2+ceil(Nky/2);Vk2D00=zeros(Ny,Nx);Vk2D00( Ny1+1:Ny2 , Nx1+1:Nx2)=Vk2D;Vxy=ifft2(ifftshift(Vk2D00));end

⛄ 运行结果

⛄ 参考文献

[1]刘晓军.有限差分法解薛定谔方程与MATLAB实现[J].高师理科学刊, 2010(3):3.DOI:10.3969/j.issn.1007-9831.2010.03.022.

⛳️ 代码获取关注我

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料

🍅 仿真咨询

1 各类智能优化算法改进及应用

生产调度、经济调度、装配线调度、充电优化、车间调度、发车优化、水库调度、三维装箱、物流选址、货位优化、公交排班优化、充电桩布局优化、车间布局优化、集装箱船配载优化、水泵组合优化、解医疗资源分配优化、设施布局优化、可视域基站和无人机选址优化

2 机器学习和深度学习方面

卷积神经网络(CNN)、LSTM、支持向量机(SVM)、最小二乘支持向量机(LSSVM)、极限学习机(ELM)、核极限学习机(KELM)、BP、RBF、宽度学习、DBN、RF、RBF、DELM、XGBOOST、TCN实现风电预测、光伏预测、电池寿命预测、辐射源识别、交通流预测、负荷预测、股价预测、PM2.5浓度预测、电池健康状态预测、水体光学参数反演、NLOS信号识别、地铁停车精准预测、变压器故障诊断

2.图像处理方面

图像识别、图像分割、图像检测、图像隐藏、图像配准、图像拼接、图像融合、图像增强、图像压缩感知

3 路径规划方面

旅行商问题(TSP)、车辆路径问题(VRP、MVRP、CVRP、VRPTW等)、无人机三维路径规划、无人机协同、无人机编队、机器人路径规划、栅格地图路径规划、多式联运运输问题、车辆协同无人机路径规划、天线线性阵列分布优化、车间布局优化

4 无人机应用方面

无人机路径规划、无人机控制、无人机编队、无人机协同、无人机任务分配
、无人机安全通信轨迹在线优化

5 无线传感器定位及布局方面

传感器部署优化、通信协议优化、路由优化、目标定位优化、Dv-Hop定位优化、Leach协议优化、WSN覆盖优化、组播优化、RSSI定位优化

6 信号处理方面

信号识别、信号加密、信号去噪、信号增强、雷达信号处理、信号水印嵌入提取、肌电信号、脑电信号、信号配时优化

7 电力系统方面

微电网优化、无功优化、配电网重构、储能配置

8 元胞自动机方面

交通流 人群疏散 病毒扩散 晶体生长 火灾扩散

9 雷达方面

卡尔曼滤波跟踪、航迹关联、航迹融合、状态估计



相关文章
|
7月前
|
算法 数据安全/隐私保护 计算机视觉
基于二维CS-SCHT变换和LABS方法的水印嵌入和提取算法matlab仿真
该内容包括一个算法的运行展示和详细步骤,使用了MATLAB2022a。算法涉及水印嵌入和提取,利用LAB色彩空间可能用于隐藏水印。水印通过二维CS-SCHT变换、低频系数处理和特定解码策略来提取。代码段展示了水印置乱、图像处理(如噪声、旋转、剪切等攻击)以及水印的逆置乱和提取过程。最后,计算并保存了比特率,用于评估水印的稳健性。
|
2月前
|
存储 数据可视化 数据挖掘
使用Matlab绘制简单的二维与三维图形
【10月更文挑战第3天】本文详细介绍了如何在 Matlab 中绘制简单的二维和三维图形,包括曲线图、柱状图、散点图、网格图、表面图、等高线图、多边形填充图、切片图及矢量场等。文章提供了丰富的代码示例,如使用 `plot`、`bar`、`scatter`、`plot3`、`mesh`、`surf`、`contour` 等函数绘制不同类型图形的方法,并介绍了 `rotate3d`、`comet3` 和 `movie` 等工具实现图形的交互和动画效果。通过这些示例,读者可以轻松掌握 Matlab 的绘图技巧,并应用于数据可视化和分析中。
|
4月前
|
安全
【2023高教社杯】D题 圈养湖羊的空间利用率 问题分析、数学模型及MATLAB代码
本文介绍了2023年高教社杯数学建模竞赛D题的圈养湖羊空间利用率问题,包括问题分析、数学模型建立和MATLAB代码实现,旨在优化养殖场的生产计划和空间利用效率。
224 6
【2023高教社杯】D题 圈养湖羊的空间利用率 问题分析、数学模型及MATLAB代码
|
4月前
|
存储 算法 搜索推荐
【2022年华为杯数学建模】B题 方形件组批优化问题 方案及MATLAB代码实现
本文提供了2022年华为杯数学建模竞赛B题的详细方案和MATLAB代码实现,包括方形件组批优化问题和排样优化问题,以及相关数学模型的建立和求解方法。
141 3
【2022年华为杯数学建模】B题 方形件组批优化问题 方案及MATLAB代码实现
|
4月前
|
数据采集 存储 移动开发
【2023五一杯数学建模】 B题 快递需求分析问题 建模方案及MATLAB实现代码
本文介绍了2023年五一杯数学建模竞赛B题的解题方法,详细阐述了如何通过数学建模和MATLAB编程来分析快递需求、预测运输数量、优化运输成本,并估计固定和非固定需求,提供了完整的建模方案和代码实现。
109 0
【2023五一杯数学建模】 B题 快递需求分析问题 建模方案及MATLAB实现代码
|
7月前
|
算法 数据安全/隐私保护 C++
基于二维CS-SCHT变换和扩频方法的彩色图像水印嵌入和提取算法matlab仿真
该内容是关于一个图像水印算法的描述。在MATLAB2022a中运行,算法包括水印的嵌入和提取。首先,RGB图像转换为YUV格式,然后水印通过特定规则嵌入到Y分量中,并经过Arnold置乱增强安全性。水印提取时,经过逆过程恢复,使用了二维CS-SCHT变换和噪声对比度(NC)计算来评估水印的鲁棒性。代码中展示了从RGB到YUV的转换、水印嵌入、JPEG压缩攻击模拟以及水印提取的步骤。
|
7月前
|
数据安全/隐私保护
耐震时程曲线,matlab代码,自定义反应谱与地震波,优化源代码,地震波耐震时程曲线
地震波格式转换、时程转换、峰值调整、规范反应谱、计算反应谱、计算持时、生成人工波、时频域转换、数据滤波、基线校正、Arias截波、傅里叶变换、耐震时程曲线、脉冲波合成与提取、三联反应谱、地震动参数、延性反应谱、地震波缩尺、功率谱密度
基于混合整数规划的微网储能电池容量规划(matlab代码)
基于混合整数规划的微网储能电池容量规划(matlab代码)
|
7月前
|
算法 调度
含多微网租赁共享储能的配电网博弈优化调度(含matlab代码)
含多微网租赁共享储能的配电网博弈优化调度(含matlab代码)
|
7月前
|
Serverless
基于Logistic函数的负荷需求响应(matlab代码)
基于Logistic函数的负荷需求响应(matlab代码)