# h2syn

Compute H_{2} optimal controller

## Syntax

## Description

`[`

computes a stabilizing `K`

,`CL`

,`gamma`

] = h2syn(`P`

,`nmeas`

,`ncont`

)*H*_{2}-optimal controller
`K`

for the plant `P`

. The plant has a partitioned
form

$$\left[\begin{array}{c}z\\ y\end{array}\right]=\left[\begin{array}{cc}{P}_{11}& {P}_{12}\\ {P}_{21}& {P}_{22}\end{array}\right]\left[\begin{array}{c}w\\ u\end{array}\right],$$

where:

*w*represents the disturbance inputs.*u*represents the control inputs.*z*represents the error outputs to be kept small.*y*represents the measurement outputs provided to the controller.

`nmeas`

and `ncont`

are the number of signals in
*y* and *u*, respectively. *y* and
*u* are the last outputs and inputs of `P`

,
respectively. `h2syn`

returns a controller `K`

that
stabilizes `P`

and has the same number of states. The closed-loop system
`CL`

` = lft(P,K)`

achieves the performance level
`gamma`

, which is the *H*_{2} norm
of `CL`

(see `norm`

).

## Examples

## Input Arguments

## Output Arguments

## Tips

`h2syn`

gives you state-feedback gain and observer gains that you can use to express the controller in observer form. The observer form of the controller`K`

is:$$\begin{array}{c}d{x}_{e}=A{x}_{e}+{B}_{2}u+{L}_{x}e\\ u={K}_{u}{x}_{e}+{L}_{u}e.\end{array}$$

Here, the innovation term

*e*is:$$e=y-{C}_{2}{x}_{e}-{D}_{22}u.$$

`h2syn`

returns the state-feedback gain*K*and the observer gains_{u}*L*and_{x}*L*as fields in the_{u}`info`

output argument.You can use this form of the controller for gain scheduling in Simulink

^{®}. To do so, tabulate the plant matrices and the controller gain matrices as a function of the scheduling variables using the Matrix Interpolation (Simulink) block. Then, use the observer form of the controller to update the controller variables as the scheduling variables change.Do not choose weighting functions with poles very close to

*s*= 0 (*z*= 1 for discrete-time systems). For instance, although it might seem sensible to choose*W*= 1/*s*to enforce zero steady-state error, doing so introduces an unstable pole that cannot be stabilized, causing synthesis to fail. Instead, choose*W*= 1/(*s*+*δ*). The value*δ*must be small but not very small compared to system dynamics. For instance, for best numeric results, if your target crossover frequency is around 1 rad/s, choose*δ*= 0.0001 or 0.001. Similarly, in discrete time, choose sample times such that system and weighting dynamics are not more than a decade or two below the Nyquist frequency.

## Algorithms

`h2syn`

uses the methods described in Chapter 14 of [1].

## References

[1] Zhou, K., Doyle, J., Glover, K,
*Robust and Optimal Control*. Upper Saddle River, NJ: Prentice Hall,
1996.

## Version History

**Introduced before R2006a**