Setting constraint between estimation parameters in nonlinear grey box estimation

36 visualizaciones (últimos 30 días)
I am trying to estimate an ODE with 9 parameters (1 fixed), denotes the params 5, 6, 7 as c1, c2, c3 respectively. I would like to impose a constraint on them as -\sqrt(4*c1*c3)< c2 < -\sqrt(3*c1*c3) (constraint for the third-order polynomial f(x) to have 2 extremum points x1, x2, lying on the right, and f(x1)> f(x2) >0 ). I am setting the desired idea in the below code:
But the estimated results of c1, c2, c3 does not satisfy the constraint I am imposing. I am really appriciate any idea of diagnoising this issue, thank you so much!
params =
struct with fields:
a1: 21.2434
a2: 0.0359
a3: 66
a4: 0.8672
c1: 8.2572e+03
c2: -1.3108e+04
c3: 7.2092e+03
p2p: 8.5374
p2n: 58.0616
>> -sqrt(3*8.2572e+03*7.2092e+03)
ans =
-1.3364e+04
Here is the setup code
%%
ModelFile = 'HR_model_Conv_cadence_quad_c';
%p1 = 0.1;
%p2p = 10;
%p2n = 2;
Order = [2 2 1]; % 2 output, 2 input, 1 state
%Order = [1 2 1]; % 1 output, 2 input, 1 state - neglect the HR dot
Params_guess = [a1; a2; a3; a4; c1; c2; c3; p2p; p2n]
InitialStates_guess = x0
Ts_model = 0;
nlgr_conv = idnlgrey(ModelFile,Order, Params_guess,InitialStates_guess,Ts_model,'Name','Heart_Rate_Conv');
nlgr_conv.SimulationOptions.Solver = 'ode45';%ode15s
% a1
nlgr_conv.Parameters(1).Minimum = 0.01; %positive
% a2
nlgr_conv.Parameters(2).Minimum = 0.001;
% a3
nlgr_conv.Parameters(3).Minimum = Subject.HR_min;
nlgr_conv.Parameters(3).Fixed = true;
% a4
nlgr_conv.Parameters(4).Minimum = 0.1;
% c1
nlgr_conv.Parameters(5).Minimum = 0.001;
% c2
nlgr_conv.Parameters(6).Maximum = -sqrt(3*nlgr_conv.Parameters(5).Value * nlgr_conv.Parameters(7).Value );
nlgr_conv.Parameters(6).Minimum = -sqrt(4*nlgr_conv.Parameters(5).Value * nlgr_conv.Parameters(7).Value );
% c3
nlgr_conv.Parameters(7).Minimum = 0.001;
%p2p
nlgr_conv.Parameters(8).Minimum = 0.001;
%p2n
nlgr_conv.Parameters(9).Minimum = 0.001;
nlgr_conv = setinit(nlgr_conv, 'Fixed', {false}); % Estimate the initial states.
opt = nlgreyestOptions('Display', 'on');
opt.SearchOptions.MaxIterations = 1000;
opt.OutputWeight = diag([1 4]);
nlgr_conv = nlgreyest(meas_data, nlgr_conv, opt);

Respuesta aceptada

Torsten
Torsten el 5 de Dic. de 2025 a las 21:42
Editada: Torsten el 6 de Dic. de 2025 a las 2:00
I doubt that you can set lower and upper bounds on parameters as nonlinear functions of other parameters. In my opinion, Parameters.Minimum and Parameters.Maximum must be fixed real scalars.
This is confirmed by the description of "Parameters" under "Properties" here:
I guess that in the lines
nlgr_conv.Parameters(6).Maximum = -sqrt(3*nlgr_conv.Parameters(5).Value * nlgr_conv.Parameters(7).Value );
nlgr_conv.Parameters(6).Minimum = -sqrt(4*nlgr_conv.Parameters(5).Value * nlgr_conv.Parameters(7).Value );
the initial values for parameters 5 and 7 are used to set lower and upper bounds on parameter 6. But since your code doesn't show the initial values you use for the parameters, I cannot test this.
If you want to set more complicated constraints for the parameters than just fixed bounds, you will have to couple the ode integrator (e.g. "ode45") and "fmincon" (using "nonlcon" to set the nonlinear parameter constraints) directly.
  1 comentario
tran hoan an
tran hoan an el 6 de Dic. de 2025 a las 8:26
Thank you so much Torsten, you are right. My current implementation only set the constraints from the intial states value, not during the entire runtime. I am now using the default lsqnonlin solver.
I will try to use fminon as you suggested, thank you again!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Systems of Nonlinear Equations en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by