Chapter 19: Lead, Lag, and Lead–Lag Compensation

Lesson 3: Bode-Based Design of Lead Compensators

This lesson presents a systematic Bode-plot-based procedure for designing phase-lead compensators to meet frequency-domain specifications such as phase margin, gain margin, and bandwidth. We derive the phase contribution of a lead compensator, show how to compute its design parameters from desired phase margin and crossover frequency, and implement the procedure in Python, C++, Java, MATLAB/Simulink, and Wolfram Mathematica, with a focus on servo/robotic joint control applications.

1. Role of Lead Compensation in Bode-Based Design

In frequency-domain (Bode) design, we shape the open-loop transfer function \( L(s) = C(s)G(s) \), where \( G(s) \) is the plant and \( C(s) \) is the controller, so that the closed-loop system has acceptable stability and performance. A lead compensator adds positive phase around the desired crossover frequency, improving phase margin and transient response while modestly increasing bandwidth.

A standard lead compensator has transfer function

\[ C_{\text{lead}}(s) = K_c \frac{\tau s + 1}{\alpha \tau s + 1}, \quad 0 < \alpha < 1, \]

where \( K_c \) is a gain, \( \tau > 0 \) is a time constant, and \( \alpha \) controls the separation between the compensator zero at \( s = -1/\tau \) and pole at \( s = -1/(\alpha \tau) \). In Bode plots, this pair produces a magnitude boost and a bell-shaped phase lead.

For robotic servo systems (e.g., a single joint actuated by a DC motor), the uncompensated plant often exhibits low phase margin and sluggish response. A lead compensator can:

  • Increase phase margin to reduce overshoot and oscillations.
  • Shift crossover frequency to increase closed-loop bandwidth (faster tracking).
  • Improve robustness to moderate modeling uncertainty.

2. Frequency Response of the Lead Compensator

For the lead compensator \( C_{\text{lead}}(s) = K_c \dfrac{\tau s + 1}{\alpha \tau s + 1} \), its frequency response at \( s = j\omega \) is

\[ C_{\text{lead}}(j\omega) = K_c \frac{1 + j\omega \tau}{1 + j\omega \alpha \tau}. \]

The magnitude and phase are

\[ |C_{\text{lead}}(j\omega)| = K_c \frac{\sqrt{1 + (\omega \tau)^2}} {\sqrt{1 + (\omega \alpha \tau)^2}}, \quad \angle C_{\text{lead}}(j\omega) = \tan^{-1}(\omega \tau) - \tan^{-1}(\omega \alpha \tau). \]

The phase is positive for a band of frequencies \( \omega \) between the zero and pole break frequencies \( \omega_z = 1/\tau \) and \( \omega_p = 1/(\alpha \tau) \). The maximum phase lead \( \phi_{\max} \) occurs at some \( \omega_m \) between \( \omega_z \) and \( \omega_p \). We now derive closed-form formulas for \( \phi_{\max} \) and \( \omega_m \).

3. Derivation of Maximum Phase Lead and Peak Frequency

Define \( x = \omega \tau \). The phase of the lead compensator is

\[ \phi(x) = \tan^{-1}(x) - \tan^{-1}(\alpha x). \]

To find the maximum, differentiate with respect to \( x \) and set to zero:

\[ \frac{d\phi}{dx} = \frac{1}{1 + x^2} - \frac{\alpha}{1 + \alpha^2 x^2} = 0. \]

Solving \( \dfrac{1}{1 + x^2} = \dfrac{\alpha}{1 + \alpha^2 x^2} \) gives

\[ 1 + \alpha^2 x^2 = \alpha(1 + x^2) \;\Rightarrow\; 1 + \alpha^2 x^2 = \alpha + \alpha x^2. \]

Rearranging terms:

\[ (\alpha^2 - \alpha)x^2 = \alpha - 1 \;\Rightarrow\; x^2 = \frac{\alpha - 1}{\alpha(\alpha - 1)} = \frac{1}{\alpha}. \]

Since \( \alpha \in (0,1) \), we have \( x = 1/\sqrt{\alpha} \). Therefore, the frequency at which the lead compensator gives maximum phase is

\[ \omega_m = \frac{1}{\tau \sqrt{\alpha}}. \]

Substituting \( x = 1/\sqrt{\alpha} \) into \( \phi(x) \) yields the maximum phase lead:

