# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# gapmetric

Compute upper bounds on Vinnicombe `gap` and `nugap` distances between two systems

## Syntax

```[gap,nugap] = gapmetric(p0,p1)
[gap,nugap] = gapmetric(p0,p1,tol)
```

## Description

`[gap,nugap] = gapmetric(p0,p1)` calculates upper bounds on the `gap` and `nugap` (Vinnicombe) metric between systems `p0` and `p1`. The `gap` and `nugap` values lie between 0 and 1. A small value (relative to 1) implies that any controller that stabilizes `p0` will likely stabilize `p1`, and, moreover, that the closed-loop gains of the two closed-loop systems will be similar. A `gap` or `nugap` of 0 implies that `p0` equals `p1`, and a value of 1 implies that the plants are far apart. The input and output dimensions of `p0` and `p1` must be the same.

`[gap,nugap] = gapmetric(p0,p1,tol)` specifies a relative accuracy for calculating the `gap` metric and `nugap` metric. The default value for `tol` is 0.001. The computed answers are guaranteed to satisfy

```gap-tol < gapexact(p0,p1) <= gap ```

## Examples

collapse all

Create two plant models. One plant is unstable, first-order, with transfer function 1/( s -0.001). The other plant is stable and first-order with transfer function 1/( s +0.001).

```p1 = tf(1,[1 -0.001]); p2 = tf(1,[1 0.001]); ```

Despite the fact that one plant is unstable and the other is stable, these plants are close in the `gap` and `nugap` metrics.

```[g,ng] = gapmetric(p1,p2) ```
```g = 0.0029 ng = 0.0020 ```

Intuitively, this result is obvious, because, for instance, the feedback controller `K = 1` stabilizes both plants and renders the closed-loop systems nearly identical.

```K = 1; H1 = loopsens(p1,K); H2 = loopsens(p2,K); subplot(2,2,1); bode(H1.Si,'-',H2.Si,'--'); subplot(2,2,2); bode(H1.Ti,'-',H2.Ti,'--'); subplot(2,2,3); bode(H1.PSi,'-',H2.PSi,'--'); subplot(2,2,4); bode(H1.CSo,'-',H2.CSo,'--'); ```

Next, consider two stable plant models that differ by a first-order system. One plant is the transfer function 50/( s +50) and the other plant is the transfer function 50/( s +50) * 8/( s +8).

```p3 = tf([50],[1 50]); p4 = tf([8],[1 8])*p3; ```

Although the two systems have similar high-frequency dynamics and the same unity gain at low frequency, the plants are modestly far apart in the `gap` and `nugap` metrics.

```[g,ng] = gapmetric(p3,p4) ```
```g = 0.6156 ng = 0.6147 ```

collapse all

### Algorithms

`gap` and `nugap` compute the gap and ν gap metrics between two LTI objects. Both quantities give a numerical value δ(`p0`,`p1`) between 0 and 1 for the distance between a nominal system `p0` (G0) and a perturbed system p1 (G1). The gap metric was introduced into the control literature by Zames and El-Sakkary 1980, and exploited by Georgiou and Smith 1990. The ν gap metric was derived by Vinnicombe 1993. For both of these metrics the following robust performance result holds from Qui and Davidson 1992, and Vinnicombe 1993

arcsin b(G1,K1) ≥ arcsin b(G0,K0) – arcsin δ(G0,G1) – arcsin δ(K0,K1)

where

`$b\left(G,K\right)={‖\left[\begin{array}{c}I\\ K\end{array}\right]{\left(I-GK\right)}^{-1}\left[\begin{array}{cc}G& I\end{array}\right]‖}_{\infty }^{-1}$`

The interpretation of this result is that if a nominal plant G0 is stabilized by controller K0, with "stability margin" b(G0,K0), then the stability margin when G0 is perturbed to G1 and K0 is perturbed to K1 is degraded by no more than the above formula. Note that 1/b(G,K) is also the signal gain from disturbances on the plant input and output to the input and output of the controller. The ν `gap` is always less than or equal to the `gap`, so its predictions using the above robustness result are tighter.

To make use of the gap metrics in robust design, weighting functions need to be introduced. In the above robustness result, G needs to be replaced by W2GW1 and K by ${W}_{1}^{-1}K{W}_{2}^{-1}$(similarly for G0, G1, K0 and K1). This makes the weighting functions compatible with the weighting structure in the H loop shaping control design procedure (see `loopsyn` and `ncfsyn` for more details).

The computation of the gap amounts to solving 2-block H problems (Georgiou, Smith 1988). The particular method used here for solving the H problems is based on Green et al., 1990. The computation of the `nugap` uses the method of Vinnicombe, 1993.

## References

Georgiou, T.T., "On the computation of the gap metric, " Systems Control Letters, Vol. 11, 1988, p. 253-257

Georgiou, T.T., and M. Smith, "Optimal robustness in the gap metric," IEEE Transactions on Automatic Control, Vol. 35, 1990, p. 673-686

Green, M., K. Glover, D. Limebeer, and J.C. Doyle, "A J-spectral factorization approach to H control," SIAM J. of Control and Opt., 28(6), 1990, p. 1350-1371

Qiu, L., and E.J. Davison, "Feedback stability under simultaneous gap metric uncertainties in plant and controller," Systems Control Letters, Vol. 18-1, 1992 p. 9-22

Vinnicombe, G., "Measuring Robustness of Feedback Systems," PhD Dissertation, Department of Engineering, University of Cambridge, 1993.

Zames, G., and El-Sakkary, "Unstable systems and feedback: The gap metric," Proceedings of the Allerton Conference, October 1980, p. 380-385