# 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.

6 views (last 30 days)
Thomas Madoki on 18 May 2022
Commented: Sam Chak on 18 May 2022
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.

Sam Chak on 18 May 2022
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.
Sam Chak on 18 May 2022
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
RMSE: 0.000762

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by