mesh plot - Z must be a matrix - problem resolved
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
ZHAO YANG
am 14 Sep. 2020
Bearbeitet: ZHAO YANG
am 14 Sep. 2020
My Ef returing is list a number
0 Kommentare
Akzeptierte Antwort
KSSV
am 14 Sep. 2020
Bearbeitet: KSSV
am 14 Sep. 2020
% 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 = [4E13, 6E13, 7E18, 1E17, 1E15, 1E15, 1E13, 1E15, 1E15, 2E16, 2.5E15];
Na = [1E15, 1E13, 1E15, 1E15, 1E17, 1E15, 8E14, 5E13, 6.E15, 6.4E13, 6.3E17];
n = numel(Nd) ; m = numel(Na) ;
Ef = zeros(m,n);
[Na,Nd] = meshgrid(Na,Nd) ;
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:n
for j = 1:m
Ef(i,j) = fzero(@Efn, Ef0,[],data,Nd(i,j),Na(i,j));
end
end
Ef = Ef*kT; % Rescale
fprintf('%g\n',Ef)
pcolor(Na,Nd,Ef)
%patch(Na,Nd,Ef)
%plot3(Na,Nd,Ef)
grid on
3 Kommentare
KSSV
am 14 Sep. 2020
Did you provide the function? Efn? The only change to the above code, Na, Nd are matrices and two loops are introduced.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Assembly finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!