Optimization ODE using Simulated Annealing
Show older comments
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 Comments
Star Strider
on 16 Aug 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.
Amal Ashoor
on 17 Aug 2020
Answers (0)
Categories
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!