# Finite Quantum Well Width issue

23 views (last 30 days)
Ege Tunç on 13 Mar 2019
Commented: Jaime Varela on 5 Feb 2021
I have a code to solve Schrödinger equation for finite square well. However, when i change width of the well between 100-200 or anything like 150,250,350 etc. the solution for equation is not symetric. However, schrödinger equation should have been symetrical sinus function. How can i fix this? Here is my code:
clc
close all
clear all
dx=0.01;
n=1:1:1;
for l=1:1
E=n(l)*n(l)*pi*pi/2;
%Potential Energy Function for a Square well
Width=100;
U=zeros(1,Width);
U(1)=10;
U(Width)=10;
K(1:Width)=(2).*(E-U(1:Width));
% initial condition
W(1)=1;
W(2)=0;
% updating the wave function
for i=2:Width-1
W(i+1)=W(i)*(2-K(i)*dx*dx)-W(i-1);
end
% Normalizing probability density funtion of the particle
Ws=W.*W./trapz(W.*W);
V=ones(1,Width+100).*100;
Wtemp=zeros(1,Width+100);
V(51:Width+50)=U;
V=(V./100).*max(Ws);
Wtemp(51:Width+50)=Ws;
Wa(l,:)=Wtemp;
L=length(Wtemp);
X=linspace(0,2,L)-1;
figure(1)
plot(X,Wa(l,:),'linewidth',2)
hold on
plot(X,V,'r','linewidth',2)
h=gca;
xlabel('X','fontSize', 15);
ylabel('psi','fontSize', 15);
end
Jaime Varela on 5 Feb 2021
This is a likely incorrect way of getting bound states for the finite square well. It doesn't look like you took the boundary conditions at infinity into account. Could you describe your strategy? The infinite square well function has an analytic solution but the energy levels require some numerics.

### Categories

Find more on Quantum Mechanics in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!