\[ \phi_{\max} = \tan^{-1}\!\left(\frac{1}{\sqrt{\alpha}}\right) - \tan^{-1}\!\left(\sqrt{\alpha}\right). \]

With some trigonometric manipulation one can show the equivalent compact formula

\[ \phi_{\max} = \sin^{-1} \left(\frac{1 - \alpha}{1 + \alpha}\right), \quad 0 < \alpha < 1. \]

This pair of formulas, \( \phi_{\max} \) and \( \omega_m \), is the foundation for Bode-based lead design: we choose \( \alpha \) to obtain the required phase boost, then select \( \tau \) so that the maximum phase occurs near the desired crossover frequency.

4. From Phase Margin Specification to Lead Parameters

Suppose we have a unity-feedback loop with uncompensated open-loop \( L_0(s) = K_0 G(s) \) and we want to design a lead compensator such that the compensated open loop \( L(s) = C_{\text{lead}}(s) G(s) \) meets:

  • Desired phase margin \( \text{PM}_d \),
  • Desired crossover (bandwidth) frequency \( \omega_c \) (approximate),
  • Reasonable gain margin.

Let \( \angle L_0(j\omega_c) \) denote the uncompensated phase at \( \omega_c \), and suppose that adjusting the static gain alone would yield magnitude 0 dB at \( \omega_c \). The uncompensated phase margin at \( \omega_c \) is

\[ \text{PM}_0(\omega_c) = 180^\circ + \angle L_0(j\omega_c). \]

The additional phase required from the lead compensator is approximately

\[ \phi_{\text{req}} = \text{PM}_d - \text{PM}_0(\omega_c) + \Delta\phi_{\text{safety}}, \]

where \( \Delta\phi_{\text{safety}} \) is a small design margin (e.g., 5–10 degrees) to account for model uncertainties and the fact that the maximum phase contribution may not occur exactly at \( \omega_c \).

We then choose \( \phi_{\max} \approx \phi_{\text{req}} \) and solve for \( \alpha \) using

\[ \sin(\phi_{\max}) = \frac{1 - \alpha}{1 + \alpha} \;\Rightarrow\; \alpha = \frac{1 - \sin(\phi_{\max})}{1 + \sin(\phi_{\max})}. \]

Finally, we select \( \tau \) such that \( \omega_m \) (where the lead phase is maximal) is near the desired crossover:

\[ \omega_m = \frac{1}{\tau \sqrt{\alpha}} \approx \omega_c \;\Rightarrow\; \tau \approx \frac{1}{\omega_c \sqrt{\alpha}}. \]

Once \( \alpha \) and \( \tau \) are fixed, we choose \( K_c \) so that the magnitude of the compensated loop equals 1 at \( \omega_c \):

\[ |K_c C_0(j\omega_c) G(j\omega_c)| = 1, \]

where \( C_0(s) = \dfrac{\tau s + 1}{\alpha \tau s + 1} \).

flowchart TD
  A["Start with plant G(s) and initial gain"] --> B["Specify PM_d and desired omega_c"]
  B --> C["Compute uncompensated PM_0(omega_c) from Bode of L_0(s)"]
  C --> D["Compute phi_req = PM_d - PM_0 + safety margin"]
  D --> E["Set phi_max approx phi_req"]
  E --> F["Solve alpha = (1 - sin(phi_max))/(1 + sin(phi_max))"]
  F --> G["Choose tau so that omega_m = 1/(tau*sqrt(alpha)) approx omega_c"]
  G --> H["Form C_lead(s) = K_c (tau s + 1)/(alpha tau s + 1)"]
  H --> I["Tune K_c so |L(j omega_c)| = 1"]
  I --> J["Verify margins and bandwidth; iterate if needed"]
        

5. Worked Example: Lead Design for a Second-Order Plant

Consider the plant

\[ G(s) = \frac{1}{s(s+1)}. \]

This could approximate a lightly damped robotic joint after position feedback linearization, where one pole at the origin models the integrator from torque to position, and the pole at \( s=-1 \) aggregates actuator and load dynamics. We want:

  • Desired phase margin \( \text{PM}_d = 50^\circ \),
  • Desired crossover frequency \( \omega_c \approx 4 \ \text{rad/s} \).

First compute the phase of \( G(j\omega) \) at \( \omega_c = 4 \):

