How to fit an integral with more than one variables?

3 ビュー (過去 30 日間)
LR
LR 2023 年 5 月 5 日
回答済み: Pooja Kumari 2024 年 10 月 10 日
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

採用された回答

Pooja Kumari
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 件)

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by