Thread Subject: minimize cost function optimize integral gain

Subject: minimize cost function optimize integral gain

From: Karthi

Date: 8 Mar, 2010 02:24:05

Message: 1 of 7

i want to find the the value of integral gain Ki which minimize the cost function

cost function=integral(x1^2+x2^2)dt
where x1 and x2 are state variables.

i can calculate the cost function for various ki but i dont know how to optimize the integral gain.please help

Subject: minimize cost function optimize integral gain

From: Matt J

Date: 8 Mar, 2010 02:43:05

Message: 2 of 7

"Karthi " <gdkkannan@yahoo.co.in> wrote in message <hn1n44$s0p$1@fred.mathworks.com>...
> i want to find the the value of integral gain Ki which minimize the cost function
>
> cost function=integral(x1^2+x2^2)dt
> where x1 and x2 are state variables.
>
> i can calculate the cost function for various ki but i dont know how to optimize the integral gain.please help
===============

How can we help when you haven't shown the dependence of the cost function on Ki?
 

Subject: minimize cost function optimize integral gain

From: Karthi

Date: 10 Mar, 2010 11:23:07

Message: 3 of 7

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <hn1o7p$88h$1@fred.mathworks.com>...
> "Karthi " <gdkkannan@yahoo.co.in> wrote in message <hn1n44$s0p$1@fred.mathworks.com>...
> > i want to find the the value of integral gain Ki which minimize the cost function
> >
> > cost function=integral(x1^2+x2^2)dt
> > where x1 and x2 are state variables.
> >
> > i can calculate the cost function for various ki but i dont know how to optimize the integral gain.please help
> ===============
>
> How can we help when you haven't shown the dependence of the cost function on Ki?
> ===================
it is actually a simulink diagram, x1 and x2(state variables) are the outputs from two various blocks.the integral gain Ki is in another separate block. by giving various values to Ki cost function was calculated.there is no mathematical expression that relates cost function and Ki.actually cost function is a function of x1 and x2 but x1 and x2 depends upon Ki.

Subject: minimize cost function optimize integral gain

From: Matt J

Date: 10 Mar, 2010 12:38:05

Message: 4 of 7

"Karthi " <gdkkannan@yahoo.co.in> wrote in message <hn7ver$cl$1@fred.mathworks.com>...

> > How can we help when you haven't shown the dependence of the cost function on Ki?
> > ===================
> it is actually a simulink diagram, x1 and x2(state variables) are the outputs from two various blocks.the integral gain Ki is in another separate block. by giving various values to Ki cost function was calculated.there is no mathematical expression that relates cost function and Ki.actually cost function is a function of x1 and x2 but x1 and x2 depends upon Ki.
================

If there is no analytical expression for the cost function, you can try fminsearch().

Subject: minimize cost function optimize integral gain

From: Paul Kerr-Delworth

Date: 11 Mar, 2010 10:55:09

Message: 5 of 7

Hi Karthi,

There are two examples in the Optimization Toolbox documentation which show how incorporate a SIMULINK model into an objective function for use in an Optimization Toolbox solver.

Using lsqnonlin with a SIMULINK model
<<http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/brn4noo.html#f11160>>

Using fminimax with a SIMULINK Model
<<http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/brn4npl.html#f11247>>

While these do not solve your problem, they do show how to take the output of a simulation and use it in an objective function.

Hope this helps

Best regards,

Paul


"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <hn83rc$97t$1@fred.mathworks.com>...
> "Karthi " <gdkkannan@yahoo.co.in> wrote in message <hn7ver$cl$1@fred.mathworks.com>...
>
> > > How can we help when you haven't shown the dependence of the cost function on Ki?
> > > ===================
> > it is actually a simulink diagram, x1 and x2(state variables) are the outputs from two various blocks.the integral gain Ki is in another separate block. by giving various values to Ki cost function was calculated.there is no mathematical expression that relates cost function and Ki.actually cost function is a function of x1 and x2 but x1 and x2 depends upon Ki.
> ================
>
> If there is no analytical expression for the cost function, you can try fminsearch().

Subject: minimize cost function optimize integral gain

From: Karthi

Date: 12 Mar, 2010 14:29:05

Message: 6 of 7

hi paul,
it really helps.i have one more question, i have the differential equations(state space equations)for the system and i can solve the diff equations using ode and calculate the cost function. but the parameter integral gain is in the diff equations which is to be optimized.
let me explain the problem(for example)
minimize C=integral(x1^2+x2^2)dt
where x1 and x2 state variables
the state equations looks like

dx1/dt=-x1+ki/100;
dx2/dt=-x1+x2+ki/20

here i want to find the value of ki which minimize the cost function.

Subject: minimize cost function optimize integral gain

From: Torsten Hennig

Date: 12 Mar, 2010 14:50:30

Message: 7 of 7

> hi paul,
> it really helps.i have one more question, i have the
> differential equations(state space equations)for the
> system and i can solve the diff equations using ode
> and calculate the cost function. but the parameter
> integral gain is in the diff equations which is to be
> optimized.
> let me explain the problem(for example)
> minimize C=integral(x1^2+x2^2)dt
> where x1 and x2 state variables
> the state equations looks like
>
> dx1/dt=-x1+ki/100;
> dx2/dt=-x1+x2+ki/20
>
> here i want to find the value of ki which minimize
> the cost function.

Define a third differential equation by
dI/dt = x1^2 + x2^2, I(0)=0.
At t = tend, I(tend) gives you
integral_{0}^{tend} (x1^2+x2^2) dt.
You see:
For a given set of parameters ki, call ODE45
from within the optimizer, integrate
(including the ODE for I) and hand
I(tend) to the optimizer.
It will then (hopefully) adjust the ki such that
the integral in question is minimized.

Best wishes
Torsten.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
minimize cost f... Karthi 7 Mar, 2010 21:29:07
integral gain Karthi 7 Mar, 2010 21:29:07
optimization Karthi 7 Mar, 2010 21:29:06
rssFeed for this Thread

Contact us at files@mathworks.com