Parameters identification providing derivative
2 views (last 30 days)
Show older comments
Hello, I'd need to perform parameters identification of a battery model. Let's say I have a simplified model that can be described by a single RC branch:
where the parameters I want to identify are R0, R and C (or the time constant tau instead of C). I have the data of V_measured, V_oc and I. The RC branch voltage needs to be calculated using the provided derivative.
Now, my question is: how can I set up the problem to estimate the parameters using the two equations that I have provided? I don't really need the full code, just some workflow would be fine, because I have no idea how to setup a problem like this.
I know that there is a toolbox that performs this kind of parameters estimation, but I'd like to have a little more control on how the algorithm performs.
6 Comments
Torsten
on 6 Mar 2024
So there is no separate theoretical equation for I such that you could solve the two equations
dI/dt = ? or f(t,I(t),V_1(t)) = 0
C*dV_1/dt = I(t) - V_1(t)/R
for I and V_1 ?
Accepted Answer
Star Strider
on 6 Mar 2024
The differential equation needs to be integrated in order to use . This does not appear to be as straightforward as I would have hoped, however it may do what you want. (It has the virtue of running without error using random data, however that is all I can say for it.) Note thet the time vector needs to be an input as well as the variables acquired at those times.
Try this —
syms Vmeas V_oc I R_0 V_1(t) C R V_10
sympref('AbbreviateOutput',false);
eqn1 = Vmeas == V_oc - I * R_0 - V_1
eqn2 = C*diff(V_1) == I - V_1/R
V_1(t) = dsolve(eqn2, V_1(0) == V_10)
eqn1 = subs(eqn1)
eqn1 = simplify(eqn1, 500)
clearvars
% % % R_0 = b(1), R = b(2), C = b(3)
fcn = @(b,V_oc,Vmeas,V_10,I,t) Vmeas + exp(t/(b(3)*b(2))).*(V_10 - I*b(2)) + I*b(2) + I*b(1) - V_oc;
t = 0:10;
Vmeas = randn(size(t));
V_10 = 0;
I = randn(size(t));
V_oc = randn(size(t));
B0 = rand(3,1)
B = fminunc(@(b)norm(fcn(b,V_oc,Vmeas,V_10,I,t)), B0)
I used fminunc here, it also works with fminsearch, (although producing differnt parameter estimates) and would probably work as well with fmincon if you wanted to constrain the parameters.
.
15 Comments
Star Strider
on 7 Mar 2024
Edited: Star Strider
on 7 Mar 2024
The problem is not with the files.
The problem is the Answers site. I have no idea wwhy they will not run here using the run function. They should, and this has worked in other Answers.
I am reporting it to MathWorks as a bug. It needs to be fixed.
EDIT — (7 Mar 2024 at 17:21)
Report a bug Case 06860945 created successfully
Our offices are closed March 7 to March 12 for a staff development program. If this is an urgent matter that cannot wait for our return, call your local office to leave a message. We will respond as soon as possible.
.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!