フィルターのクリア

Why is "fitoptions" returning the error "Too many input arguments"?

2 ビュー (過去 30 日間)
Zachary
Zachary 2022 年 10 月 31 日
コメント済み: Zachary 2022 年 10 月 31 日
I have defined the function 'BTKcon' and saved it in an .m file as seen below.
function [con] = BTKcon(Gamma,Delta,Z,T,V)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
u0Sq=@(Gamma,Delta,En)(1/2)*(1+(sqrt(((abs(En)+1i*Gamma).^2)-(Delta.^2))./(abs(En)+1i*Gamma)));
v0Sq=@(Gamma,Delta,En)(1/2)*(1-(sqrt(((abs(En)+1i*Gamma).^2)-(Delta.^2))./(abs(En)+1i*Gamma)));
alpha=@(Gamma,Delta,En)real(u0Sq(Gamma,Delta,En));
etta=@(Gamma,Delta,En)imag(u0Sq(Gamma,Delta,En));
betta=@(Gamma,Delta,En)real(v0Sq(Gamma,Delta,En));
gammaSq=@(Gamma,Delta,Z,En)((alpha(Gamma,Delta,En)+(Z.^2).*(alpha(Gamma,Delta,En)...
-betta(Gamma,Delta,En))).^2)+((etta(Gamma,Delta,En).*(2.*(Z.^2)+1))).^2;
BTKA=@(Gamma,Delta,Z,En)sqrt(((alpha(Gamma,Delta,En).^2)+(etta(Gamma,Delta,En).^2)).*((betta(Gamma,Delta,En).^2)...
+(etta(Gamma,Delta,En).^2)))./gammaSq(Gamma,Delta,Z,En);
BTKB=@(Gamma,Delta,Z,En)((Z.^2).*((((alpha(Gamma,Delta,En)-betta(Gamma,Delta,En)).*Z-2.*etta(Gamma,Delta,En)).^2)...
+((2.*Z.*etta(Gamma,Delta,En)+(alpha(Gamma,Delta,En)-betta(Gamma,Delta,En))).^2)))./gammaSq(Gamma,Delta,Z,En);
dFermi=@(E,V,T)11600.928.*exp(11600.928.*(E-V)./T)./(((1+exp(11600.928.*(E-V)./T)).^2).*T);
con = (1+Z.^2).*integral(@(E) real(dFermi(E,V,T).*(1+BTKA(Gamma,Delta,Z,E)-BTKB(Gamma,Delta,Z,E))),...
-0.015,0.015,ArrayValued=true);
end
I am able to define a 'fittype' using the above function.
ft = fittype('BTKcon( Gamma, Delta, Z, T, V)','independent',{'V'},'coefficients',{'Gamma','Delta','Z','T'})
However, when I try to use 'fitoptions' to define starting points or bounds on my coefficients (e.g., using the command below), I keep getting the error "Too many input arguments".
options = fitoptions(ft, 'Lower', [0.00001 0.0001 0 0.02])
Can someone help me see what I am doing wrong?

採用された回答

Torsten
Torsten 2022 年 10 月 31 日
fitoptions is part of fittype, not vice versa as you try to do. Thus fitoptions must be define before fittype:
options = fitoptions('Lower', [0.00001 0.0001 0 0.02]);
ft = fittype('BTKcon( Gamma, Delta, Z, T, V)','independent',{'V'},'coefficients',{'Gamma','Delta','Z','T'},options);
See the example under
Chapter Create Fit Options and Fit Type Before Fitting

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by