how to solve this error: objective function is returning undefined values at initial point. fsolve cannot continue.
27 ビュー (過去 30 日間)
古いコメントを表示
clc;
clear all;
close all;
q=1.6*10^(-19); % charge; unit Coulomb
m0=9.11*10^(-31); % rest mass of electron; unit Kg
m=0.64*m0; % effective mass; unit Kg
h=6.634*10^(-34); % Planks Constant; unit Js
hcross=h/(2*pi); % reduced Planks Constant; unit Js
D0=m/(pi*hcross^(2)); % 2D density of states; unit cm^-2ev^-1
K=1.38*10^(-23); % Boltzmann Constant; unit J/K
T=300; % Temperature; unit K
E0 = 0.84*q; % Half of energy gap in eV
Vo = E0/q; % Half of energy gap in V
Vt = K*T/q; % Threshold Voltage in V
L=4*10^(-4); % Length of the channel (cm)
W=9.9*10^(-4); % Width of the channel (cm)
e=8.854*10^(-14); % Permittivity of free space (F/cm)
e_tox =4; % Relative permittivity of SiO2
t_tox=300*10^(-7); % Thickness of oxide (cm)
mobility=150; % Drift mobility (cm^2/Vs)
Cox=(e*e_tox)/t_tox; % Gate oxide capacitance per unit area (F/cm^2)
Vds = 0.01; % Drain source voltage (V)
Cdq = 37.957; % Degenerate limit of quantum capacitance (muF/cm^2)
A1 = 1 /(D0*K*T);
Vgs = (-50:0.1:50)';
x0 = ones(size(Vgs,1),1);
opts = optimoptions(@fsolve,'MaxFunctionEvaluations',500*numel(x0));
options = optimoptions('fsolve','Display','iter');
Nch = fsolve(@(x)solve_nch(x,Vo,Vt,q,Cox,Vgs,A1),x0,options);
plot(Vgs,Nch);
function F = solve_nch(x,Vo,Vt,q,Cox,Vgs,A1)
nch = x;
F = Vo + Vt.*log(exp(A1.*nch)-1) + q.*nch/Cox - Vgs;
end
0 件のコメント
回答 (1 件)
Alan Weiss
2021 年 4 月 5 日
編集済み: Alan Weiss
2021 年 4 月 5 日
I suggest that you learn to use the debugger. I put a break point in the solve_nch function, and found that at the first function call the value of A1 was about 1e-17 and nch was a vector of 1. Therefore exp(A1*nch) = 1 and so the logarithm evaluated to -Inf.
Alan Weiss
MATLAB mathematical toolbox documentation
P.S. Perhaps I should point out that for small a, , so
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!