In: Electrical Engineering
1) For a p-n junction in thermal equilibrium, write your own codes in Matlab to calculate and plot the electric field distribution across the p-n junction along with appropriate axes labeling.
MATLAB CODE
clc;
es=input('Enter value of es = '); % permivity of Si
Na=input('Enter value of Na in cm^-3 = '); % Na
Nd=input('Enter value of Nd in cm^-3 = '); % Nd
x=-2e-6:1e-7:2e-6; % x axis to represent diatnace from
junction
q=1.6*10-19; % charge on electron
E=zeros(1,length(x));
for i=1:length(x)
if(x(i)<0) % for N side
E(i)=q*Na*x(i)/es; % electric field on n side
end
if(x(i)>=0)
E(i)=-q*Nd*x(i)/es; % for P side
end
end
plot(x,E)
xlabel('Distance from junction(x) in m')
ylabel('Electric Field in V/m')
title('Electric Field in PN junction')
RESULT: