UP | HOME

# A brief and practical introduction to \(\mathcal{H}_\infty\) Control
Author: Dehaeze Thomas

## Table of Contents

- 1. Introduction to Model Based Control
  - 1.1. Model Based Control - Methodology
  - 1.2. From Classical Control to Robust Control
  - 1.3. Example System
- 2. Classical Open Loop Shaping
  - 2.1. Introduction to Loop Shaping
  - 2.2. Example of Open Loop Shaping
  - 2.3. \(\mathcal{H}_\infty\) Loop Shaping Synthesis
  - 2.4. Example of the \(\mathcal{H}_\infty\) Loop Shaping Synthesis
- 3. First Steps in the \(\mathcal{H}_\infty\) world
  - 3.1. The \(\mathcal{H}_\infty\) Norm
  - 3.2. \(\mathcal{H}_\infty\) Synthesis
  - 3.3. The Generalized Plant
  - 3.4. The \(\mathcal{H}_\infty\) Synthesis applied on the Generalized plant
  - 3.5. From a Classical Feedback Architecture to a Generalized Plant
- 4. Modern Interpretation of the Control Specifications
  - 4.1. Introduction
  - 4.2. Closed Loop Transfer Functions
  - 4.3. Sensitivity Function
  - 4.4. Robustness: Module Margin
  - 4.5. How to Shape transfer function? Using of Weighting Functions!
  - 4.6. Design of Weighting Functions
  - 4.7. Sensitivity Function Shaping - Example
  - 4.8. Complementary Sensitivity Function
  - 4.9. Summary
- 5. \(\mathcal{H}_\infty\) Mixed-Sensitivity Synthesis
  - 5.1. Problem
  - 5.2. Typical Procedure
  - 5.3. Step 1 - Shaping of the Sensitivity Function
  - 5.4. Step 2 - Shaping of
  - 5.5. General Configuration for various shaping
- 6. Conclusion
- 7. Resources

This document is structured as follows:

- As \(\mathcal{H}_\infty\) Control is a model based control technique, a short introduction to model based control is given in Section 1
- Classical open loop shaping method is presented in Section 2. It is also shown that \(\mathcal{H}_\infty\) synthesis can be used for open loop shaping.
- \(\mathcal{H}_\infty\) Important concepts such as the \(\mathcal{H}_\infty\) norm and the generalized plant are introduced.
- A
- Finally, an complete example of the is performed in Section 5.

## 1 Introduction to Model Based Control

### 1.1 Model Based Control - Methodology

The typical methodology when applying Model Based Control to a plant is schematically shown in Figure 1. It consists of three steps:

1. Identification or modeling: \(\Longrightarrow\) mathematical model
2. Translate the specifications into mathematical criteria:
   - Specifications: Response Time, Noise Rejection, Maximum input amplitude, Robustness, …
   - Mathematical Criteria: Cost Function, Shape of TF
3. Synthesis: research of \(K\) that satisfies the specifications for the model of the system

Figure 1: Typical Methodoly for Model Based Control

In this document, we will mainly focus on steps 2 and 3.

Step 2 will be discussed in Section 4. There are two main methods for the controller synthesis (step 3):

- open loop shaping discussed in Section 2
- closed loop shaping discussed in Sections 4 and 5

### 1.2 From Classical Control to Robust Control

Table 1: Table summurazing the main differences between classical, modern and robust control
| Classical Control | Modern Control | Robust Control
--- | --- | --- | ---
Date | 1930- | 1960- | 1980-
Tools | Transfer Functions | State Space formulation | Systems and Signals Norms (\(\mathcal{H}_\infty\), \(\mathcal{H}_2\) Norms)
| Nyquist Plots | Riccati Equations | Closed Loop Transfer Functions
| Bode Plots |  | Open/Closed Loop Shaping
| Phase and Gain margins |  | Weighting Functions
|  |  | Disk margin
Control Architectures | Proportional, Integral, Derivative | Full State Feedback, LQR | General Control Configuration
| Leads, Lags | Kalman Filters, LQG | Generalized Plant
Advantages | Study Stability | Automatic Synthesis | Automatic Synthesis
| Simple | MIMO | MIMO
| Natural | Optimization Problem | Optimization Problem
|  |  | Guaranteed Robustness
|  |  | Easy specification of performances
Disadvantages | Manual Method | No Guaranteed Robustness | Required knowledge of specific tools
| Only SISO | Difficult Rejection of Perturbations | Need a reasonably good model of the system

Figure 2: Comparison of the performance and robustness of classical control methods, modern control methods and robust control methods. The required information on the plant to succesfuly apply each of the control methods are indicated by the colors.

### 1.3 Example System

Let’s consider the model shown in Figure 3. It could represent a suspension system with a payload to position or isolate using an force actuator and an inertial sensor. The notations used are listed in Table 2.

Figure 3: Test System consisting of a payload with a mass \(m\) on top of an active system with a stiffness \(k\), damping \(c\) and an actuator. A feedback controller \(K(s)\) is added to position / isolate the payload.

Table 2: Example system variables
Notation | Description | Value | Unit
--- | --- | --- | ---
\(m\) | Payload’s mass to position / isolate | \(10\) | [kg]
\(k\) | Stiffness of the suspension system | \(10^6\) | [N/m]
\(c\) | Damping coefficient of the suspension system | \(400\) | [N/(m/s)]
\(y\) | Payload absolute displacement (measured by an inertial sensor) |  | [m]
\(d\) | Ground displacement, it acts as a disturbance |  | [m]
\(u\) | Actuator force |  | [N]
\(r\) | Wanted position of the mass (the reference) |  | [m]
\(\epsilon = r - y\) | Position error |  | [m]
\(K\) | Feedback controller | to be designed | [N/m]

Derive the following open-loop transfer functions:

\begin{align} G(s) &= \frac{y}{u} \\ G_d(s) &= \frac{y}{d} \end{align}
Hint

You can follow this generic procedure:

1. List all applied forces ot the mass: Actuator force, Stiffness force (Hooke’s law), …
2. Apply the Newton’s Second Law on the payload \[ m \ddot{y} = \Sigma F \]
3. Transform the differential equations into the Laplace domain: \[ \frac{d\ \cdot}{dt} \Leftrightarrow \cdot \times s \]
4. Write \(y(s)\) as a function of \(u(s)\) and \(w(s)\)

Results
\begin{align} G(s) &= \frac{1}{m s^2 + cs + k} \\ G_d(s) &= \frac{cs + k}{m s^2 + cs + k} \end{align}

Hi Musa, Thank you very much for sharing this awesome package. For a long time, I am dreaming of being abble to export source blocks to HTML tha are surounded by <details> blocks.

For now, I am manually adding #+HTML: <details><summary>Code</summary> and #+HTML: </details> around the source blocks I want to hide… This is a very simple solution, but not so elegent nor practical.

Do you have any idea if it would be easy to extend to org-mode export of source blocks to add such functionallity?

Similarly, I would love to be able to export a <span> block with the name of the file corresponding to the source block. For instance, if a particular source block is tangled to script.sh, it would be so nice to display the filename when exporting!

Thanks in advance

Having obtained \(G(s)\) and \(G_d(s)\), we can transform the system shown in Figure 3 into a classical feedback form as shown in Figure 7.

Figure 4: Block diagram corresponding to the example system

Let’s define the system parameters on Matlab.

    1: k = 1e6; % Stiffness [N/m]
    2: c = 4e2; % Damping [N/(m/s)]
    3: m = 10; % Mass [kg]

And now the system dynamics \(G(s)\) and \(G_d(s)\) (their bode plots are shown in Figures 5 and 6).

    4: G = 1/(m*s^2 + c*s + k); % Plant
    5: Gd = (c*s + k)/(m*s^2 + c*s + k); % Disturbance

Figure 5: Bode plot of the plant \(G(s)\)

Figure 6: Magnitude of the disturbance transfer function \(G_d(s)\)

## 2 Classical Open Loop Shaping

### 2.1 Introduction to Loop Shaping

Loop Shaping refers to a design procedure that involves explicitly shaping the magnitude of the Loop Transfer Function \(L(s)\).

The Loop Gain \(L(s)\) usually refers to as the product of the controller and the plant (“Gain around the loop”, see Figure 7):

\begin{equation} L(s) = G(s) \cdot K(s) \label{eq:loop_gain} \end{equation}

Figure 7: Classical Feedback Architecture

This synthesis method is widely used as many characteristics of the closed-loop system depend on the shape of the open loop gain \(L(s)\) such as:

- Performance: \(L\) large
- Good disturbance rejection: \(L\) large
- Limitation of measurement noise on plant output: \(L\) small
- Small magnitude of input signal: \(K\) and \(L\) small
- Nominal stability: \(L\) small (RHP zeros and time delays)
- Robust stability: \(L\) small (neglected dynamics)

The Open Loop shape is usually done manually has the loop gain \(L(s)\) depends linearly on \(K(s)\) \eqref{eq:loop_gain}.

\(K(s)\) then consists of a combination of leads, lags, notches, etc. such that \(L(s)\) has the wanted shape (an example is shown in Figure 8).

Figure 8: Typical Wanted Shape for the Loop Gain \(L(s)\)

### 2.2 Example of Open Loop Shaping

Let’s take our example system and try to apply the Open-Loop shaping strategy to design a controller that fulfils the following specifications:

- Performance: Bandwidth of approximately 10Hz
- Noise Attenuation: Roll-off of -40dB/decade past 30Hz
- Robustness: Gain margin > 3dB and Phase margin > 30 deg

Using `SISOTOOL`, design a controller that fulfill the specifications.

    sisotool(G)

In order to have the wanted Roll-off, two integrators are used, a lead is also added to have sufficient phase margin.

The obtained controller is shown below, and the bode plot of the Loop Gain is shown in Figure 9.

    K = 14e8 * ... % Gain
        1/(s^2) * ... % Double Integrator
        1/(1 + s/2/pi/40) * ... % Low Pass Filter
        (1 + s/(2*pi*10/sqrt(8)))/(1 + s/(2*pi*10*sqrt(8))); % Lead

Figure 9: Bode Plot of the obtained Loop Gain \(L(s) = G(s) K(s)\)

And we can verify that we have the wanted stability margins:

    [Gm, Pm, ~, Wc] = margin(G*K)

Requirements | Manual Method
--- | ---
Gain Margin \(> 3\) [dB] | 3.1
Phase Margin \(> 30\) [deg] | 35.4
Crossover \(\approx 10\) [Hz] | 10.1

### 2.3 \(\mathcal{H}_\infty\) Loop Shaping Synthesis

The Open Loop Shaping synthesis can be performed using the \(\mathcal{H}_\infty\) Synthesis.

Even though we will not go into details, we will provide one example.

Using Matlab, the \(\mathcal{H}_\infty\) Loop Shaping Synthesis can be performed using the `loopsyn` command:

    K = loopsyn(G, Gd);

where:

- `G` is the (LTI) plant
- `Gd` is the wanted loop shape
- `K` is the synthesize controller

Matlab documentation of `loopsyn` (link).

### 2.4 Example of the \(\mathcal{H}_\infty\) Loop Shaping Synthesis

Let’s reuse the previous plant.

Translate the specification into the wanted shape of the open loop gain.

- Performance: Bandwidth of approximately 10Hz: \(|L_w(j2 \pi 10)| = 1\)
- Noise Attenuation: Roll-off of -40dB/decade past 30Hz
- Robustness: Gain margin > 3dB and Phase margin > 30 deg

    Lw = 2.3e3 * ...
         1/(s^2) * ... % Double Integrator
         (1 + s/(2*pi*10/sqrt(3)))/(1 + s/(2*pi*10*sqrt(3))); % Lead

The \(\mathcal{H}_\infty\) optimal open loop shaping synthesis is performed using the `loopsyn` command:

    [K, ~, GAM] = loopsyn(G, Lw);

The Bode plot of the obtained controller is shown in Figure 10.

It is always important to analyze the controller after the synthesis is performed.

In the end, a synthesize controller is just a combination of low pass filters, high pass filters, notches, leads, etc.

Let’s briefly analyze this controller:

- two integrators are used at low frequency to have the wanted low frequency high gain
- a lead is added centered with the crossover frequency to increase the phase margin
- a notch is added at the resonance of the plant to increase the gain margin (this is very typical of \(\mathcal{H}_\infty\) controllers, and can be an issue, more info on that latter)

Figure 10: Obtained controller \(K\) using the open-loop \(\mathcal{H}_\infty\) shaping

The obtained Loop Gain is shown in Figure 11.

Figure 11: Obtained Open Loop Gain \(L(s) = G(s) K(s)\) and comparison with the wanted Loop gain \(L_w\)

Let’s now compare the obtained stability margins of the \(\mathcal{H}_\infty\) controller and of the manually developed controller in Table 3.

Table 3: Comparison of the characteristics obtained with the two methods
Specifications | Manual Method | \(\mathcal{H}_\infty\) Method
--- | --- | ---
Gain Margin \(> 3\) [dB] | 3.1 | 31.7
Phase Margin \(> 30\) [deg] | 35.4 | 54.7
Crossover \(\approx 10\) [Hz] | 10.1 | 9.9

## 3 First Steps in the \(\mathcal{H}_\infty\) world

### 3.1 The \(\mathcal{H}_\infty\) Norm

The \(\mathcal{H}_\infty\) norm is defined as the peak of the maximum singular value of the frequency response

\begin{equation} \|G(s)\|_\infty = \max_\omega \bar{\sigma}\big( G(j\omega) \big) \end{equation}

For a SISO system \(G(s)\), it is simply the peak value of \(|G(j\omega)|\) as a function of frequency:

\begin{equation} \|G(s)\|_\infty = \max_{\omega} |G(j\omega)| \label{eq:hinf_norm_siso} \end{equation}

Let’s compute the \(\mathcal{H}_\infty\) norm of our test plant \(G(s)\) using the `hinfnorm` function:

    hinfnorm(G)

    7.9216e-06

We can see that the \(\mathcal{H}_\infty\) norm of \(G(s)\) does corresponds to the peak value of \(|G(j\omega)|\) as a function of frequency as shown in Figure 12.

Figure 12: Example of the \(\mathcal{H}_\infty\) norm of a SISO system

### 3.2 \(\mathcal{H}_\infty\) Synthesis

\(\mathcal{H}_\infty\) synthesis is a method that uses an algorithm (LMI optimization, Riccati equation) to find a controller that stabilize the system and that minimizes the \(\mathcal{H}_\infty\) norms of defined transfer functions.

Why optimizing the \(\mathcal{H}_\infty\) norm of transfer functions is a pertinent choice will become clear when we will translate the typical control specifications into the \(\mathcal{H}_\infty\) norm of transfer functions.

Then applying the \(\mathcal{H}_\infty\) synthesis to a plant, the engineer work usually consists of the following steps

1. Write the problem as standard \(\mathcal{H}_\infty\) problem
2. Translate the specifications as \(\mathcal{H}_\infty\) norms of transfer functions
3. Make the synthesis and analyze the obtain controller
4. Reduce the order of the controller for implementation

Note that there are many ways to use the \(\mathcal{H}_\infty\) Synthesis:

