Curve Fitting Toolbox do not provide decent fitting. Inf computed by model function, fitting cannot continue. Try using or tightening upper and lower bounds on coefficients.

I have the following problem:
I am working on an automated battery parameter estimation tool to estimate the battery parameters of an RC equivalent circuit model. For that, the first step consists in determining how many RC branches are necessary, given the data. And I have data from an HPPC test. So I want to see whether I shoul use a 1-RC equivalent circuit model, a 2-RC ECM or even a 3-RC ECM and I want to use MATLAB Curve Fitting toolbox. My objective is to try to fit the governing equation of my RC-equivalent circuit model with the data of a charging pulse from my HPPC test. The governing equation of my 2-RC equivalent circuit model is:
y(x) = a + b*exp(-c*x) + d*exp(-f*x), where y is the terminal voltage of my 2-RC-ECM and x is the time.
For some reason, when I use MATLAB cftool, with, as Custom Equation, the governing equation above, I have a straight line and the fitting is very bad. My guess is that the equation is not "Centered and scaled". But I don't know how to center and scale with my data on the "Custom equation" mode.
The weird part is that, when I use the "Exponential" type of the cftool with 2 terms, the curve fits the data pretty accurately.
Below, I attached a screen of the curve fit I have with "Custom equation".
My question is: how can I make my equation fit the data with the cftool.
Any help would be extremely appreciated.

 Réponse acceptée

I think the answer is to "correctly guess" the equation that fits the data by trial-and-error method.
If you already know the behavior of the RC circuit, then use mathematical model in the literature.
Else, please attach the data for a deeper investigation.

11 commentaires

Thank you for your answer.
Here is the data for that one pulse
The values on x-axis are very large. I have rescaled the x-axis variable so that it is normalized by mean 1.
You can try this model:
General model:
f(x) = a*(x - 1)^(1/b) + d
Coefficients (with 95% confidence bounds):
a = 0.07845 (0.06849, 0.08842)
b = 6.499 (5.68, 7.318)
d = 2.328 (2.326, 2.329)
Goodness of fit:
SSE: 0.0001412
R-square: 0.9294
Adjusted R-square: 0.9287
RMSE: 0.0008299
or this one:
General model:
f(x) = a*(x - 1)^(1/b) + d + 0.05655*(p1*(x-1)^2 + p2*(x-1) + p3)*(sign(x - 1) + 1)/2
Coefficients (with 95% confidence bounds):
a = 0.1518 (-0.0329, 0.3366)
b = 3.996 (2.008, 5.984)
d = 2.325 (2.32, 2.329)
p1 = 10.69 (-3.352e+05, 3.352e+05)
p2 = -0.3655 (-705.4, 704.7)
p3 = 0.1336 (0.03053, 0.2368)
Goodness of fit:
SSE: 0.0001694
R-square: 0.9153
Adjusted R-square: 0.9132
RMSE: 0.0009158
@Sam Chak, I don't know if it's me doing something wrong but I still don't get the same fit as you. I did everything you did... Here is what I obtain with the model you sent me:
Okay, @Thomas Madoki, the CFtool is actually not very intelligent. I forgot to mention that you have to click on the "Fit Option" and set the Lower and Upper limits of the Coefficients so that the CFtool can narrow the search, making it relatively easier to converge.
For example, the lower limit of "a" (amplitude) should be 0, because the data does not have negative values. Similar to the lower limit of "d" (displacement). The shape of the data looks the nth-root function, so the lower limit of "b" (degree of the root) should be 1.
If you use the hppcTime1pulse data directly as the x-axis variable, then you need to edit the Custom Equation to
a*(x - c)^(1/b) + d
where the lower limit of "c" (center) should be 0, because the data stays on the right-hand side (positive) of the y-axis. Actually "c" and "d" can be determined instantly from the data. The first data begins at (1.41239687e+5, 2.328). You can imagine that this point is the shifted Origin (0, 0).
If you plug in these two pre-determined parameters, then the CFtool only needs to find "a" and "b".
a*(x - 1.41239687e+5)^(1/b) + 2.328
@Sam Chak Thank you very much, it works!
I still have one question: how do you explain the fact that when using MATLAB cftool with the cursor put on 'Exponential' mode instead of 'Custom equation' with that same data, it gives a pretty good fit? How come when I use exponentials with the 'Custom equation' mode, the fitting is really poor (it is simply a straight line) but not when using 'Exponential' mode?
Once again, thank you for your help.
Don't mention it, @Thomas Madoki.
I'm unsure, probably the built-in algorithm of the exponential function is effective.
By the way, thanks to you suggestion, Now, you have a better fit.
General model:
f(x) = 0.3683*(x - 1)^(1/3.679) + 2.319 + a*exp(b*(x - 1)^c)
Coefficients (with 95% confidence bounds):
a = 0.0106 (0.01017, 0.01103)
b = -2.786e+04 (-5.055e+04, -5162)
c = 0.9406 (0.8618, 1.019)
Goodness of fit:
SSE: 0.000119
R-square: 0.9405
Adjusted R-square: 0.9399
RMSE: 0.000762
Hello, I'm really sorry that I join this discussion. I hope you have a great day.
May I know how you can change the equation to a completely different equation?, I mean @Thomas Madoki have this equation y(x) = a + b*exp(-c*x) + d*exp(-f*x) and then you @Sam Chak suggest this equation f(x) = a*(x - 1)^(1/b) + d
Currently I'm working on my thesis SOC Estimation and struggling with the parameter estimation
Thank you in advance, sorry for the bad grammar
Thanks for reaching out! The OP, @Thomas Madoki, initially tried to fit the data using two exponentially decaying functions with a bias 'a'. However, the normalized data plot doesn’t look decaying at all; instead, it appears to be switching rapidly from 2.328 to 2.338 around , and then it rises steadily afterward at a rate almost similar to a surd function. So, I suggested the shifted surd model, with a bias 'd'.
Thank you for your answer, honestly I still don't quite understand, I need to read a lot more and figure out how to estimate my data. I guess I cannot use the equation from the paper if the condition like that
Once again thank you
If you’re having trouble estimating the parameters, please consider posting a new question and sharing your data for evaluation to determine suitable models for fitting your data.
Thank you for helping, I will sure post the question and share my data

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by