# ncfsyn

Loop shaping design using Glover-McFarlane method

## Syntax

``[K,CL,gamma,info] = ncfsyn(G)``
``[K,CL,gamma,info] = ncfsyn(G,W1)``
``[K,CL,gamma,info] = ncfsyn(G,W1,W2)``
``[K,CL,gamma,info] = ncfsyn(G,W1,W2,'ref')``

## Description

`ncfsyn` implements a method for designing controllers that uses a combination of loop shaping and robust stabilization as proposed in [1]-[2]. The function computes the Glover-McFarlane H normalized coprime factor loop-shaping controller K for a plant G with pre-compensator and post-compensator weights W1 and W2. The function assumes the positive feedback configuration of the following illustration.

To specify negative feedback, replace G by –G. The controller Ks stabilizes a family of systems given by a ball of uncertainty in the normalized coprime factors of the shaped plant Gs = W2GW1. The final controller K returned by `ncfsyn` is obtained as K = W1KsW2.

````[K,CL,gamma,info] = ncfsyn(G)` computes the Glover-McFarlane H∞ normalized coprime factor loop-shaping controller `K` for the plant `G`, with W1 = W2 = I. `CL` is the closed-loop system from the disturbances w1 and w2 to the outputs z1 and z2. The function also returns the H∞ optimal cost `gamma`, and a structure containing additional information about the result. ```

example

````[K,CL,gamma,info] = ncfsyn(G,W1)` computes the controller using the pre-compensator weight you specify in `W1`, and W2 = I.```
````[K,CL,gamma,info] = ncfsyn(G,W1,W2)` computes the controller using the specified pre-compensator weight `W1` and post-compensator weight `W2`.```
````[K,CL,gamma,info] = ncfsyn(G,W1,W2,'ref')` computes the controller with a reference command, as in the system of the following illustration. When you use this syntax, the closed-loop system `CL` represents the response from [w1; w2; ref] to [z1; z2].```

## Examples

collapse all

The following code shows how `ncfsyn` can be used for loop-shaping.

```s = zpk('s'); G = (s-1)/(s+1)^2; W1 = 0.5/s; [K,CL,GAM] = ncfsyn(G,W1); sigma(G*K,'r',G*W1,'r-.',G*W1*GAM,'k-.',G*W1/GAM,'k-.')```

The singular value plot of the achieved loop `G*K` is equal to that of the target loop `G*W1` to within plus or minus `GAM` (in dB).

## Input Arguments

collapse all

Plant, specified as a dynamic system model such as a state-space (`ss`) model. If `G` is a generalized state-space model with uncertain or tunable control design blocks, then `ncfsyn` uses the nominal or current value of those elements. `G` must have the same number of inputs and outputs.

Pre-compensator weight, specified as:

• Identity matrix `eye(N)`, where `N` is the number of inputs or outputs in `G`.

• SISO minimum-phase LTI model. In this case, `ncfsyn` uses the same weight for every loop channel.

• MIMO minimum-phase LTI model of the same I/O dimensions as `G`.

Select a pre-compensator and post-compensator weights W1 and W2 such that the gain of the shaped plant Gs = W2GW1 is sufficiently high at frequencies where good disturbance attenuation is required, and sufficiently low at frequencies where good robust stability is required.

Post-compensator weight, specified as the identity matrix `eye(N)` or a SISO or MIMO LTI model. The considerations for specifying `W2` are the same as those for `W1`.

## Output Arguments

collapse all

H-optimal loop-shaping controller, returned as a state-space (`ss`) model with the same I/O dimensions as `G`. The optimal controller K = W1KsW2. See Algorithms.

Optimal closed-loop system from the disturbances w1 and w2 to the outputs z1 and z2, returned as a state-space model. The closed-loop system is given by:

`$\left[\begin{array}{c}I\\ K\end{array}\right]{\left(I-GK\right)}^{-1}\left[I,\text{\hspace{0.17em}}G\right].$`

H optimal cost, returned as a positive scalar value greater than 1. The optimal cost is `hinfnorm(CL)`. The optimal controller Ks is such that the singular-value plot of the shaped loop Ls = W2GW1Ks optimally matches the target loop shape Gs to within a factor of `gamma`.

`gamma` is related to the normalized coprime stability margin of the system by `gamma = 1/ncfmargin(Gs,-K)`. Thus, `gamma` gives a good indication of robustness of stability to a wide class of unstructured plant variations, with values in the range 1 < `gamma` < 3 corresponding to satisfactory stability margins for most typical control system designs.

• `emax``nugap` robustness metric, `emax = 1/` `gamma` (see `gapmetric`)

• `Gs` — Shaped plant Gs = W2GW1

• `Ks` — Optimal controller for shaped plant `Gs`. The final controller is K = W1KsW2. See Algorithms for details.

## Tips

• While `ncfmargin` assumes a negative-feedback loop, the `ncfsyn` command designs a controller for a positive-feedback loop. Therefore, to compute the margin using a controller designed with `ncfsyn`, use ```[marg,freq] = ncfmargin(G,K,+1)```.

## Algorithms

The returned controller K = W1KsW2, where Ks is an optimal H controller that minimizes the H cost

`$\gamma \left({K}_{s}\right)={‖\left[\begin{array}{c}I\\ {K}_{s}\end{array}\right]{\left(I-{G}_{s}{K}_{s}\right)}^{-1}\left[I,{G}_{s}\right]‖}_{\infty }={‖\left[\begin{array}{c}I\\ {G}_{s}\end{array}\right]{\left(I-{K}_{s}{G}_{s}\right)}^{-1}\left[I,{K}_{s}\right]‖}_{\infty }.$`

The optimal performance is the minimal cost

`$\gamma :=\underset{{K}_{s}}{\mathrm{min}}\gamma \left({K}_{s}\right).$`

Suppose that Gs=NM–1, where N()*N() + M()*M() = I, is a normalized coprime factorization (NCF) of the weighted plant model Gs. Then, theory ensures that the control system remains robustly stable for any perturbation ${\stackrel{˜}{G}}_{s}$ to Gs of the form

`${\stackrel{˜}{G}}_{s}=\left(N+{\Delta }_{1}\right){\left(M+{\Delta }_{2}\right)}^{-1}$`

where Δ1, Δ2 are a stable pair satisfying

`${‖\left[\begin{array}{c}{\Delta }_{1}\\ {\Delta }_{2}\end{array}\right]‖}_{\infty }`

The closed-loop H-norm objective has the standard signal gain interpretation. Finally it can be shown that the controller, Ks, does not substantially affect the loop shape in frequencies where the gain of W2GW1 is either high or low, and will guarantee satisfactory stability margins in the frequency region of gain cross-over. In the regulator set-up, the final controller to be implemented is K=W1KsW2.

See McFarlane and Glover [1][2] for details.

## References

[1] McFarlane, D.C., and K. Glover, Robust Controller Design using Normalised Coprime Factor Plant Descriptions, Springer Verlag, Lecture Notes in Control and Information Sciences, vol. 138, 1989.

[2] McFarlane, D.C., and K. Glover, “A Loop Shaping Design Procedure using Synthesis,” IEEE Transactions on Automatic Control, vol. 37, no. 6, pp. 759– 769, June 1992.

[3] Vinnicombe, G., “Measuring Robustness of Feedback Systems,” PhD dissertation, Department of Engineering, University of Cambridge, 1993.

[4] Zhou, K., and J.C. Doyle, Essentials of Robust Control. NY: Prentice-Hall, 1998.