- Traditional \(\mathcal{H}_\infty\) Synthesis (`hinfsyn` doc)
- Open Loop Shaping \(\mathcal{H}_\infty\) Synthesis (`loopsyn` doc)
- Mixed Sensitivity Loop Shaping (`mixsyn` doc)
- Fixed-Structure \(\mathcal{H}_\infty\) Synthesis (`hinfstruct` doc)
- Signal Based \(\mathcal{H}_\infty\) Synthesis

### 3.3 The Generalized Plant

The first step when applying the \(\mathcal{H}_\infty\) synthesis is usually to write the problem as a standard \(\mathcal{H}_\infty\) problem. This consist of deriving the Generalized Plant for the current problem. It makes things much easier for the following steps.

The generalized plant, usually noted \(P(s)\), is shown in Figure 13. It has two inputs and two outputs (both could contains many signals). The meaning of the inputs and outputs are summarized in Table 4.

Note that this generalized plant is as its name implies, quite general. It can indeed represent feedback as well as feedforward control architectures.

\begin{equation} \begin{bmatrix} z \\ v \end{bmatrix} = P \begin{bmatrix} w \\ u \end{bmatrix} = \begin{bmatrix} P_{11} & P_{12} \\ P_{21} & P_{22} \end{bmatrix} \begin{bmatrix} w \\ u \end{bmatrix} \end{equation}

Figure 13: Inputs and Outputs of the generalized Plant

Table 4: Notations for the general configuration
Notation | Meaning
--- | ---
\(P\) | Generalized plant model
\(w\) | Exogenous inputs: commands, disturbances, noise
\(z\) | Exogenous outputs: signals to be minimized
\(v\) | Controller inputs: measurements
\(u\) | Control signals

### 3.4 The \(\mathcal{H}_\infty\) Synthesis applied on the Generalized plant

Once the generalized plant is obtained, the \(\mathcal{H}_\infty\) synthesis problem can be stated as follows:

\(\mathcal{H}_\infty\) Synthesis applied on the generalized plant

Find a stabilizing controller \(K\) that, using the sensed output \(v\), generates a control signal \(u\) such that the \(\mathcal{H}_\infty\) norm of the closed-loop transfer function from \(w\) to \(z\) is minimized.

After \(K\) is found, the system is robustified by adjusting the response around the unity gain frequency to increase stability margins.

Figure 14: General Control Configuration

Note that the closed-loop transfer function from \(w\) to \(z\) is:

\begin{equation} \frac{z}{w} = P_{11} + P_{12} K \big( I - P_{22} K \big)^{-1} P_{21} \triangleq F_l(P, K) \end{equation}

Using Matlab, the \(\mathcal{H}_\infty\) Synthesis applied on a Generalized plant can be applied using the `hinfsyn` command (documentation):

    K = hinfsyn(P, nmeas, ncont);

where:

- `P` is the generalized plant transfer function matrix
- `nmeas` is the number of sensed output (size of \(v\))
- `ncont` is the number of control signals (size of \(u\))
- `K` obtained controller that minimized the \(\mathcal{H}_\infty\) norm from \(w\) to \(z\)

### 3.5 From a Classical Feedback Architecture to a Generalized Plant

The procedure to convert a typical control architecture as the one shown in Figure 15 to a generalized Plant is as follows:

1. Define signals (\(w\), \(z\), \(u\) and \(v\)) of the generalized plant
2. Remove \(K\) and rearrange the inputs and outputs to match the generalized configuration

Compute the Generalized plant of corresponding to the tracking control architecture shown in Figure 15

Figure 15: Classical Feedback Control Architecture (Tracking)

Hint

First, define the signals of the generalized plant:

- Exogenous inputs: \(w = r\)
- Signals to be minimized: \(z_1 = \epsilon\), \(z_2 = u\)
- Control signals: \(v = y\)
- Control inputs: \(u\)

Then, Remove \(K\) and rearrange the inputs and outputs.

Answer

The obtained generalized plant shown in Figure 16.

Figure 16: Generalized plant of the Classical Feedback Control Architecture (Tracking)

Using Matlab, the generalized plant can be defined as follows:

    P = [1 -G;
         0  1;
         1 -G]
    P.InputName = {'w', 'u'};
    P.OutputName = {'e', 'u', 'v'};

## 4 Modern Interpretation of the Control Specifications

### 4.1 Introduction

As shown in Section 2, the loop gain \(L(s) = G(s) K(s)\) is a useful and easy tool for the manual design of controllers.

\(L(s)\) is very easy to shape as it depends linearly on \(K(s)\). Moreover, important quantities such as the stability margins and the control bandwidth can be estimated from the shape/phase of \(L(s)\).

However, the loop gain \(L(s)\) does not directly give the performances of the closed-loop system. The closed loop system behavior is indeed determined by the closed-loop transfer functions.

If we consider the feedback system shown in Figure 17, we can link to the following specifications to closed-loop transfer functions. This is summarized in Table 5.

