MATLAB Answers

0

Finite Quantum Well Width issue

Asked by Ege Tunç on 13 Mar 2019
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

  0 Comments

Sign in to comment.

0 Answers