How to fit an integral with more than one variables?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
LR
am 5 Mai 2023
Beantwortet: Pooja Kumari
am 10 Okt. 2024
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 Kommentare
Akzeptierte Antwort
Pooja Kumari
am 10 Okt. 2024
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Interpolation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!