Table 5: Typical Specification and associated closed-loop transfer function
Specification | Closed-Loop Transfer Function
--- | ---
Reference Tracking | From \(r\) to \(\epsilon\)
Disturbance Rejection | From \(d\) to \(y\)
Measurement Noise Filtering | From \(n\) to \(y\)
Small Command Amplitude | From \(n,r,d\) to \(u\)
Stability | All closed-loop transfer function
Robustness (stability margins) | Module margin (see Section 4.4)

Figure 17: Simple Feedback Architecture

### 4.2 Closed Loop Transfer Functions

As the performances of a controlled system depend on the closed loop transfer functions, it is very important to derive these closed-loop transfer functions as a function of the plant \(G(s)\) and controller \(K(s)\).

Write the output signals \([\epsilon, u, y]\) as a function of the systems \(K(s), G(s)\) and of the input signals \([r, d, n]\) as shown in Figure 17.

Hint

Take one of the output (e.g. \(y\)), and write it as a function of the inputs \([d, r, n]\) going step by step around the loop:

\begin{aligned} y &= G u \\ &= G (d + K \epsilon) \\ &= G \big(d + K (r - n - y) \big) \\ &= G d + GK r - GK n - GK y \end{aligned}

Isolate \(y\) at the right hand side, and finally obtain: \[ y = \frac{GK}{1+ GK} r + \frac{G}{1 + GK} d - \frac{GK}{1 + GK} n \]

Do the same procedure for \(u\) and \(\epsilon\)

Anwser

The following equations should be obtained:

\begin{align} y &= \frac{GK}{1 + GK} r + \frac{G}{1 + GK} d - \frac{GK}{1 + GK} n \\ \epsilon &= \frac{1 }{1 + GK} r - \frac{G}{1 + GK} d - \frac{G }{1 + GK} n \\ u &= \frac{K }{1 + GK} r - \frac{1}{1 + GK} d - \frac{K }{1 + GK} n \end{align}

We can see that they are 4 different transfer functions describing the behavior of the system in Figure 17. These called the Gang of Four:

\begin{align} S &= \frac{1 }{1 + GK}, \quad \text{the sensitivity function} \\ T &= \frac{GK}{1 + GK}, \quad \text{the complementary sensitivity function} \\ GS &= \frac{G }{1 + GK}, \quad \text{the load disturbance sensitivity function} \\ KS &= \frac{K }{1 + GK}, \quad \text{the noise sensitivity function} \end{align}

If a feedforward controller is included, a Gang of Six transfer functions can be defined. More on that in this short video.

And we have:

\begin{align} \epsilon &= S r - GS d - GS n \\ y &= T r + GS d - T n \\ u &= KS r - S d - KS n \end{align}

Thus, for reference tracking, we want to shape the closed-loop transfer function from \(r\) to \(\epsilon\), that is the sensitivity function \(S(s)\). Similarly, to reduce the effect of measurement noise \(n\) on the output \(y\), we want to act on the complementary sensitivity function \(T(s)\).

### 4.3 Sensitivity Function

    K1 = 14e8 * ... % Gain
         1/(s^2) * ... % Double Integrator
         (1 + s/(2*pi*10/sqrt(8)))/(1 + s/(2*pi*10*sqrt(8))); % Lead

    K2 = 1e8 * ... % Gain
         1/(s^2) * ... % Double Integrator
         (1 + s/(2*pi*1/sqrt(8)))/(1 + s/(2*pi*1*sqrt(8))); % Lead

    K3 = 1e8 * ... % Gain
         1/(s^2) * ... % Double Integrator
         (1 + s/(2*pi*1/sqrt(2)))/(1 + s/(2*pi*1*sqrt(2))); % Lead

    S1 = 1/(1 + K1*G);
    S2 = 1/(1 + K2*G);
    S3 = 1/(1 + K3*G);

    T1 = K1*G/(1 + K1*G);
    T2 = K2*G/(1 + K2*G);
    T3 = K3*G/(1 + K3*G);

    bodeFig({S1, S2, S3})

    freqs = logspace(-1, 2, 1000);

    figure;
    tiledlayout(1, 2, 'TileSpacing', 'None', 'Padding', 'None');

    ax1 = nexttile;
    hold on;
    plot(freqs, abs(squeeze(freqresp(S1, freqs, 'Hz'))), 'DisplayName', '$L(s)$');
    plot(freqs, abs(squeeze(freqresp(S2, freqs, 'Hz'))), 'DisplayName', '$L_w(s)$');
    plot(freqs, abs(squeeze(freqresp(S3, freqs, 'Hz'))), 'DisplayName', '$L_w(s) / \gamma$, $L_w(s) \cdot \gamma$');
    hold off;
    set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
    xlabel('Frquency [Hz]'); ylabel('Sensitivity Magnitude');
    hold off;

    ax2 = nexttile;
    t = linspace(0, 1, 1000);
    y1 = step(T1, t);
    y2 = step(T2, t);
    y3 = step(T3, t);
    hold on;
    plot(t, y1)
    plot(t, y2)
    plot(t, y3)
    hold off
    xlabel('Time [s]'); ylabel('Step Response');

### 4.4 Robustness: Module Margin

Let’s start by an example demonstrating why the phase and gain margins might not be good indicators of robustness.

