Kp=Hmax single first-order kinetic term with delayed effect

2 views (last 30 days)
Hi everyone, im trying to generate a single first-order kinetic term with delayed effec (SFO)t. then after running the code, it comes out like this
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the value of the optimality tolerance,
and constraints are satisfied to within the value of the constraint tolerance.
<stopping criteria details>
67 Kp = Hmax;
what does the Kp=Hmax means, because when i run order of the second kode of degradation (DFO), it gave me Kp,Tb,Tp,q,Rst values but SFO keeps giving me 67 Kp = Hmax; even when i tried with different datas.
This is my function for identSFO, the one that i bold is where it said : <stopping criteria details>
67 Kp = Hmax;
function [K,Kp,Tp,Tb,q,J,eflag,Rst]=identSFO(T,Xe,K0i)
% Assuming single first-order kinetic term with delayed effect
K0a = [5, 2]; % intial guess
% Specify the sampling interval
TS = 1 ; % Editable
Tspan = 0:TS:180; % The maximum time is editable
% Specify the deadtime
Dt = 0 ; % Deadtime is editable
% Specify the maximum change or gain
Hmax = -0.04 ;
a0 = K0i(1);
if a0 == 0
K0 = K0a;
K0 = K0i;
% =================
LB = [0.05 1]; % lower limit
UB = [10 50]; % upper limit
A = []; B = []; Aeq = []; Beq = [];
alg1 = 'interior-point' ;
alg2 = 'sqp' ;
option = optimset('display','iter','MaxFunEvals',4000,'TolFun', ...
[K,J,eflag ] = fmincon(@cost,K0,A,B,Aeq,Beq,LB,UB,[],option);
% ------------------------------------------------------------------
function J = cost(K)
% Predict C/C0 profile
[y,t] = SFOdyns(K,Hmax,Tspan,Dt);
n = length(T);
for i = 1:n
% Square Error of prediction
Ex(i) = ((Xe(1) + y( floor(T(i)/TS+1) ) - Xe(i) )/(1 - 0.5*Xe(i) ) )^2;
J = sum(Ex);
% -------------------------------------------
[y,t] = SFOdyns(K,Hmax,Tspan,Dt);
n = length(T);
Xave = mean(Xe);
for i = 1:n
Jsse(i) = ( (Xe(1)+ y(floor(T(i)/TS+1) ) - Xe(i) ) )^2;
Jave (i) = ( Xe(i) - Xave )^2;
% Least square fitness
Rst = 1 - sum(Jsse)/sum(Jave);
m = length(y);
Iy = Xe(1)*ones(m,1);
Y = Iy+y;
xlabel('Time [min]');
% Model paremeters
[Tp,Tb,q] = paraSFOmodel(K);
Kp = Hmax;

Answers (1)

Jasvin on 18 Oct 2023
Edited: Jasvin on 18 Oct 2023
Hi Arrissa,
There does not seem to be enough information to come to a conclusive answer.
As per my understanding what is happening is that you are executing the "identSFO" function with some specified input for "K", "T" and "K0i". The "fmincon" solver call within the code is finishing optimization with the appropriate exit message, however you also get the output of "67 Kp = Hmax;" in the command window.
I have used the code you have posted on the following MATLAB Answers post for reference:
This probably means that there is some execution element to your code that causes the line number and the associated function line to be printed to the command window as part of debug output. But from the information provided it is not completely clear what could be causing this, especially because there are a lot of dependent functions and code files.
I hope that provided some clarity as to what might be happening here.
There are a couple of follow-up questions to ask here if we want to delve deeper:
  1. Does the execution of the "identSFO" function go to completion or does it halt mid-way or does it error out?
  2. Could you provide some sample input for the variables that are input to the "identSFO" function? That is, "K", "T", "K0i", and any other variables that are part of the dependencies, in order to fully execute the "identSFO" function and test out whether I am getting the same output on my system as well.
If you need a proper investigation of this output, I would highly recommend that you try out MathWorks Technical Support, you can create a technical support case by using the following link:


Find more on Problem-Based Optimization Setup in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!