solve a non-linear least squares problem

4 visualizzazioni (ultimi 30 giorni)
Cong
Cong il 6 Lug 2014
Risposto: Alex Sha il 31 Mag 2019
I want to fit data with my custom function to calculate parameters of the model. Data of x and y are attached, and they are shown as the figure. The custom function is:
y=a+(-((4/3)*3.14*((60e-10)^3-((60e-10)-x).^3).*b*(c-1096)/c+4*3.14*(60e-10)^2.*(d.*((60e-10)-x).^2/(60e-10)^2+e+(f-e-d.*((60e-10)-x).^2/(60e-10)^2).*exp(-x./g)))/(1e3*1.38e-23*1090))
and parameters have constraints and initials:
-inf<a<inf, a=2e4
1e11<b<1e12, b=7.8e11
1120<c<1300, c=1200
70<d<130, d=127
300<e<700, e=680
400<f<900, f=850
1e-10<g<3e-10, g=2.5e-10
However, I both tried matlab and rigin to fit data with the model, but they all failed to find a good fit. I am appreciate if you can provide any suggestions. In fact, I understand there are too many parameters, and I also tried to fix parameter b, d, e and g while free others, but still no good results.

Risposte (2)

dpb
dpb il 6 Lug 2014
With your constraints as they are, the cuic term dominates -- a single quadratic would appear to likely fit the data quite nicely. Try
[b,s,mu]=polyfit(x,y,2);
Note that the above uses the internal scaling to condition the matrix numerically.
Or, figure out some other set of bounds that essentially turn the cubic portion off or fit some other correlation that has the essence of a quadratic. It's not feasible to turn the answer into something different with the constraints you've placed in both the form of the equation and the bounds on the coefficients.
  8 Commenti
Cong
Cong il 9 Lug 2014
Thank you for a very detailed answer. One comment about a double precision problem: the term
e+(f-e-d.*((60e-10)-x).^2/(60e-10)^2).*exp(-x./g)
should multiply by
4*3.14*(60e-10)^2
in order to compare to
-(4/3)*3.14*((60e-10)^3-((60e-10)-x).^3).*b*(c-1096)/c
Yes, the model has a physical background, which is a phenomenological model described by http://www.sciencedirect.com/science/article/pii/0039602894906351
dpb
dpb il 9 Lug 2014
Can't see the article so not of much help. If they indeed did estimate such, their data surely had to have had much more structure in it than that you presented to have had any chance at all.

Accedi per commentare.


Alex Sha
Alex Sha il 31 Mag 2019
only need to free the range of parameter "g" while keep other parameter ranges as originly, the result should be very good:
Root of Mean Square Error (RMSE): 0.00665318927569739
Sum of Squared Residual: 0.0557295437706628
Correlation Coef. (R): 0.99999931888018
R-Square: 0.999998637760824
Adjusted R-Square: 0.999998635591654
Determination Coef. (DC): 0.999998637759301
Chi-Square: -0.00690242716732607
F-Statistic: 153179168.346496
Parameter Best Estimate
---------- -------------
a 11997.8585863498
b 499078186880.248
c 1120
d 70
e 404.459269397904
f 400.807634142111
g -5.39659727990207E-9

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by