Let’s consider the following plant \(G_t(s)\):

    w0 = 2*pi*100;
    xi = 0.1;
    k = 1e7;

    Gt = 1/k*(s/w0/4 + 1)/(s^2/w0^2 + 2*xi*s/w0 + 1);

Let’s say we have designed a controller \(K_t(s)\) that gives the loop gain shown in Figure 18.

    Kt = 1.2e6*(s + w0)/s;

The following characteristics can be determined from Figure 18:

- bandwidth of \(\approx 10\, \text{Hz}\)
- infinite gain margin (the phase of the loop-gain never reaches -180 degrees
- more than 90 degrees of phase margin

This might indicate very good robustness properties of the closed-loop system.

Figure 18: Bode plot of the obtained Loop Gain \(L(s)\)

Now let’s suppose the “real” plant \(G_r(s)\) as a slightly lower damping factor:

    xi = 0.03;
    Gr = 1/k*(s/w0/4 + 1)/(s^2/w0^2 + 2*xi*s/w0 + 1);

The obtained “real” loop gain is shown in Figure 19. At a frequency little bit above 100Hz, the phase of the loop gain reaches -180 degrees while its magnitude is more than one which indicated instability.

It is confirmed by checking the stability of the closed loop system:

    isstable(feedback(Gp,K))

    0

Figure 19: Bode plots of \(L(s)\) (loop gain corresponding the nominal plant) and \(L_r(s)\) (loop gain corresponding to the real plant)

Therefore, even a small change of the plant parameter makes the system unstable even though both the gain margin and the phase margin for the nominal plant are excellent.

This is due to the fact that the gain and phase margin are robustness indicators for a pure change or gain or a pure change of phase but not a combination of both.

Let’s now determine a new robustness indicator based on the Nyquist Stability Criteria.

Nyquist Stability Criteria (for stable systems)
  If the open-loop transfer function \(L(s)\) is stable, then the closed-loop system is unstable for any encirclement of the point \(−1\) on the Nyquist plot.
Nyquist Plot
  The Nyquist plot shows the evolution of \(L(j\omega)\) in the complex plane from \(\omega = 0 \to \infty\).

For more information about the general Nyquist Stability Criteria, you may want to look at this video.

From the Nyquist stability criteria, it is clear that we want \(L(j\omega)\) to be as far away from the \(-1\) point (called the unstable point) in the complex plane. From this, we define the module margin.

Module Margin
  The Module Margin \(\Delta M\) is defined as the minimum distance between the point \(-1\) and the loop gain \(L(j\omega)\) in the complex plane.

A typical Nyquist plot is shown in Figure 20. The gain, phase and module margins are graphically shown to have an idea of what they represent.

As expected from Figure 20, there is a close relationship between the module margin and the gain and phase margins. We can indeed show that for a given value of the module margin \(\Delta M\), we have:

\begin{equation} \Delta G \ge \frac{\Delta M}{\Delta M - 1}; \quad \Delta \phi \ge \frac{1}{\Delta M} \end{equation}

Figure 20: Nyquist plot with visual indication of the Gain margin \(\Delta G\), Phase margin \(\Delta \phi\) and Module margin \(\Delta M\)

Let’s now try to express the Module margin \(\Delta M\) as an \(\mathcal{H}_\infty\) norm of a closed-loop transfer function:

\begin{align*} \Delta M &= \text{minimum distance between } L(j\omega) \text{ and point } (-1) \\ &= \min_\omega |L(j\omega) - (-1)| \\ &= \min_\omega |1 + L(j\omega)| \\ &= \frac{1}{\max_\omega \frac{1}{|1 + L(j\omega)|}} \\ &= \frac{1}{\|S\|_\infty} \end{align*}

The \(\mathcal{H}_\infty\) norm of the sensitivity function \(\|S\|_\infty\) is a measure of the Module margin \(\Delta M\) and therefore an indicator of the system robustness.

\begin{equation} \Delta M = \frac{1}{\|S\|_\infty} \label{eq:module_margin_S} \end{equation}

The wanted robustness of the closed-loop system can be specified by setting a maximum value on \(\|S\|_\infty\).

Note that this is why large peak value of \(|S(j\omega)|\) usually indicate robustness problems.

Typical, we require \(\|S\|_\infty < 2 (6dB)\) which implies \(\Delta G \ge 2\) and \(\Delta \phi \ge 29^o\)

To learn more about module/disk margin, you can check out this video.

### 4.5 How to Shape transfer function? Using of Weighting Functions!

- `[ ]` Maybe put this section in Previous chapter

Let’s say we want to shape the sensitivity transfer function corresponding to the transfer function from \(r\) to \(\epsilon\) of the control architecture shown in Figure 21.

Figure 21: Generalized Plant

If the \(\mathcal{H}_\infty\) synthesis is directly applied on the generalized plant \(P(s)\) shown in Figure 21, if will minimize the \(\mathcal{H}_\infty\) norm of transfer function from \(r\) to \(\epsilon\) (the sensitivity transfer function).

However, as the \(\mathcal{H}_\infty\) norm is the maximum peak value of the transfer function’s magnitude, it does not allow to shape the norm over all frequencies.

A trick is to include a weighting function in the generalized plant as shown in Figure 22. Applying the \(\mathcal{H}_\infty\) synthesis to the weighted generalized plant \(\tilde{P}(s)\) (Figure 22) will generate a controller \(K(s)\) that minimizes the \(\mathcal{H}_\infty\) norm between \(r\) and \(\tilde{\epsilon}\):

\begin{align} & \left\| \frac{\tilde{\epsilon}}{r} \right\|_\infty < \gamma (=1)\nonumber \\ \Leftrightarrow & \left\| W_s(s) S(s) \right\|_\infty < 1\nonumber \\ \Leftrightarrow & \left| W_s(j\omega) S(j\omega) \right| < 1 \quad \forall \omega\nonumber \\ \Leftrightarrow & \left| S(j\omega) \right| < \frac{1}{\left| W_s(j\omega) \right|} \quad \forall \omega \label{eq:sensitivity_shaping} \end{align}

As shown in Equation \eqref{eq:sensitivity_shaping}, the \(\mathcal{H}_\infty\) synthesis allows to shape the magnitude of the sensitivity transfer function. Therefore, the choice of the weighting function \(W_s(s)\) is very important. Its inverse magnitude will define the frequency dependent upper bound of the sensitivity transfer function magnitude.

Figure 22: Weighted Generalized Plant

Once the weighting function is designed, it should be added to the generalized plant as shown in Figure 22.

The weighted generalized plant can be defined in Matlab by either re-defining all the inputs or by pre-multiplying the (non-weighted) generalized plant by a block-diagonal MIMO transfer function containing the weights for the outputs \(z\) and `1` for the outputs \(v\).

    Pw = [Ws -Ws*G;
          1  -G]

    % Alternative
    Pw = blkdiag(Ws, 1)*P;

### 4.6 Design of Weighting Functions

Weighting function used must be proper, stable and minimum phase transfer functions.

proper
  more poles than zeros, this implies \(\lim_{\omega \to \infty} |W(j\omega)| < \infty\)
stable
  no poles in the right half plane
minimum phase
  no zeros in the right half plane

Matlab is providing the `makeweight` function that creates a first-order weights by specifying the low frequency gain, high frequency gain, and a gain at a specific frequency:

    W = makeweight(dcgain,[freq,mag],hfgain)

with:

- `dcgain`
- `freq`
- `mag`
- `hfgain`

The Matlab code below produces a weighting function with a magnitude shape shown in Figure 23.

    Ws = makeweight(1e2, [2*pi*10, 1], 1/2);

Figure 23: Obtained Magnitude of the Weighting Function

Quite often, higher orders weights are required.

In such case, the following formula can be used the design of these weights:

\begin{equation} W(s) = \left( \frac{ \frac{1}{\omega_0} \sqrt{\frac{1 - \left(\frac{G_0}{G_c}\right)^{\frac{2}{n}}}{1 - \left(\frac{G_c}{G_\infty}\right)^{\frac{2}{n}}}} s + \left(\frac{G_0}{G_c}\right)^{\frac{1}{n}} }{ \left(\frac{1}{G_\infty}\right)^{\frac{1}{n}} \frac{1}{\omega_0} \sqrt{\frac{1 - \left(\frac{G_0}{G_c}\right)^{\frac{2}{n}}}{1 - \left(\frac{G_c}{G_\infty}\right)^{\frac{2}{n}}}} s + \left(\frac{1}{G_c}\right)^{\frac{1}{n}} }\right)^n \label{eq:weight_formula_advanced} \end{equation}

The parameters permit to specify:

- the low frequency gain: \(G_0 = lim_{\omega \to 0} |W(j\omega)|\)
- the high frequency gain: \(G_\infty = lim_{\omega \to \infty} |W(j\omega)|\)
- the absolute gain at \(\omega_0\): \(G_c = |W(j\omega_0)|\)
- the absolute slope between high and low frequency: \(n\)

A Matlab function implementing Equation \eqref{eq:weight_formula_advanced} is shown below:

Listing 1: Matlab Function that can be used to generate Weighting functions

    function [W] = generateWeight(args)
        arguments
            args.G0 (1,1) double {mustBeNumeric, mustBePositive} = 0.1
            args.G1 (1,1) double {mustBeNumeric, mustBePositive} = 10
            args.Gc (1,1) double {mustBeNumeric, mustBePositive} = 1
            args.wc (1,1) double {mustBeNumeric, mustBePositive} = 2*pi
            args.n  (1,1) double {mustBeInteger, mustBePositive} = 1
        end

        if (args.Gc <= args.G0 && args.Gc <= args.G1) || (args.Gc >= args.G0 && args.Gc >= args.G1)
            eid = 'value:range';
            msg = 'Gc must be between G0 and G1';
            throwAsCaller(MException(eid,msg))
        end

        s = zpk('s');

        W = (((1/args.wc)*sqrt((1-(args.G0/args.Gc)^(2/args.n))/(1-(args.Gc/args.G1)^(2/args.n)))*s + (args.G0/args.Gc)^(1/args.n))/((1/args.G1)^(1/args.n)*(1/args.wc)*sqrt((1-(args.G0/args.Gc)^(2/args.n))/(1-(args.Gc/args.G1)^(2/args.n)))*s + (1/args.Gc)^(1/args.n)))^args.n;

    end

Let’s use this function to generate three weights with the same high and low frequency gains, but but different slopes.

    W1 = generateWeight('G0', 1e2, 'G1', 1/2, 'Gc', 1, 'wc', 2*pi*10, 'n', 1);
    W2 = generateWeight('G0', 1e2, 'G1', 1/2, 'Gc', 1, 'wc', 2*pi*10, 'n', 2);
    W3 = generateWeight('G0', 1e2, 'G1', 1/2, 'Gc', 1, 'wc', 2*pi*10, 'n', 3);

The obtained shapes are shown in Figure 24.

Figure 24: Higher order weights using Equation \eqref{eq:weight_formula_advanced}

### 4.7 Sensitivity Function Shaping - Example

Figure 25: Typical wanted shape of the Sensitivity transfer function

- Robustness: Module margin > 2 (\(\Rightarrow \text{GM} > 2 \text{ and } \text{PM} > 29^o\))
- Bandwidth:
- Slope of -2

First, the weighting functions is generated.

    Ws = generateWeight('G0', 1e3, 'G1', 1/2, 'Gc', 1, 'wc', 2*pi*10, 'n', 2);

It is then added to the generalized plant.

    Pw = blkdiag(Ws, 1)*P;

And the \(\mathcal{H}_\infty\) synthesis is performed.

    K = hinfsyn(Pw, 1, 1, 'Display', 'on');

    K = hinfsyn(Pw, 1, 1, 'Display', 'on');

      Test bounds:  0.5 <=  gamma  <=  0.51

       gamma        X>=0        Y>=0       rho(XY)<1    p/f
      5.05e-01     0.0e+00     0.0e+00     4.497e-28     p
      Limiting gains...
      5.05e-01     0.0e+00     0.0e+00     0.000e+00     p
      5.05e-01    -1.8e+01 #  -2.9e-15     1.514e-15     f

      Best performance (actual): 0.504

The obtained \(\gamma \approx 0.5\) means that it found a controller \(K(s)\) that stabilize the closed-loop system, and such that:

\begin{aligned} & \| W_s(s) S(s) \|_\infty < 0.5 \\ & \Leftrightarrow |S(j\omega)| < \frac{0.5}{|W_s(j\omega)|} \quad \forall \omega \end{aligned}

This is indeed what we can see by comparing \(|S|\) and \(|W_S|\) in Figure 26.

Figure 26: Weighting function and obtained closed-loop sensitivity

### 4.8 Complementary Sensitivity Function

### 4.9 Summary

Table 6: Table caption
| Open-Loop Shaping | Closed-Loop Shaping
--- | --- | ---
Reference Tracking | \(L\) large | \(S\) small
Disturbance Rejection | \(L\) large | \(GS\) small
Measurement Noise Filtering | \(L\) small | \(T\) small
Small Command Amplitude | \(K\) and \(L\) small | \(KS\) small
Robustness | Phase/Gain margins | Module margin: \(\Vert S\Vert_\infty\) small

Figure 27: Shaping the Gang of Four: Limitations

## 5 \(\mathcal{H}_\infty\) Mixed-Sensitivity Synthesis

### 5.1 Problem

### 5.2 Typical Procedure

### 5.3 Step 1 - Shaping of the Sensitivity Function

### 5.4 Step 2 - Shaping of

### 5.5 General Configuration for various shaping

Shaping of S and KS

Figure 28: Generalized Plant to shape \(S\) and \(KS\)

Listing 2: General Plant definition corresponding to Figure 28

    P = [W1 -G*W1
         0   W2
         1  -G];

- \(W_1(s)\) is used to shape \(S\)
- \(W_2(s)\) is used to shape \(KS\)

Shaping of S and T

Figure 29: Generalized Plant to shape \(S\) and \(T\)

Listing 3: General Plant definition corresponding to Figure 29

    P = [W1 -G*W1
         0   G*W2
         1   -G];

- \(W_1\) is used to shape \(S\)
- \(W_2\) is used to shape \(T\)

Shaping of S, T and KS

Figure 30: Generalized Plant to shape \(S\), \(T\) and \(KS\)

Listing 4: General Plant definition corresponding to Figure 30

    P = [W1 -G*W1
         0   W2
         0   G*W3
         1   -G];

- \(W_1\) is used to shape \(S\)
- \(W_2\) is used to shape \(KS\)
- \(W_3\) is used to shape \(T\)

Shaping of S, T, KS and GS

Figure 31: Generalized Plant to shape \(S\), \(T\), \(KS\) and \(GS\)

Listing 5: General Plant definition corresponding to Figure 31

    P = [ W1  -W1*G*W3 -G*W1
          0    0        W2
          1   -G*W3    -G];

- \(W_1\) is used to shape \(S\)
- \(W_2\) is used to shape \(KS\)
- \(W_1W_3\) is used to shape \(GS\)
- \(W_2W_3\) is used to shape \(T\)

## 6 Conclusion

## 7 Resources

Author: Dehaeze Thomas

Created: 2020-12-01 mar. 10:54