How to fit complicated function with 3 fitting parameters using Least square regression

I want to fit below equation J(v). J and V data areavailable.
N=10^21
q=1.6x10^-19
Epsilon=26.5 x 10^-14
d=3x10^- 6
Initial values may be x0=[µ l H]=[10^-5 5 10^18]
3 fitting parameters are: µ, l and H. other parameters are known.
can some one help me to solve this?
I am not expert in Matlab
V is xdata:
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
5.5
6
6.5
7
7.5
8
J is ydata:
1.64544E-05
1.99822E-05
0.000032253
4.2623E-05
7.40498E-05
0.000660899
0.007578998
0.027109725
0.106353025
0.30299725
0.7332185
1.550115
2.98009
5.3102775
8.88175
14.0394325
21.163215

9 commentaires

Hi, Le, I think your function is overdeterminted, there is unique vaule for parameter l, but infinite combination for parameters of u and h, for examples:
1:
Root of Mean Square Error (RMSE): 0.111273524152212
Sum of Squared Residual: 0.2104905520133
Correlation Coef. (R): 0.999845673432621
R-Square: 0.999691370681932
Parameter Best Estimate
---------- -------------
u 2.32291533744055E-11
l 5.69421576733531
H 6.70987929031922E17
2:
Root of Mean Square Error (RMSE): 0.111273524152212
Sum of Squared Residual: 0.2104905520133
Correlation Coef. (R): 0.999845673433156
Parameter Best Estimate
---------- -------------
u 8.96577966791522E-57
l 5.69421576534176
H 7101504622.69801
3:
Root of Mean Square Error (RMSE): 0.111273524152212
Sum of Squared Residual: 0.2104905520133
Correlation Coef. (R): 0.999845673428399
R-Square: 0.999691370673488
Parameter Best Estimate
---------- -------------
u 9.04488585246612E-43
l 5.69421578308753
H 2044822881092.28
So, if you take out parameter H from your function, it is only parameter u and l left:
J=q*u*N*((2*L+1)*V/L)^(L+1)*(L/(d*(L+1)))^(2*L+1)*(Eps/(q))^L;
then the result will be stable and unique, like below:
Root of Mean Square Error (RMSE): 0.111273524152213
Sum of Squared Residual: 0.210490552013303
Correlation Coef. (R): 0.999845673430017
Parameter Best Estimate
---------- -------------
u 7.19061667016099E-113
l 5.69422156938396
hi Alex,
thank you for your comment. unfortunately, H must be presented in the equation.
is this possible that we treat L as a constant L=5.69. and use other fitting method to find u and H?
Of course, you can set L=5.69, and keep parameters u and H, unfortunately, still multi-solutions:
1:
Root of Mean Square Error (RMSE): 0.111290321914178
Sum of Squared Residual: 0.210554107779945
Correlation Coef. (R): 0.999846762154431
R-Square: 0.9996935477907
Parameter Best Estimate
---------- -------------
u 2.76396226230446E-5
H 7.83440251335193E18
2:
Root of Mean Square Error (RMSE): 0.111290321914178
Sum of Squared Residual: 0.210554107779945
Correlation Coef. (R): 0.999846762154431
R-Square: 0.9996935477907
Parameter Best Estimate
---------- -------------
u 0.000146773320341069
H 1.05061262094087E19
3:
Root of Mean Square Error (RMSE): 0.111290321914178
Sum of Squared Residual: 0.210554107779945
Correlation Coef. (R): 0.999846762154431
R-Square: 0.9996935477907
Parameter Best Estimate
---------- -------------
u 0.000537244665843506
H 1.31971574477562E19
Since if L become constnat, the formation of your function looks like: J=u/H*f(V),obviously,“u/H” have infinite combinations.
Hi Alex, All 3 solutions above seem reasonable. if there were tightening upper and lower bounds, it would be better.
How about keeping u as a constant u=5*10^-5 and then vary H and L?
if keep u=5*10^-5, the result should be stable and unique:
Root of Mean Square Error (RMSE): 0.111273524152212
Sum of Squared Residual: 0.210490552013299
Correlation Coef. (R): 0.999845673432512
R-Square: 0.999691370681713
Parameter Best Estimate
---------- -------------
l 5.69421576774324
h 8.68730012231788E18
Hi Alex,
I have changed the fitting function and it works well as shown in the figure.
Thank you very much for your help
Pleasure, congratulation!
thank you!
The only problem is that result for H value is always equal to the startpoint that I set for H. Is it my fitting has been fail?
You may try to provide a little different start-value for H, and see the final result, if final H is still alway equaling to start-value of H, your fitting seems to have problem.

Connectez-vous pour commenter.

 Réponse acceptée

Hi, you may try to use "lsqcurvefit" command or curve fitting tool box (cftool), it is also better if you post data as well as known constant values, so other persons may try for you.

Plus de réponses (1)

I assume you have vectors of values for V and J, in which case fminsearch might be a good choice. The basic steps are:
  1. Write a function "predicted" to compute a predicted value of J for any given V, µ, l and H.
  2. Write a function "error" that computes the sum of (predictedJ - actualJ)^2, summing across the J vector.
  3. call fminsearch and pass it this error function as the function to be minimized. You will have to give it reasonable guesses for µ, l and H.

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by