how to select proper parameters for "opt.StartPoint" ?
Afficher commentaires plus anciens
I want to fit some data as below code witch generate from curve fitting tool:
[xData, yData] = prepareCurveData( x, y );
ft = fittype( 'c*x^(a*sin(x*b)^2)', 'independent', 'x', 'dependent', 'y' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.452987881098739 0.698037618662922 0.104515161828401];
[fitresult, gof] = fit( xData, yData, ft, opts );
How can I know the best start points?
Réponses (1)
Assuming b is known, the log-model
log(yData)=log(c) + a*(log(x)*sin(x*b)^2)
is a linear model in a and log( c ). Therefore, if you know a decent guess for b, you can use a linear fit (which doesn't require an initial guess) to develop initial guesses for the other parameters.
2 commentaires
hamzah almadani
le 23 Avr 2021
Matt J
le 23 Avr 2021
For example,
p=polyfit( (log(x)*sin(x*b)^2) , log(yData), 1 );
a=p(1);
c=exp(p(2))
Catégories
En savoir plus sur Linear and Nonlinear Regression dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!