mesh plot - Z must be a matrix - problem resolved

1 visualizzazione (ultimi 30 giorni)
My Ef returing is list a number

Risposta accettata

KSSV
KSSV il 14 Set 2020
Modificato: KSSV il 14 Set 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 Commenti
KSSV
KSSV il 14 Set 2020
Did you provide the function? Efn? The only change to the above code, Na, Nd are matrices and two loops are introduced.
ZHAO YANG
ZHAO YANG il 14 Set 2020
My bad, I forgot to add the efn function.
Thank you very much! It's work

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by