Optimization ODE using Simulated Annealing

Hello,
I am working on finding the optimum values of 26 parameter (P) in a system ODE using SA. The code I am following is presented in this question. So, I tried to change the objective function to the equation shown in the picture. However, I wasn't able to. Are there any suggections to how I can solve it?
Z(P) = ZP = the estimated parameters in a vector
Z= Z1= experimental values of the parameters
P = vector of 26 parameters
function a = objective(P)
% Experimental Data
Z1=[B1,N1,Nq1,A1,S1,L1,AB1]; % size(8X7)where each element is a vector with 8 elements
% initial values of the 7 variables
y01=[0.2;0.124;0.2;0.03;0.0045;0.00348;0.19];
tspan=[0;48;96;144;192;240;288;480];
[t,V]= ode45(@equations,tspan,y01); % @equations is the ode function including 26 parameter
ZP= V.';
% calculate the objective function
a= 0;
for h=1:8
for l=1:7
a= a +((ZP(l,h)-Z1(l,h))/Z1(l,h))^2;
end
end
end
%%%
% the optimization call
ftns= @(P) objective(P);
[P,error,exitflag,output] = simulannealbnd(ftns,P0,lb,ub,options);

2 comentarios

Star Strider
Star Strider el 16 de Ag. de 2020
The simulannealbnd function is going to attempt to minimise ‘objective’ by adjusting the ‘P’ parameters. However no ‘P’ parameter ever appears in the code in ‘objective’.
Note that neither ‘equations’ nor the elements of ‘Z1’ are defined. They must either be defined or be passed specifically as additional arguments to ‘objective’, since they will not automatically be inherited from the calling workspace.
Thank you for your answer. I defined 'ZP' as below but still can't seems to find it. Also, 'equations' was defined in the same format as 'kinetics' appears in the previous question. While 'Z1' is a matrix of constants.
ZP= @(P) equations;
% Objective function
e1 = minus(ZP,Z1);
e2= e1/Z1;
e3= e2.^2;
a= sum(e3,'all');

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Etiquetas

Preguntada:

el 16 de Ag. de 2020

Comentada:

el 17 de Ag. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by