mesh plot - Z must be a matrix - problem resolved

1 回表示 (過去 30 日間)
ZHAO YANG
ZHAO YANG 2020 年 9 月 14 日
編集済み: ZHAO YANG 2020 年 9 月 14 日
My Ef returing is list a number

採用された回答

KSSV
KSSV 2020 年 9 月 14 日
編集済み: KSSV 2020 年 9 月 14 日
% 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 件のコメント
KSSV
KSSV 2020 年 9 月 14 日
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 2020 年 9 月 14 日
My bad, I forgot to add the efn function.
Thank you very much! It's work

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAssembly についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by