Code covered by the BSD License  

Highlights from
Optimization Algorith for Uncertain Nonlinear Dynamic System

from Optimization Algorith for Uncertain Nonlinear Dynamic System by Khairul Redwan
Dynamic Integrated System Optimization and Parameter Estimation (DISOPE) Technique

fstar( x, u, option )
function [ sys ] = fstar( x, u, option )
% This function must be created  by the user to define
% the dynamic system xdot = f*(x,u,t)


if  option == 'value' 

% return the value xdot from
% xdot = f*(x,u,t)

   sys = zeros(2,1);

   sys(1) = -(x(1)+0.25)+(x(2)+0.5)*exp(25*x(1)/(x(1)+2))-(1+u(1))*(x(1)+0.25);
   sys(2) = 0.5-x(2)-(x(2)+0.5)*exp(25*x(1)/(x(1)+2));


elseif  option == 'gradz' 

% return the jacobian matrix of f*(x,u,k) with respect to x 

     sys = zeros( 2,2 );

     h = [sqrt(eps); 0];

     sys(:,1) = (fstar(x+h,u,'value')-fstar(x-h,u,'value'))/(2*norm(h));

     h = [0; sqrt(eps)];

     sys(:,2) = (fstar(x+h,u,'value')-fstar(x-h,u,'value'))/(2*norm(h));

elseif  option == 'gradv' 

% return the jacobian matrix of f*(x,u,k) with respect to u

          h = sqrt(eps);

          sys = (fstar(x,u+h,'value')-fstar(x,u-h,'value'))/(2*h);         

elseif  option == 'xinit' 

% return the initial state conditons

          sys = [ 0.05; 0 ];
%          sys = [ 0.09; 0.09 ];


else sys = [];

end;

return;

   


Contact us