\[ G(j\omega) = \frac{1}{j\omega(j\omega + 1)}, \quad \angle G(j\omega) = -90^\circ - \tan^{-1}\!\left(\frac{\omega}{1}\right). \]

At \( \omega = 4 \), \( \tan^{-1}(4) \approx 76^\circ \), hence

\[ \angle G(j4) \approx -90^\circ - 76^\circ = -166^\circ. \]

If we adjusted only the gain to get 0 dB at \( \omega_c \), the phase margin would be

\[ \text{PM}_0(4) = 180^\circ + \angle G(j4) \approx 180^\circ - 166^\circ = 14^\circ. \]

We need an additional \( \phi_{\text{req}} \approx 50^\circ - 14^\circ + 5^\circ = 41^\circ \) (adding a 5-degree safety margin). Choose \( \phi_{\max} \approx 45^\circ \).

Then

\[ \alpha = \frac{1 - \sin(45^\circ)}{1 + \sin(45^\circ)} = \frac{1 - \tfrac{\sqrt{2}}{2}}{1 + \tfrac{\sqrt{2}}{2}} \approx 0.17. \]

Choose \( \omega_m = \omega_c = 4 \ \text{rad/s} \); then

\[ \tau = \frac{1}{\omega_m\sqrt{\alpha}} \approx \frac{1}{4\sqrt{0.17}} \approx 0.60 \ \text{s}. \]

Hence the zero and pole of the lead are at

\[ s_z = -\frac{1}{\tau} \approx -1.66, \quad s_p = -\frac{1}{\alpha \tau} \approx -9.65. \]

The compensator without final gain is

\[ C_0(s) = \frac{0.60s + 1}{0.10s + 1}. \]

Now choose \( K_c \) so that \( |K_c C_0(j4) G(j4)| = 1 \). At \( \omega = 4 \),

\[ |G(j4)| = \frac{1}{4\sqrt{4^2 + 1}} = \frac{1}{4\sqrt{17}} \approx 0.0606, \]

\[ |C_0(j4)| = \frac{\sqrt{1 + (4 \cdot 0.60)^2}}{\sqrt{1 + (4 \cdot 0.10)^2}} \approx \frac{\sqrt{1 + 2.4^2}}{\sqrt{1 + 0.4^2}} \approx 2.41. \]

So the magnitude of the product is \( |C_0(j4) G(j4)| \approx 2.41 \cdot 0.0606 \approx 0.146 \), and we require \( K_c \approx 1/0.146 \approx 6.8 \). The final compensator is

\[ C_{\text{lead}}(s) = 6.8 \frac{0.60s + 1}{0.10s + 1}. \]

At \( \omega = \omega_m \), the compensator contributes roughly \( \phi_{\max} \approx 45^\circ \), so the new phase at crossover is approximately \( -166^\circ + 45^\circ = -121^\circ \), yielding phase margin \( \text{PM} \approx 180^\circ - 121^\circ = 59^\circ \), close to the design target. A Bode plot of the compensated loop confirms improved phase margin and higher bandwidth.

6. Implementation Considerations in Robotic Servo Control

In robot joint control, the continuous-time lead compensator is typically embedded in a digital controller. Although discrete-time design is treated later, even at this stage we must be aware of:

  • Physical limits: Actuators and sensors impose bounds on high-frequency gain; the lead compensator should not excessively amplify sensor noise.
  • Interaction with inner loops: Many industrial robot drives have an inner current loop; the lead is often designed for the outer position loop using a reduced-order plant model.
  • Sampling and delay: Digital implementation introduces delay, reducing effective phase margin; therefore, we often design a slightly larger \( \phi_{\max} \) than strictly required.
flowchart TD
  P["Identify continuous-time plant G(s) of joint"] --> B["Choose PM_d and omega_c from tracking specs"]
  B --> LD["Design lead C_lead(s) from Bode"]
  LD --> DIG["Discretize controller (later chapter)"]
  DIG --> IMPL["Implement in robot control stack"]
  IMPL --> TEST["Closed-loop tests: step, disturbance"]
  TEST --> REFINE["Refine PM_d, omega_c, lead parameters if needed"]
        

7. Python Implementation — Bode-Based Lead Design

