how to select proper parameters for "opt.StartPoint" ?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Matt J
am 22 Apr. 2021
Bearbeitet: Matt J
am 22 Apr. 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 Kommentare
Matt J
am 23 Apr. 2021
For example,
p=polyfit( (log(x)*sin(x*b)^2) , log(yData), 1 );
a=p(1);
c=exp(p(2))
Siehe auch
Kategorien
Mehr zu Linear and Nonlinear Regression 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!