how to select proper parameters for "opt.StartPoint" ?
16 vues (au cours des 30 derniers jours)
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?
0 commentaires
Réponses (1)
Matt J
le 22 Avr 2021
Modifié(e) : Matt J
le 22 Avr 2021
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
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))
Voir également
Catégories
En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!