We now implement a helper function in Python to design a lead compensator using the formulas above. We rely on python-control for transfer functions and Bode plots, and note how this can be integrated with a simple robotic joint model.


import numpy as np
import control as ctl  # python-control library

def design_lead_bode(G, PM_des_deg, wc_des, safety_deg=5.0):
    """
    Bode-based design of a phase-lead compensator for SISO plant G(s).

    Parameters
    ----------
    G : control.TransferFunction
        Plant transfer function.
    PM_des_deg : float
        Desired phase margin in degrees.
    wc_des : float
        Desired crossover frequency (rad/s).
    safety_deg : float
        Extra phase margin to compensate for modeling errors.

    Returns
    -------
    C_lead : control.TransferFunction
        Lead compensator C(s) = Kc (tau s + 1)/(alpha tau s + 1).
    info : dict
        Dictionary with alpha, tau, Kc, and achieved PM.
    """
    # Evaluate plant at desired crossover
    mag, phase, w = ctl.bode(G, [wc_des], Plot=False)
    mag = mag[0]
    phase_deg = phase[0] * 180.0 / np.pi

    PM0 = 180.0 + phase_deg
    phi_req = PM_des_deg - PM0 + safety_deg

    # Clamp phi_req to a reasonable range
    phi_req = np.clip(phi_req, 5.0, 60.0)
    phi_max = np.deg2rad(phi_req)

    # Compute alpha from phi_max:
    # sin(phi_max) = (1 - alpha)/(1 + alpha)
    s = np.sin(phi_max)
    alpha = (1.0 - s) / (1.0 + s)

    # tau from omega_m = 1/(tau * sqrt(alpha)) approx wc_des
    tau = 1.0 / (wc_des * np.sqrt(alpha))

    # Lead compensator without final gain
    num_lead = [tau, 1.0]
    den_lead = [alpha * tau, 1.0]
    C0 = ctl.TransferFunction(num_lead, den_lead)

    # Determine Kc so that |Kc C0(j wc_des) G(j wc_des)| = 1
    mag_C0G, _, _ = ctl.bode(C0 * G, [wc_des], Plot=False)
    mag_C0G = mag_C0G[0]
    Kc = 1.0 / mag_C0G

    C_lead = Kc * C0

    # Evaluate margins
    GM, PM, wcg, wcp = ctl.margin(C_lead * G)

    info = dict(alpha=alpha, tau=tau, Kc=Kc,
                PM_ach_deg=PM,
                wc_ach=wcp)
    return C_lead, info

# Example: G(s) = 1/(s(s+1))
s = ctl.TransferFunction.s
G = 1 / (s * (s + 1))

C_lead, info = design_lead_bode(G, PM_des_deg=50.0, wc_des=4.0)
L = C_lead * G

print("Lead parameters:")
for k, v in info.items():
    print(f"{k}: {v}")

# For a robotic joint, G could be identified from experiments and then used similarly.
# Example: run bode plot and step response
ctl.bode(L)
ctl.step_response(ctl.feedback(L, 1))
      

In a robotics context, G can be obtained by system identification of a single joint, and design_lead_bode produces a compensator that can be implemented in the robot's control loop (after discretization).

8. C++ Implementation — Lead Parameter Computation for Embedded Control

In embedded robotic controllers (often C++/ROS-based), one typically precomputes the lead compensator parameters offline and implements the controller as a simple filter. Below is a minimal C++ function that, given the required maximum phase \( \phi_{\max} \) and desired crossover, computes \( \alpha \), \( \tau \), and the continuous-time lead transfer function parameters. Integration with ros_control or Orocos is then straightforward.


#include <cmath>
#include <iostream>

struct LeadParams {
    double alpha;
    double tau;
    double Kc;
};

LeadParams designLeadParameters(double phiMaxDeg,
                                double wcDes,
                                double magC0G_at_wc) {
    // phi_max in radians
    double phiMax = phiMaxDeg * M_PI / 180.0;
    double s = std::sin(phiMax);

    // alpha = (1 - sin(phi_max))/(1 + sin(phi_max))
    double alpha = (1.0 - s) / (1.0 + s);

    // tau = 1/(wc * sqrt(alpha))
    double tau = 1.0 / (wcDes * std::sqrt(alpha));

    // Kc to enforce |Kc C0(j wc) G(j wc)| = 1
    // Input argument magC0G_at_wc is |C0(j wc) G(j wc)|
    double Kc = 1.0 / magC0G_at_wc;

    return {alpha, tau, Kc};
}

