You are on page 1of 2

0001 //End Sem Exam

0002 //NAME: PUSHPENDRA YADAV (025)


0003 //APP NO : 210810015913
0004
0005 //QUESTION-5 HALF HARMONIC OSCILLATOR
0006
0007 clc;
0008 clear;
0009 clf();
0010 x=(0.001:0.001:0.1);
0011 n=length(x)-1;
0012 for i=1:1:n
0013 a(i,i)=-2
0014 a(i,i+1)=1
0015 a(i+1,i)=1
0016 end
0017 a(n+1,n+1)=-2
0018 //disp(a)
0019 t=6.1042D-39
0020 h=0.001
0021 t=t/(h*h)
0022 //formation of potential matrix
0023 for i=1:1:n+1
0024 b(i,i)=0
0025 end
0026 cp=int(n/2+1)
0027 w=0.4
0028 m=9.10938D-31
0029 qE=1D-33
0030 for i=1:1:n+1
0031 b(i,i)=w*w*m*(x(i))*(x(i))/2
0032 end
0033 //disp(b)
0034 //formation of hamiltonian matrix
0035 H=-t*a+b
0036 //disp(H)
0037 [u,v]=spec(H)
0038 p=1
0039 e=1.6e-19
0040 printf('eigen values of energy in ev')
0041 for i=1:1:1
0042 disp(v(i,i)/e)
0043 end
0044 //values of x and y
0045 for i=1:1:n+1
0046 xp(i+1)=x(i)
0047 z(i+1)=b(i,i)
0048 end
0049 y(1)=0;z(1)=0;xp(1)=0
0050 //plot of potential
0051 plot(xp,z,"linewidth",3)
0052 //plot of energy levels and functions
0053 for i=1:1:1
0054 //disp(v(i,i))
0055 E(i)=v(i,i)
0056 xe(1)=0
0057 xe(2)=sqrt(2*(E(i))/(m*w*w))
0058 plot(xe,E(i),"--r","linewidth",2)
0059 for j=1:1:n+1
0060 y(j+1)=-2D-34*u(j,i)
0061 end
0062 plot(xp,10*(y),"k","linewidth",2)
0063 title("HALF HARMONIC OSCILLATOR")
0064 xlabel("distance")
0065 ylabel("wavefunction")
0066 end

You might also like