Least Square Curve Fitting, finding the initial start values in lsqcurvefit function in Matlab
Mostra commenti meno recenti
First of all thank you for your help in advance. My question is regarding Matlab and non-linear Least Square curve fitting in Matlab - in both I am not familiar with.
I have this type of data:
x = [600, 800, 1000, 1200, 1400];
y = [0, 0.2, 0.4, 0.7, 1];
I am trying to use the following algorithms:
f = @(p,x) (p(3)-p(4))./(1+exp(-(x-p(2))/p(1)))+p(4);
opts = optimset('Display','off','MaxFunEvals',1000);
sigfit = lsqcurvefit(f, starting_value, intervals,problong,[],[],opts);
bisection_point= sigfit(2)-sigfit(1)*log((sigfit(3)-0.5)/(0.5-sigfit(4)))
The only problem I have is the starting value in sigfit variable. What would be the best starting values given the above numbers? Any help please would be extremely appreciated.
The above algorithms are based in lsqcurvefit function found in Matlab. Here is the link: http://uk.mathworks.com/help/optim/ug/lsqcurvefit.html
The X vector is time intervals in milliseconds, whereas the Y vector represents responses some participant made whether those intervals where percieved as close to a short (400ms) or long (1600ms) interval. I dont understand what starting points mean. Ultimately what I need to do is find the 0.5 point in the Y axis and the corresponding value on the X axis. The solution will be somewhere between 600ms to 1400 ms and probably around the 1200ms mark. I have put the starting value as a vector from 600 to 1400 but, I have no idea whether that is right or what that means. I was hoping someone better equipped than me can help answer this problem precisely :).
Thank you again, Dritan
Risposta accettata
Più risposte (1)
Alex Sha
il 26 Dic 2019
if " the second and third number are 0.2 and 0.4.", then the result will be much better:
Root of Mean Square Error (RMSE): 0.0103862568043762
Sum of Squared Residual: 0.000539371652032255
Correlation Coef. (R): 0.99957319083783
R-Square: 0.999146563841721
Adjusted R-Square: 0.998293127683441
Determination Coef. (DC): 0.999146563841721
Chi-Square: 0.00489464660589835
F-Statistic: 390.244601747778
Parameter Best Estimate
---------- -------------
p1 -543.133091644427
p2 1587.68753263344
p3 -0.502866494727889
p4 3.12808542388122

1 Commento
Yasin Islam
il 23 Gen 2021
wich function gives all the above mentioned values as an output? It's not out of lsqcurvefit is it?
Categorie
Scopri di più su Get Started with Curve Fitting Toolbox in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