// Example usage in a robotics-oriented controller
int main() {
    double phiMaxDeg = 45.0;
    double wcDes = 4.0;
    // Suppose we have computed |C0(j wc) G(j wc)| via offline analysis:
    double magC0G_at_wc = 0.146; // Example from worked example

    LeadParams p = designLeadParameters(phiMaxDeg, wcDes, magC0G_at_wc);

    std::cout << "alpha = " << p.alpha << "\n";
    std::cout << "tau   = " << p.tau   << "\n";
    std::cout << "Kc    = " << p.Kc    << "\n";

    // In a real robot joint controller, you would implement
    // u(s)/e(s) = Kc (tau s + 1)/(alpha tau s + 1)
    // via a discretized difference equation in your control loop.
    return 0;
}
      

The continuous-time lead filter can then be discretized with a suitable method (e.g., Tustin) and used as a pre-filter inside a ROS controller for each joint.

9. Java Implementation — Lead Design Utility

Java is less common in low-level robot control, but is widely used in high-level robotics frameworks and simulation. Below is a small Java class computing lead parameters. Libraries such as EJML can be used for matrix operations when modeling multi-DOF manipulators.


public class LeadDesigner {

    public static class LeadParams {
        public double alpha;
        public double tau;
        public double Kc;
        public LeadParams(double alpha, double tau, double Kc) {
            this.alpha = alpha;
            this.tau = tau;
            this.Kc = Kc;
        }
    }

    public static LeadParams designLead(double phiMaxDeg,
                                        double wcDes,
                                        double magC0G_at_wc) {
        double phiMax = Math.toRadians(phiMaxDeg);
        double s = Math.sin(phiMax);
        double alpha = (1.0 - s) / (1.0 + s);
        double tau = 1.0 / (wcDes * Math.sqrt(alpha));
        double Kc = 1.0 / magC0G_at_wc;
        return new LeadParams(alpha, tau, Kc);
    }

    public static void main(String[] args) {
        double phiMaxDeg = 45.0;
        double wcDes = 4.0;
        double magC0G_at_wc = 0.146; // from offline analysis

        LeadParams p = designLead(phiMaxDeg, wcDes, magC0G_at_wc);
        System.out.println("alpha = " + p.alpha);
        System.out.println("tau   = " + p.tau);
        System.out.println("Kc    = " + p.Kc);

        // The resulting C(s) can be discretized and implemented
        // in a Java-based control loop or simulation environment.
    }
}
      

When simulating robotic systems, this Java-based lead design can be integrated with numerical ODE solvers to test joint trajectories and disturbance rejection.

10. MATLAB/Simulink and Wolfram Mathematica Implementations

10.1 MATLAB/Simulink

MATLAB offers direct support for Bode design via the Control System Toolbox. The following script designs a lead compensator for \( G(s) = 1/(s(s+1)) \) and visualizes the result.


s = tf('s');
G = 1/(s*(s + 1));

PM_des = 50;       % desired phase margin (deg)
wc_des = 4;        % desired crossover (rad/s)
safety = 5;        % extra safety margin (deg)

[mag, phase] = bode(G, wc_des);
mag = squeeze(mag);
phase = squeeze(phase);
PM0 = 180 + phase;               % uncompensated PM at wc_des
phi_req = PM_des - PM0 + safety; % required phase boost
phi_req = max(5, min(phi_req, 60));

phi_max = deg2rad(phi_req);
alpha = (1 - sin(phi_max))/(1 + sin(phi_max));
tau = 1/(wc_des*sqrt(alpha));

C0 = (tau*s + 1)/(alpha*tau*s + 1);   % lead without final gain
[magC0G, ~] = bode(C0*G, wc_des);
magC0G = squeeze(magC0G);
Kc = 1/magC0G;

C_lead = Kc*C0;
L = C_lead*G;

% Margins and Bode plots
margin(L);
grid on;

% Closed-loop step response
T = feedback(L, 1);
figure;
step(T);
title('Closed-loop step response with lead compensation');
      

In Simulink, C_lead can be implemented using a Transfer Fcn block (for the continuous-time compensator) or the discrete equivalent, then connected in series with the plant model of a robot joint.

10.2 Wolfram Mathematica

