How to fit an integral with more than one variables?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello,
I'm trying to fit data with an integral with 4 variables and I'm not sure how to write the fit.
I have two matrix I(y-axis) and tau(x-axis), and here is the part of my script which fails:
syms d mu sig x
s = fitoptions('Method','NonlinearLeastSquares','Lower',[0.05 0.05],'Upper',[100 100],'Startpoint',[0.05 0.05]);
fff=@(mu,sig,x)vpaintegral((1./(d.*sig.*sqrt(6.28))).*exp((-(log(d)-mu).^2)./(2.*sig.^2)).*0.5.*(1-exp(-(d.*x).^1.1)).*cos(1.9.*d.*x),d,0.05,10)
fitint= fittype(fff, 'options',s)
f3=fittype(tau,Indq,fitint) %ligne 45
I get the following errors:
Error using fittype>iCreateFittype
First input argument must be a string scalar or character vector, cell array or anonymous function.
Error in fittype (line 330)
obj = iCreateFittype( obj, varargin{:} );
Error in Analyse_DQ (line 45)
f3=fittype(tau,I,fitint)
Any suggestions?
Thanks
댓글 수: 0
채택된 답변
Pooja Kumari
2024년 10월 10일
Hi LR,
I understand that you are facing "Error using fittype>iCreateFittype" error when you're trying to fit your data using a custom function that involves an integral.
The error you're encountering is due to incorrect usage of the "fittype" function.
f3=fittype(tau,Indq,fitint) %line 45
Perform the fitting instead of "fittype" function
[fittedCurve, gof] = fit(tau, I, fitint);
"First input argument must be a string scalar or character vector, cell array or anonymous function." is occuring due to matrix tau(x-axis).
You can refer to the below documentation for more information on "fittype" function:
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!