//Ex2_9 Pg-91 clc disp("For P-type,Nd=0. By charge neutrality and mass action law,") disp(" p + Nd = p = +na = (ni)^2/n") disp("or n^2 + Na*n - (ni)^2 = 0") disp("Solving the quadratic equation for n and discharging the extraneous negative root,one obtains") disp(" n = 0.5*(-Na + sqrt(Na^2 + 4*ni^2))") disp("Knowing n,one obtains from mass action law p = ni^2/n") disp("For N-type doping,Na=0. By analogous procedure,") disp(" p = 0.5*(-Nd +sqrt(Nd^2 + 4*Ni^2)); n=ni^2/p")