Mathematica has built-in control capabilities. The following notebook-style code designs and visualizes the lead compensator.


(* Define plant *)
s = LaplaceTransformVariable;
G = TransferFunctionModel[1/(s (s + 1)), s];

PMdes = 50 Degree;
wcDes = 4;

(* Uncompensated phase at wcDes *)
{mag0, phase0} = BodePlot[
  G, {wcDes, wcDes},
  PlotRange -> All,
  SamplingPoints -> 1,
  PlotLayout -> "List"
][[2, 1, 2, 1]] // N;

PM0 = 180 Degree + phase0;
safety = 5 Degree;
phiReq = PMdes - PM0 + safety;
phiReq = Max[5 Degree, Min[phiReq, 60 Degree]];
phiMax = phiReq;

alpha = (1 - Sin[phiMax])/(1 + Sin[phiMax]);
tau = 1/(wcDes*Sqrt[alpha]);

C0 = TransferFunctionModel[(tau s + 1)/(alpha tau s + 1), s];

(* Determine Kc *)
{magC0G, phaseC0G} = BodePlot[
  SeriesConnectedSystem[C0, G],
  {wcDes, wcDes},
  PlotRange -> All,
  SamplingPoints -> 1,
  PlotLayout -> "List"
][[2, 1, 2, 1]] // N;

Kc = 1/magC0G;
Clead = Kc*C0;
L = SeriesConnectedSystem[Clead, G];

(* Bode and step response *)
BodePlot[L, {0.1, 100}];
step = OutputResponse[FeedbackConnect[L, 1], UnitStep[t], t];
Plot[step, {t, 0, 5}, PlotLabel -> "Closed-loop step response"];
      

This symbolic and numeric environment is convenient for analytically exploring sensitivity of phase margin to changes in \( \alpha \) and \( \tau \).

11. Problems and Solutions

Problem 1 (Derivation of \( \phi_{\max} \)). Starting from the lead compensator \( C_{\text{lead}}(s) = K_c \dfrac{\tau s + 1}{\alpha \tau s + 1} \), derive the expression \( \phi_{\max} = \sin^{-1}\big(\dfrac{1 - \alpha}{1 + \alpha}\big) \) for the maximum phase lead.

Solution:

As in Section 3, let \( x = \omega \tau \) and \( \phi(x) = \tan^{-1}(x) - \tan^{-1}(\alpha x) \). Setting \( \dfrac{d\phi}{dx} = 0 \) leads to \( x^2 = 1/\alpha \), hence \( \omega_m = 1/(\tau \sqrt{\alpha}) \). Then

\[ \phi_{\max} = \phi\!\left(\frac{1}{\sqrt{\alpha}}\right) = \tan^{-1}\!\left(\frac{1}{\sqrt{\alpha}}\right) - \tan^{-1}\!\left(\sqrt{\alpha}\right). \]

Use the identity \( \tan^{-1}(u) - \tan^{-1}(v) = \tan^{-1}\left(\dfrac{u - v}{1 + uv}\right) \) to obtain

\[ \phi_{\max} = \tan^{-1}\left( \frac{\tfrac{1}{\sqrt{\alpha}} - \sqrt{\alpha}} {1 + 1} \right) = \tan^{-1}\left( \frac{1 - \alpha}{2\sqrt{\alpha}} \right). \]

Consider a right triangle with opposite side \( 1 - \alpha \) and adjacent side \( 2\sqrt{\alpha} \). The hypotenuse is \( \sqrt{(1-\alpha)^2 + 4\alpha} = 1 + \alpha \). Hence \( \sin(\phi_{\max}) = (1 - \alpha)/(1 + \alpha) \), giving

\[ \phi_{\max} = \sin^{-1}\left( \frac{1 - \alpha}{1 + \alpha} \right). \]


Problem 2 (Lead Design for Alternate Plant). For the plant \( G(s) = \dfrac{5}{s(s+4)} \), assume an initial gain has been chosen so that unity feedback gives crossover at \( \omega_c = 3 \ \text{rad/s} \) with uncompensated phase margin \( \text{PM}_0 = 20^\circ \). Design a lead compensator to achieve \( \text{PM}_d = 55^\circ \). Use a safety margin of \( 5^\circ \), and approximate the magnitude of the plant at \( \omega_c \) as \( |G(j3)| \approx 0.1 \).

