필터 지우기
필터 지우기

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 CenterFile Exchange에서 Linear 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