Need help on difficulty 3D Plot. - Problem resolved

13 次查看(过去 30 天)
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

请先登录,再进行评论。

更多回答(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