Skip to main content

One Dimensional Harmonic Oscillator-Numerov Method

x=[];
h0=1;
M=4;
N=M+1;
x(1)=0;
x(N)=x(1)+h0*M;
x=x(1):h0:x(N)
A=zeros(N);
A(1,1)=-2*(5*(x(N)*h0)^2/12+1);
A(N,N)=-2*(5*(x(1)*h0)^2/12+1);
A(1,2)=1-(x(M)*h0)^2)/12;
A(N,M)=1-(x(2)*h0)^2)/12;
B=zeros(N);
B(1,1)=B(N,N)=-10*(h0^2)/6;
B(1,2)=B(N,M)=-(h0^2)/6;
for i=2:M
B(i,i)=-10*(h0^2)/6;
B(i,i-1)=B(i,i+1)=-(h0^2)/6;
A(i,i)=-2*(5*(x(N+1-i)*h0)^2/12+1);
A(i,i+1)=1-(x(N-i)*h0)^2)/12;
A(i,i-1)=1-(x(N+2-i)*h0)^2)/12;
end
A
B

Comments

Popular posts from this blog

Second Harmonic Generation N=1:21

gnuplot> set xrange [-180:180] gnuplot> set yrange [-180:180]

splot sin(cos(x*pi/180))*sin(cos(x*pi/180))/(cos(x*pi/180)*cos(x*pi/180))*sin(cos(y*pi/180))*sin(cos(y*pi/180))/(cos(y*pi/180)*cos(y*pi/180))+sin(cos((x+1)*pi/180))*sin(cos((x+1)*pi/180))/(cos((x+1)*pi/180)*cos((x+1)*pi/180))*sin(cos((y+1)*pi/180))*sin(cos((y+1)*pi/180))/(cos((y+1)*pi/180)*cos((y+1)*pi/180))+sin(cos((x+2)*pi/180))*sin(cos((x+2)*pi/180))/(cos((x+2)*pi/180)*cos((x+2)*pi/180))*sin(cos((y+2)*pi/180))*sin(cos((y+2)*pi/180))/(cos((y+2)*pi/180)*cos((y+2)*pi/180))+sin(cos((x+3)*pi/180))*sin(cos((x+3)*pi/180))/(cos((x+3)*pi/180)*cos((x+3)*pi/180))*sin(cos((y+3)*pi/180))*sin(cos((y+3)*pi/180))/(cos((y+3)*pi/180)*cos((y+3)*pi/180))+sin(cos((x+4)*pi/180))*sin(cos((x+4)*pi/180))/(cos((x+4)*pi/180)*cos((x+4)*pi/180))*sin(cos((y+4)*pi/180))*sin(cos((y+4)*pi/180))/(cos((y+4)*pi/180)*cos((y+4)*pi/180)) +sin(cos((x+5)*pi/180))*sin(cos((x+5)*pi/180))/(cos((x+5)*pi/180)*cos((x+5)*pi/180))*sin(cos((y+5)*pi/180))*sin(cos(…

Second Harmonic Generation

gnuplot> set xrange [-180:180] gnuplot> set yrange [-180:180] gnuplot> set pm3d gnuplot> set hidden3d  gnuplot> set title 'SHG' gnuplot> splot sin(cos(x*pi/180))*sin(cos(x*pi/180))/(cos(x*pi/180)*cos(x*pi/180))*sin(cos(y*pi/180))*sin(cos(y*pi/180))/(cos(y*pi/180)*cos(y*pi/180)) title 'N=1
'