Solution:

  1. Required phase boost:

    \[ \phi_{\text{req}} = 55^\circ - 20^\circ + 5^\circ = 40^\circ. \]

    Choose \( \phi_{\max} \approx 40^\circ \).
  2. Compute \( \alpha \):

    \[ \sin(40^\circ) \approx 0.643, \quad \alpha = \frac{1 - 0.643}{1 + 0.643} \approx \frac{0.357}{1.643} \approx 0.217. \]

  3. Choose \( \omega_m = \omega_c = 3 \ \text{rad/s} \) and compute \( \tau \):

    \[ \tau = \frac{1}{\omega_m\sqrt{\alpha}} \approx \frac{1}{3\sqrt{0.217}} \approx \frac{1}{3 \cdot 0.466} \approx 0.715 \ \text{s}. \]

    The zero and pole are:

    \[ s_z \approx -\frac{1}{0.715} \approx -1.40, \quad s_p \approx -\frac{1}{0.217 \cdot 0.715} \approx -6.47. \]

  4. Lead compensator without gain:

    \[ C_0(s) = \frac{0.715s + 1}{0.155s + 1}. \]

  5. Magnitude of \( C_0(j3) \):

    \[ |C_0(j3)| = \frac{\sqrt{1 + (3 \cdot 0.715)^2}} {\sqrt{1 + (3 \cdot 0.155)^2}} \approx \frac{\sqrt{1 + 2.145^2}}{\sqrt{1 + 0.465^2}} \approx \frac{\sqrt{1 + 4.60}}{\sqrt{1 + 0.216}} \approx \frac{\sqrt{5.60}}{\sqrt{1.216}} \approx \frac{2.37}{1.10} \approx 2.15. \]

    Thus \( |C_0(j3)G(j3)| \approx 2.15 \cdot 0.1 = 0.215 \). To enforce unity magnitude at crossover:

    \[ K_c = \frac{1}{0.215} \approx 4.65. \]

The final compensator is

\[ C_{\text{lead}}(s) = 4.65 \frac{0.715s + 1}{0.155s + 1}. \]


Problem 3 (Effect of \( \alpha \) on Bandwidth). For a given desired \( \phi_{\max} \), the parameter \( \alpha \) is determined uniquely. Explain qualitatively how choosing a smaller \( \alpha \) (larger zero-pole separation) affects the magnitude response and bandwidth of the compensated loop.

Solution:

From the magnitude formula

\[ |C_{\text{lead}}(j\omega)| = K_c \frac{\sqrt{1 + (\omega \tau)^2}} {\sqrt{1 + (\omega \alpha \tau)^2}}, \]

smaller \( \alpha \) moves the pole farther to the left (higher frequency) while keeping the zero closer to the origin. This yields:

  • A higher maximum magnitude boost \( 20\log_{10}(1/\sqrt{\alpha}) \) at \( \omega_m = 1/(\tau\sqrt{\alpha}) \), potentially increasing the crossover frequency and bandwidth.
  • A wider frequency band over which the magnitude is elevated, which can increase sensitivity to high-frequency noise if crossover is placed too high.

Thus, while smaller \( \alpha \) can help achieve aggressive bandwidth targets, it must be balanced against noise amplification and actuator limits, especially in robotic systems.


Problem 4 (Lead Compensator for a Robotic Joint Model). A simplified joint model of a robot axis is \( G(s) = \dfrac{K_m}{(T_m s + 1)s} \), with \( K_m = 10 \), \( T_m = 0.05 \). Assume that using gain only you obtain a crossover at \( \omega_c = 20 \ \text{rad/s} \) with phase margin \( \text{PM}_0 = 25^\circ \). Design a lead compensator to obtain \( \text{PM}_d = 60^\circ \), using a safety margin of \( 5^\circ \). (You may leave the magnitude computations in symbolic form.)

