Need help on difficulty 3D Plot. - Problem resolved

조회 수: 4 (최근 30일)
ZHAO YANG
ZHAO YANG 2020년 9월 13일
편집: ZHAO YANG 2020년 9월 14일
I got below question. Need help on coding for below issue.

채택된 답변

Alan Stevens
Alan Stevens 2020년 9월 13일
Here's some code to get you started
% Data
T=300;
k=1.38064852e-23;
Ea=7.2*10^(-21);
Ed=7.2*10^(-21);
Nv=2.5*10^(25)*((0.59*T/300)^(3/2))*10^(-6);
Nc=2.5*10^(25)*((1.08*T/300)^(3/2))*10^(-6);
Ec=0.5*(1.166-0.000473*T*T/(636+T))*1.6*10^(-19);
Ev=0;
% Collect data to be passed to function
data = [T, k , Ea, Ed, Nv, Nc, Ec, Ev];
% Dopant concentrations
Nd = 10^17;
Na = 10^5;
Ef0 = 10^-21; % Initial guess at fermi energy
% Use fzero to find fermi energy, i.e. the value of Ef that makes
% function Efn return zero
Ef = fzero(@Efn, Ef0,[],data,Nd,Na);
disp(Ef)
function F = Efn(Ef,data, Nd, Na)
T = data(1);
k = data(2);
Ea = data(3);
Ed = data(4);
Nv = data(5);
Nc = data(6);
Ec = data(7);
Ev = data(8);
kT = k*T;
F = Nc*exp(-(Ec-Ef)/kT) + Na/(1+4*exp(-(Ef-Ea)/kT)) - Nv*exp(-(Ef-Ev)/kT) - Nd/(1+2*exp(-(Ed-Ef)/kT));
end
The above will calculate the Fermi level for one pair of dopant concentrations. See if you can take it from here.
  댓글 수: 3
Alan Stevens
Alan Stevens 2020년 9월 14일
The following shows how to structure the calculation for several pairs of Nd and Na. In doing this I noticed that the results were sensitive to the initial guess. This was a numerical problem related to the size of the energy levels, so in the listing below the energies are scaled (divided by kT) before being called by fzero. The resulting fermi levels are then rescaled at the end.
% Data
T=300;
k=1.38064852e-23;
Ea=7.2*10^(-21);
Ed=7.2*10^(-21);
Nv=2.5*10^(25)*((0.59*T/300)^(3/2))*10^(-6);
Nc=2.5*10^(25)*((1.08*T/300)^(3/2))*10^(-6);
Ec=0.5*(1.166-0.000473*T*T/(636+T))*1.6*10^(-19);
Ev=0;
% Scale energy levels
kT = k*T;
Ea = Ea/kT; Ed = Ed/kT; Ec = Ec/kT; Ev = Ev/kT;
% Collect data to be passed to function
data = [Ea, Ed, Nv, Nc, Ec, Ev];
% Dopant concentrations
Nd = [10^17, 10^15, 10^15, 10^3, 10^5, 10^5];
Na = [10^5, 10^3, 10^15, 10^15, 10^17, 10^5];
Ef = zeros(numel(Nd),1);
Ef0 = 10^-21/kT; % Initial guess at scaled fermi energy
% Use fzero to find fermi energy, i.e. the value of Ef that makes
% function Efn return zero
for i = 1:numel(Nd)
Ef(i) = fzero(@Efn, Ef0,[],data,Nd(i),Na(i));
end
Ef = Ef*kT; % Rescale
fprintf('%g\n',Ef)
function F = Efn(Ef,data, Nd, Na)
Ea = data(1);
Ed = data(2);
Nv = data(3);
Nc = data(4);
Ec = data(5);
Ev = data(6);
F = Nc*exp(-(Ec-Ef)) + Na*exp(-(Ef-Ea)) - Nv*exp(-(Ef-Ev)) - Nd./(1+2*exp(-(Ed-Ef)));
end
ZHAO YANG
ZHAO YANG 2020년 9월 14일
Thank you very much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by