## Documentation Center |

Find trim point of dynamic system

`[x,u,y,dx] = trim('sys')[x,u,y,dx] = trim('sys',x0,u0,y0)[x,u,y,dx] = trim('sys',x0,u0,y0,ix,iu,iy)[x,u,y,dx] = trim('sys',x0,u0,y0,ix,iu,iy,dx0,idx)[x,u,y,dx,options] = trim('sys',x0,u0,y0,ix,iu,iy,dx0,idx,options)[x,u,y,dx,options] = trim('sys',x0,u0,y0,ix,iu,iy,dx0,idx,options,t)`

A trim point, also known as an equilibrium
point, is a point in the parameter space of a dynamic system at which
the system is in a steady state. For example, a trim point of an aircraft
is a setting of its controls that causes the aircraft to fly straight
and level. Mathematically, a trim point is a point where the system's
state derivatives equal zero. `trim` starts from
an initial point and searches, using a sequential quadratic programming
algorithm, until it finds the nearest trim point. You must supply
the initial point implicitly or explicitly. If `trim` cannot
find a trim point, it returns the point encountered in its search
where the state derivatives are closest to zero in a min-max sense;
that is, it returns the point that minimizes the maximum deviation
from zero of the derivatives. `trim` can find trim
points that meet specific input, output, or state conditions, and
it can find points where a system is changing in a specified manner,
that is, points where the system's state derivatives equal specific
nonzero values.

`[x,u,y,dx] = trim('sys')` finds
the equilibrium point nearest to the system's initial state,

[sizes,x0,xstr] = sys([],[],[],0)

`[x,u,y,dx] = trim('sys',x0,u0,y0)` finds
the trim point nearest to

abs([x-x0; u-u0; y-y0])

`[x,u,y,dx] = trim('sys',x0,u0,y0,ix,iu,iy)` finds
the trim point closest to

abs([x(ix)-x0(ix); u(iu)-u0(iu); y(iy)-y0(iy)])

`[x,u,y,dx] = trim('sys',x0,u0,y0,ix,iu,iy,dx0,idx)` finds
specific nonequilibrium points, that is, points at which the system's
state derivatives have some specified nonzero value. Here,

`[x,u,y,dx,options] = trim('sys',x0,u0,y0,ix,iu,iy,dx0,idx,options)` specifies
an array of optimization parameters that

The following table describes how each element affects the search for a trim point. Array elements 1, 2, 3, 4, and 10 are particularly useful for finding trim points.

No. | Default | Description |
---|---|---|

1 | 0 | Specifies display options. 0 specifies no display; 1 specifies tabular output; -1 suppresses warning messages. |

2 | 10^{–4} | Precision the computed trim point must attain to terminate the search. |

3 | 10^{–4} | Precision the trim search goal function must attain to terminate the search. |

4 | 10^{–6} | Precision the state derivatives must attain to terminate the search. |

5 | N/A | Not used. |

6 | N/A | Not used. |

7 | N/A | Used internally. |

8 | N/A | Returns the value of the trim search goal function (λ in goal attainment). |

9 | N/A | Not used. |

10 | N/A | Returns the number of iterations used to find a trim point. |

11 | N/A | Returns the number of function gradient evaluations. |

12 | 0 | Not used. |

13 | 0 | Number of equality constraints. |

14 | 100*(Number of variables) | Maximum number of function evaluations to use to find a trim point. |

15 | N/A | Not used. |

16 | 10^{–8} | Used internally. |

17 | 0.1 | Used internally. |

18 | N/A | Returns the step length. |

`[x,u,y,dx,options] = trim('sys',x0,u0,y0,ix,iu,iy,dx0,idx,options,t)` sets
the time to

Consider a linear state-space system modeled using a State-Space block

The *A*, *B*, *C*,
and *D* matrices to enter at the command line or
in the block parameters dialog are:.

A = [-0.09 -0.01; 1 0]; B = [ 0 -7; 0 -2]; C = [ 0 2; 1 -5]; D = [-3 0; 1 0];

To find an equilibrium point in this model called `sys`,
use:

[x,u,y,dx,options] = trim('sys') x = 0 0 u = 0 0 y = 0 0 dx = 0 0

The number of iterations taken is:

options(10) ans = 7

To find an equilibrium point near `x = [1;1], u = [1;1]`,
enter

x0 = [1;1]; u0 = [1;1]; [x,u,y,dx,options] = trim('sys', x0, u0); x = 1.0e-13 * -0.5160 -0.5169 u = 0.3333 0.0000 y = -1.0000 0.3333 dx = 1.0e-12 * 0.1979 0.0035

The number of iterations taken is

options(10) ans = 25

To find an equilibrium point with the outputs fixed to `1`,
use:

y = [1;1]; iy = [1;2]; [x,u,y,dx] = trim('sys', [], [], y, [], [], iy) x = 0.0009 -0.3075 u = -0.5383 0.0004 y = 1.0000 1.0000 dx = 1.0e-15 * -0.0170 0.1483

To find an equilibrium point with the outputs fixed to 1 and the derivatives set to 0 and 1, use

y = [1;1]; iy = [1;2]; dx = [0;1]; idx = [1;2]; [x,u,y,dx,options] = trim('sys',[],[],y,[],[],iy,dx,idx) x = 0.9752 -0.0827 u = -0.3884 -0.0124 y = 1.0000 1.0000 dx = 0.0000 1.0000

The number of iterations taken is

options(10) ans = 13

The trim point found by `trim` starting from
any given initial point is only a local value. Other, more suitable
trim points may exist. Thus, if you want to find the most suitable
trim point for a particular application, it is important to try a
number of initial guesses for `x`, `u`,
and `y`.

Was this topic helpful?