Solution:

  1. Required phase:

    \[ \phi_{\text{req}} = 60^\circ - 25^\circ + 5^\circ = 40^\circ. \]

    Take \( \phi_{\max} = 40^\circ \), so \( \alpha \approx 0.217 \) as in Problem 2.
  2. Choose \( \omega_m = \omega_c = 20 \ \text{rad/s} \); then

    \[ \tau = \frac{1}{20\sqrt{0.217}} \approx \frac{1}{20 \cdot 0.466} \approx 0.107 \ \text{s}. \]

    Zero and pole:

    \[ s_z \approx -9.35, \quad s_p \approx -\frac{1}{0.217 \cdot 0.107} \approx -43.2. \]

  3. Compute \( |C_0(j\omega_c)G(j\omega_c)| \) symbolically:

    \[ |G(j\omega_c)| = \frac{K_m}{\omega_c\sqrt{(T_m\omega_c)^2 + 1}}, \quad |C_0(j\omega_c)| = \frac{\sqrt{1 + (\omega_c \tau)^2}} {\sqrt{1 + (\omega_c \alpha \tau)^2}}. \]

    Thus

    \[ |C_0(j\omega_c)G(j\omega_c)| = \frac{K_m}{\omega_c\sqrt{(T_m\omega_c)^2 + 1}} \cdot \frac{\sqrt{1 + (\omega_c \tau)^2}} {\sqrt{1 + (\omega_c \alpha \tau)^2}}. \]

  4. Choose \( K_c = 1 / |C_0(j\omega_c)G(j\omega_c)| \). Numerically, substituting \( K_m = 10 \), \( T_m = 0.05 \), \( \omega_c = 20 \), and the chosen \( \tau, \alpha \), gives a specific \( K_c \) (left for numerical exercise).

The final lead compensator is \( C_{\text{lead}}(s) = K_c \dfrac{0.107s + 1}{0.023s + 1} \).


Problem 5 (Design Workflow). Sketch a high-level design workflow that starts from desired phase margin and bandwidth and ends with a validated lead compensator design using Bode plots.

Solution (flowchart):

flowchart TD
  S["Specify PM_d and target bandwidth"] --> U["Obtain plant G(s) or identified model"]
  U --> B["Plot Bode of L_0(s) = K_0 G(s)"]
  B --> M["Read PM_0 and crossover frequency"]
  M --> R["Compute phi_req and choose phi_max"]
  R --> P["Compute alpha and tau; form C_lead(s)"]
  P --> C["Plot Bode of L(s) = C_lead(s) G(s)"]
  C --> V["Check PM, GM, bandwidth, noise amplification"]
  V -->|acceptable| DONE["Implement & prepare discretization"]
  V -->|not acceptable| R2["Adjust PM_d, wc, or alpha and repeat"]
        

12. Summary

In this lesson, we developed a rigorous Bode-based design methodology for lead compensators. Starting from the standard form \( C_{\text{lead}}(s) = K_c \dfrac{\tau s + 1}{\alpha \tau s + 1} \) with \( 0 < \alpha < 1 \), we derived analytic expressions for the maximum phase lead \( \phi_{\max} \) and its frequency \( \omega_m \). We then connected phase margin requirements to the choice of \( \alpha \) and \( \tau \), and used magnitude conditions at the desired crossover to determine \( K_c \).

Practical implementations in Python, C++, Java, MATLAB/Simulink, and Mathematica illustrated how the theory translates into actual design workflows, particularly in the context of robotic servo control. The resulting lead compensators simultaneously increase phase margin, improve transient response, and modestly extend bandwidth, while requiring careful attention to noise amplification and physical limitations.

13. References

  1. Bode, H. W. (1945). Network Analysis and Feedback Amplifier Design. Van Nostrand.
  2. Evans, W. R. (1950). Control system synthesis by root locus method. Transactions of the American Institute of Electrical Engineers, 69(1), 66–69.
  3. Horowitz, I. M. (1963). Synthesis of Feedback Systems. Academic Press.
  4. Åström, K. J., & Hägglund, T. (1984). Automatic tuning of simple regulators with specifications on phase and amplitude margins. Automatica, 20(5), 645–651.
  5. Middleton, R. H., & Goodwin, G. C. (1988). Improved finite-word-length characteristics in digital control using delta operators. IEEE Transactions on Automatic Control, 33(10), 947–958.
  6. Skogestad, S., & Postlethwaite, I. (1996). Multivariable Feedback Control: Analysis and Design. Wiley. (Chapters on classical loop shaping and lead/lag.)
  7. Freudenberg, J. S., & Looze, D. P. (1985). Right half-plane poles and zeros and design tradeoffs in feedback systems. IEEE Transactions on Automatic Control, 30(6), 555–565.