% The solutions to the PIB with finite potential. % x= ka/2 y = Ka/2 % need m, e Vnot hbar = 1e-34 % J-sec a = 1e-9 % meters me = 1e-30 % kg; E1 = (hbar*pi/a)^2/(2*me) Vo = 1.20e-18 ; % J; n= sqrt(Vo/E1) c = (pi/2)*sqrt(Vo/E1) x = linspace(0,c,2000); y = x.*tan(x); z = sqrt(c^2-x.^2); xp = x/(pi/2); [v,Index] = find ( (diff(sign(y-z))) > 1) plot(xp,y,xp,z,xp(Index),z(Index),'g*') set(gca,'xlim',[0 1.1*c/(pi/2)],'ylim',[0 1.1*c]) xlabel('k*a/2 / [\pi/2]') ylabel('\kappa*a/2') % the solutions occur when z = y % want xp(Index)