MIXSYN
Mixed-sensitivity synthesis (mixsyn) is an H_\infty control design method that shapes the closed-loop sensitivity functions using weight functions W_1 (performance), W_2 (control effort), and W_3 (robustness).
The underlying optimization seeks a controller K that minimizes the norm of the weighted closed-loop map:
\left\| \begin{bmatrix} W_1 S \\ W_2 K S \\ W_3 T \end{bmatrix} \right\|_\infty
where S = (I + GK)^{-1} is the sensitivity function and T = GK(I + GK)^{-1} is the complementary sensitivity function. In python-control 0.10.2 this synthesis path depends on the Slycot routine sb10ad. When that backend is unavailable in the runtime, this wrapper returns an error string instead of a controller.
Excel Usage
=MIXSYN(G_num, G_den, W_perf_num, W_perf_den)
G_num(list[list], required): Numerator of the plant G.G_den(list[list], required): Denominator of the plant G.W_perf_num(list[list], required): Numerator of performance weight W_perf.W_perf_den(list[list], required): Denominator of performance weight W_perf.
Returns (str): String representation of the synthesized state-space controller K, or an error string if the required synthesis backend is unavailable.
Example 1: Basic mixed sensitivity synthesis
Inputs:
| G_num | G_den | W_perf_num | W_perf_den | |||
|---|---|---|---|---|---|---|
| 1 | 1 | 0.1 | 0.1 | 1 | 1 | 0.01 |
Excel formula:
=MIXSYN({1}, {1,0.1}, {0.1,1}, {1,0.01})
Expected output:
"Error: can't find slycot subroutine sb10ad"
Example 2: Mixed sensitivity for first-order plant
Inputs:
| G_num | G_den | W_perf_num | W_perf_den | |||
|---|---|---|---|---|---|---|
| 2 | 1 | 2 | 0.5 | 1 | 1 | 0.1 |
Excel formula:
=MIXSYN({2}, {1,2}, {0.5,1}, {1,0.1})
Expected output:
"Error: can't find slycot subroutine sb10ad"
Example 3: Accept flat list coefficient input
Inputs:
| G_num | G_den | W_perf_num | W_perf_den |
|---|---|---|---|
| 1 | 1,0.5 | 0.2,1 | 1,0.02 |
Excel formula:
=MIXSYN(1, 1,0.5, 0.2,1, 1,0.02)
Expected output:
"Error: can't find slycot subroutine sb10ad"
Example 4: Heavier low-frequency performance weighting
Inputs:
| G_num | G_den | W_perf_num | W_perf_den | |||
|---|---|---|---|---|---|---|
| 1 | 1 | 1 | 1 | 5 | 1 | 0.05 |
Excel formula:
=MIXSYN({1}, {1,1}, {1,5}, {1,0.05})
Expected output:
"Error: can't find slycot subroutine sb10ad"
Python Code
Show Code
import control as ct
import numpy as np
def mixsyn(G_num, G_den, W_perf_num, W_perf_den):
"""
Mixed-sensitivity H-infinity controller synthesis.
See: https://python-control.readthedocs.io/en/latest/generated/control.mixsyn.html
This example function is provided as-is without any representation of accuracy.
Args:
G_num (list[list]): Numerator of the plant G.
G_den (list[list]): Denominator of the plant G.
W_perf_num (list[list]): Numerator of performance weight W_perf.
W_perf_den (list[list]): Denominator of performance weight W_perf.
Returns:
str: String representation of the synthesized state-space controller K, or an error string if the required synthesis backend is unavailable.
"""
try:
def to_coeff_list(x):
values = []
if not isinstance(x, list):
return [float(x)]
source = [x] if len(x) > 0 and not isinstance(x[0], list) else x
for row in source:
if isinstance(row, list):
for val in row:
if val is not None and str(val) != "":
values.append(float(val))
elif row is not None and str(row) != "":
values.append(float(row))
return values
g_num = to_coeff_list(G_num)
g_den = to_coeff_list(G_den)
w_perf_num = to_coeff_list(W_perf_num)
w_perf_den = to_coeff_list(W_perf_den)
G = ct.tf(g_num, g_den)
W_perf = ct.tf(w_perf_num, w_perf_den)
K, CL, info = ct.mixsyn(G, w1=W_perf)
return str(K)
except Exception as e:
return f"Error: {str(e)}"