<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Control Theory on 四方喫茶舘</title><link>http://blog.cedard.top/tags/control-theory/</link><description>Recent content in Control Theory on 四方喫茶舘</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 14 Jun 2026 14:51:26 +0800</lastBuildDate><atom:link href="http://blog.cedard.top/tags/control-theory/index.xml" rel="self" type="application/rss+xml"/><item><title>Feedback Linearization, Part 3</title><link>http://blog.cedard.top/p/feedback-linearization-3/</link><pubDate>Sun, 14 Jun 2026 14:51:26 +0800</pubDate><guid>http://blog.cedard.top/p/feedback-linearization-3/</guid><description>&lt;h2 id="feedback-linearization-theorem"&gt;Feedback Linearization Theorem
&lt;/h2&gt;&lt;p&gt;We talked about feedback linearization theorem last time. As a recap:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Feedback Linearization Theorem&lt;/strong&gt;: Nonlinear system $\Sigma: \dot{x} = f(x) + g(x)u$ is feedback linearizable if:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;$[g(x), ad_fg(x), \ldots, ad_f^{n-1}g(x)]$ has rank $n$ $\forall x$.&lt;/li&gt;
&lt;li&gt;$\Delta = \text{span}{g(x), ad_fg(x), \ldots, ad_f^{n-2}g(x)}$ is involutive.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The first condition guarantees controllability, while the second condition guarantees that we can always find an output $y = h(x)$ that has relative degree equal to the system degree, according to Frobenius theorem. Actually, this is also just observability.&lt;/p&gt;
&lt;p&gt;We now look at some examples.&lt;/p&gt;
&lt;p&gt;Consider the system
&lt;/p&gt;
$$ \dot{x} = \begin{pmatrix} a \sin x_2 \\ -x_1^2 \end{pmatrix} + \begin{pmatrix}0 \\ 1 \end{pmatrix}u $$&lt;p&gt;
We would like to ask 2 questions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Is the system feedback linearizable?&lt;/li&gt;
&lt;li&gt;If so, how shall we find the output $y = h(x)$?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To answer the first question, we first validate if the first condition is met from feedback linearization theorem.
&lt;/p&gt;
$$
g(x) = \begin{pmatrix}0 \\ 1 \end{pmatrix}
$$&lt;p&gt;
&lt;/p&gt;
$$ad_fg = [f, g] = \begin{pmatrix} -a \cos x_2 \\ 0 \end{pmatrix}$$&lt;p&gt;
Therefore,
&lt;/p&gt;
$$
[g(x), ad_fg(x)] = \begin{pmatrix}0 &amp; -a \cos x_2 \\ 1 &amp; 0 \end{pmatrix}
$$&lt;p&gt;
This new matrix is always rank 2, for all $x$, except when $\cos x_2 = 0$.
The distribution $\Delta = \text{span}{g(x) }$ has only one element, so it&amp;rsquo;s trivially involutive. Therefore we conclude the system is feedback linearizable.&lt;/p&gt;
&lt;p&gt;Now, how shall we find the output $y$? We would like to find an output $y = h(x)$ such that it has relative degree of $2$, i.e.:&lt;/p&gt;
$$\begin{cases}
\begin{align}
\frac{\partial h}{\partial x} g(x) &amp;= 0 \\
\frac{\partial L_f h}{\partial x} g(x) &amp;\neq 0
\end{align}
\end{cases}
$$&lt;p&gt;The first PDE will give us
&lt;/p&gt;
$$ \frac{\partial h}{\partial x_2} = 0 $$&lt;p&gt;
meaning $h(x)$ shall be independent of $x_2$. We sub this fact into the second PDE:
&lt;/p&gt;
$$ \frac{\partial L_f h}{\partial x} g(x) = \frac{\partial L_fh}{\partial x_2} = \frac{\partial h}{\partial x_1}a \cos x_2 \neq 0$$&lt;p&gt;
Therefore, we can pick a few candidate $h(x)$, for example: $x_1$, $x_1^5$, and so forth. If we pick $h(x) = x_1$, then we can linearize the system as
&lt;/p&gt;
$$ \ddot{y} = v$$&lt;p&gt;
where the state and control transform is given by
&lt;/p&gt;
$$ \begin{cases}
\begin{align}
y &amp;= x_1 \\
\dot{y} &amp;= a\sin x_2 \\
u &amp;= (x_1^2 + v) \frac{1}{a\cos x_2}
\end{align}
\end{cases}
$$&lt;p&gt;
The audience is encouraged to verify the linearization by substituting the transforms back into the original system.&lt;/p&gt;
&lt;p&gt;As a result, we are able to design a linear control between $y$ and $v$ by LQR or pole placement, and we utilize the state and control transform to convert the system back into the original nonlinear system.&lt;/p&gt;
&lt;h2 id="mimo-feedback-linearization"&gt;MIMO Feedback Linearization
&lt;/h2&gt;&lt;p&gt;We now move forward to a more complex and generalized system: the multi-input multi-output nonlinear system. For the sake of simplicity, we limit the MIMO to be the square case (meaning we have the same number of inputs and outputs).&lt;/p&gt;
&lt;p&gt;If we have a square MIMO system that looks like:
&lt;/p&gt;
$$
\begin{align}
\displaystyle \Sigma: \dot{x} &amp;= f(x) + \Sigma_{i=1}^n g_i(x) u_i \quad x \in \mathbb{R}^n \\
&amp;= g(x)u \\
y &amp;= \begin{pmatrix} h_1(x) \\ \vdots \\ h_n(x) \end{pmatrix}
\end{align}
$$&lt;p&gt;
where
&lt;/p&gt;
$$
\begin{align}
g(x) &amp;= \begin{pmatrix} g_1(x) &amp; \cdots &amp; g_n(x) \end{pmatrix} \\
u &amp;= \begin{pmatrix} u_1 \\ \vdots \\ u_n\end{pmatrix}
\end{align}
$$&lt;p&gt;
The question is now, how shall we define the relative degree of the MIMO system?&lt;/p&gt;
&lt;h3 id="vector-relative-degree"&gt;Vector Relative Degree
&lt;/h3&gt;&lt;p&gt;We introduce the concept of vector relative degree in this case.
&lt;strong&gt;(Definition) Vector Relative Degree&lt;/strong&gt;: Nonlinear system $\Sigma$ has relative degree $(r_1, r_2, \ldots, r_n)$ at $x_0$ if:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;For all $1 \le j \le n, 1 \le i \le n, 0 \le k \le r_i - 2$,

$$ L_{g_j}L_f^kh_i = 0, \quad \forall x \text{ in a neighborhood of } x_0 $$&lt;/li&gt;
&lt;li&gt;The $n \times n$ matrix, also known as the &lt;strong&gt;Decoupling Matrix&lt;/strong&gt;,

$$
A(x) = \begin{pmatrix}
L_{g_1}L_f^{r_1-1}h_1 &amp; \cdots &amp; L_{g_n}L_f^{r_n-1}h_n \\
\vdots &amp; \cdots &amp; \vdots \\
L_{g_1}L_f^{r_n-1}h_1 &amp; \cdots &amp; L_{g_n}L_f^{r_n-1}h_n
\end{pmatrix}
$$
Then, for the i-th output, we can always express it in terms of

$$
\begin{align}
y_i^{(r_i)} &amp;= L_f^{r_i} h_i(x)+ L_{g_1}L_f^{r_i-1}h_i(x)u_1 + \cdots + L_{g_n}L_f^{r_i-1}h_i(x)u_n \\
&amp;= L_f^{r_i} h_i(x) + \displaystyle \Sigma_j L_{g_j}L_f^{r_i-1}h_i(x)u_j
\end{align}
$$&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If, at least one $L_{g_j}L_f^{r_i-1}h_i(x)$ is non-zero, then the system is feedback linearizable.
Therefore, we can also do IO linearization:&lt;/p&gt;
$$
\begin{align}
\begin{pmatrix}
y_1^{(r_1)} \\
\vdots \\
y_n^{(r_n)}
\end{pmatrix}&amp;=\begin{pmatrix}
L_f^{r_1}h_1(x) \\ \vdots \\ L_f^{r_n}h_n
\end{pmatrix} +
\begin{pmatrix}
L_f^{r_1} h_1(x) &amp; \cdots &amp; L_{g_n}L_f^{r_1-1}h_1(x) \\
\vdots &amp; \cdots &amp; \vdots \\
L_f^{r_n} h_n(x) &amp; \cdots &amp; L_{g_n}L_f^{r_n-1}h_n(x)
\end{pmatrix}
\begin{pmatrix}
u_1 \\
\vdots \\
u_n
\end{pmatrix} \\
&amp;= L_fh(x) + A(x) u
\end{align}
$$&lt;p&gt;where, notice that we implicitly extended the definition of Lie derivative to its vector form.
And the control can be transformed as:
&lt;/p&gt;
$$
u(x) = A^{-1}(x)(L_fh(x)+ v) \rightarrow \begin{pmatrix} y_1^{(r_1)} \\ \vdots \\ y_n^{(r_n)} \end{pmatrix} = v
$$&lt;p&gt;
.&lt;/p&gt;
&lt;h3 id="mimo-feedback-linearization-theorem"&gt;MIMO Feedback Linearization Theorem
&lt;/h3&gt;&lt;p&gt;Now we state the feedback linearization theorem in MIMO form:
&lt;strong&gt;Theorem(MIMO Feedback Linearization)&lt;/strong&gt;: A MIMO nonlinear system $\Sigma$ is:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;feedback linearizable, if its vector relative degree $r = (r_1, r_2, \ldots, r_n)$ satisfies such that

$$ r_1 + \ldots + r_n = \displaystyle \Sigma_{i=1}^n r_i \ge n$$&lt;/li&gt;
&lt;li&gt;If the sum

$$ r_1 + \ldots + r_n = \displaystyle \Sigma_{i=1}^n r_i &lt; n$$
, then the system can only be IO linearizable, where we have to rely on the internal zero dynamic to be also stable in order for the full system to be stable.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="examples"&gt;Examples
&lt;/h3&gt;&lt;p&gt;Consider a motion of a wheeled vehicle moving in a horizontal plane. The kinematics of the vehicle are given by the differential equations:
&lt;/p&gt;
$$
\begin{align}
\dot{x} &amp;= V \cos \theta \\
\dot{y} &amp;= V \sin \theta \\
\dot{\theta} &amp;= \omega
\end{align}
$$&lt;p&gt;
Here $(x, y)$ is the location in the horizontal 2D plane, $V$ is the vehicle speed, and $\theta$ denotes the vehicle heading angle, and $\omega$ denotes the vehicle turning rate.&lt;/p&gt;
&lt;h4 id="ill-defined-vector-relative-degree"&gt;Ill-defined Vector Relative Degree
&lt;/h4&gt;&lt;p&gt;If we consider the vehicle speed $V$ and the vehicle turning range $\omega$ as two control inputs, and the vehicle locations in the plane as two outputs, the vector relative degree is not well-defined. We notice the system now looks like:
&lt;/p&gt;
$$
\begin{align}
\frac{d}{dt}\begin{pmatrix} x \\ y \\ \theta \end{pmatrix} &amp;= \begin{pmatrix}u_1 \cos \theta \\ u_1 \sin \theta \\ u_2 \end{pmatrix}
 \\
\begin{pmatrix} y_1 \\ y_2 \end{pmatrix}
&amp;= \begin{pmatrix} x \\ y \end{pmatrix}
\end{align}
$$&lt;p&gt;
If we take the first time derivative of the outputs
&lt;/p&gt;
$$
\begin{align}
\frac{d}{dt}\begin{pmatrix} y_1 \\ y_2 \end{pmatrix} &amp;= \frac{d}{dt}\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} u_1 \cos \theta \\ u_1 \sin \theta \end{pmatrix}
\end{align}
$$&lt;p&gt;
Only the first control input shows up, which is a red flag. If we consider the coupling matrix
&lt;/p&gt;
$$
A(x) = \begin{pmatrix}
\cos \theta &amp; 0 \\
\sin \theta &amp; 0
\end{pmatrix}
$$&lt;p&gt;
is actually singular. Therefore the relative degree in this case is not well defined.&lt;/p&gt;
&lt;h4 id="well-defined-vector-relative-degree"&gt;Well-defined Vector Relative Degree
&lt;/h4&gt;&lt;p&gt;If we now consider the vehicle acceleration and the vehicle turning rate as the two control inputs, and we still use the vehicle position as the two outputs, this time the vehicle relative degree is actually well-defined, so long as $V &amp;gt; 0$ for this 4-th order nonlinear system. We have the original system expressed as:
&lt;/p&gt;
$$
\begin{align}
\frac{d}{dt} \begin{pmatrix} x \\ y \\ \theta \\ V \end{pmatrix} &amp;= \begin{pmatrix} V \cos \theta \\ V \sin \theta \\ u_2 \\ u_1 \end{pmatrix} \\
\begin{pmatrix} y_1 \\ y_2 \end{pmatrix} &amp;= \begin{pmatrix} x \\ y \end{pmatrix}
\end{align}
$$&lt;p&gt;If we take the first time derivative of the output vector:
&lt;/p&gt;
$$
\frac{d}{dt}\begin{pmatrix} y_1 \\ y_2 \end{pmatrix} = \begin{pmatrix} V \cos \theta \\ V \sin \theta \end{pmatrix}
$$&lt;p&gt;
We realize that both inputs don&amp;rsquo;t explicitly show up, therefore we take another round of differentiation:
&lt;/p&gt;
$$
\frac{d^2}{dt^2}\begin{pmatrix} y_1 \\ y_2 \end{pmatrix} = \begin{pmatrix} u_1 \cos \theta - u_2 V \sin \theta \\ u_1 \sin \theta + u_2 V \cos \theta \end{pmatrix}
$$&lt;p&gt;
Now, both inputs show up which is a good sign. We verify this by considering the decoupling matrix:
&lt;/p&gt;
$$
A(x) = \begin{pmatrix} \cos \theta &amp; -V \sin \theta \\ \sin \theta &amp; V \cos \theta \end{pmatrix} 
$$&lt;p&gt;
And the determinant is given by
&lt;/p&gt;
$$
\text{det}(A(x)) = V
$$&lt;p&gt;
We now realize that the decoupling matrix is non-singular, as long as the speed is non-zero. Therefore the vector relative degree is well-defined.&lt;/p&gt;
&lt;h4 id="control-law"&gt;Control Law
&lt;/h4&gt;&lt;p&gt;Given that $r_1 = r_2 = 2$ in this case, and we satisfy $r_1 + r_2 = 4 = n$, we can find a state transformation and a control transformation so that the original system can be feedback linearized. We consider the control transformation as
&lt;/p&gt;
$$
\begin{pmatrix}
\xi_1 = y_1 = x\\
\xi_2 = y_2 = y\\
\xi_3 = \dot{y_1} \\
\xi_4 = \dot{y_2}
\end{pmatrix}
$$&lt;p&gt;
And we can derive the control transformation as
&lt;/p&gt;
$$
\begin{pmatrix}
v_1 = u_1 \cos \theta - u_2 V \sin \theta \\
v_2 = u_2 \sin \theta + u_2 V \cos \theta 
\end{pmatrix}
$$&lt;p&gt;
and the resulting system now looks like
&lt;/p&gt;
$$
\begin{align}
\begin{cases}
\dot{\xi_1} &amp;= \xi_3 \\
\dot{\xi_2} &amp;= \xi_4 \\
\dot{\xi_3} &amp;= v_1 \\
\dot{\xi_4} &amp;= v_2 
\end{cases}
\end{align}
$$&lt;p&gt;
Which is happily a double integrator system, thus can be controlled (pole placed, or LQRed) to be stable.&lt;/p&gt;</description></item><item><title>Feedback Linearization, Part 2</title><link>http://blog.cedard.top/p/feedback-linearization-2/</link><pubDate>Fri, 12 Jun 2026 19:33:35 +0800</pubDate><guid>http://blog.cedard.top/p/feedback-linearization-2/</guid><description>&lt;h3 id="more-facts-about-io-linearization"&gt;More Facts about IO Linearization
&lt;/h3&gt;&lt;p&gt;We are now aware of how to perform input-output linearization. To summarize:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;For an output with relative degree $r$, we are able to construct a feedback linearization mapping such that the input-output linearized system is of order $r$.&lt;/li&gt;
&lt;li&gt;The remaining state will construct a &amp;ldquo;zero plane&amp;rdquo; $Z$ where the zero dynamics on the plane will determine the stability of the overall system.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now, we can draw an obvious conclusion if the zero dynamic is indeed stable:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Theorem&lt;/strong&gt;: If $z = 0$ is locally exponentially stable for the zero dynamics, $\dot{z} = q(0, z)$, then $u_{IO}, v$ locally exponentially stabilizes $x = 0$.&lt;/p&gt;
&lt;p&gt;The proof is as follows:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Proof&lt;/strong&gt;: The closed loop system is given by
&lt;/p&gt;
$$
\begin{align}
\dot{\xi} &amp;= A_{CL} \xi, A_{CL} = A - BK \\
\dot{z} &amp;= q(\xi, z)
\end{align}
$$&lt;p&gt;
where
&lt;/p&gt;
$$
A_{CL} = \begin{pmatrix}
0 &amp; 1 &amp; 0 &amp;\ldots &amp; 0 \\
0 &amp; 0 &amp; 1 &amp; \ldots &amp; 0 \\
\vdots &amp; \vdots &amp; \vdots &amp; \ddots &amp; \vdots \\
-k_1 &amp; -k_2 &amp; -k_3 &amp; \ldots &amp; -k_r
\end{pmatrix}
$$&lt;p&gt;
where $\Re{\lambda_i} &amp;lt; 0$ for all $i = 1, \ldots, r$.
If we linearize the system at $\xi = z = 0$, we get the following:&lt;/p&gt;
$$
\frac{d}{dt} \begin{pmatrix} \delta \xi \\ \delta z \end{pmatrix} = \begin{pmatrix}
A_{CL} &amp; 0 \\
\frac{\partial q}{\partial \xi}(0, 0) &amp; \frac{\partial q}{\partial z}(0, 0)
\end{pmatrix} \begin{pmatrix} \delta \xi \\ \delta z \end{pmatrix}
$$&lt;p&gt;
The matrix is Hurwitz, thus the end of the proof.&lt;/p&gt;
&lt;p&gt;We notice that the relationship between the new states $\xi$ and original states $x$ is such that
&lt;/p&gt;
$$ \xi = T(x)$$&lt;p&gt;
To verify if $T$ is a diffeomorphism, we introduce the following theorem:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Inverse Function Theorem&lt;/strong&gt;: A function $T: \mathbb{R}^n \to \mathbb{R}^n$, $T \in C^1$ satisfies
&lt;/p&gt;
$$ \frac{\partial T}{\partial x}(x_0) \neq 0 $$&lt;p&gt;
is full rank, then $T^{-1}$ exists, and is continuous and differentiable.&lt;/p&gt;
&lt;p&gt;Now let&amp;rsquo;s connect IO linearization back to feedback linearization. It&amp;rsquo;s not hard to see that if we can guarantee the zero dynamic to be stable, then the original system will be stable; the best way to make sure the zero dynamic is always stable is that the zero plane shrinks to just a point, and this is done if $r = n$. Therefore we have the following theorem:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Isidori, chapter 4&lt;/strong&gt;: If a nonlinear system $\Sigma$ has a relative degree $r$ at $x_0$, then on the neighborhood of $x_0$, the functions
&lt;/p&gt;
$$ \{ h(x), L_fh(x), \ldots, L_f^{r-1}h(x) \} $$&lt;p&gt;
are independent.
Then, we can conclude that, $\Sigma$ is feedback linearizable, if and only if $\exists y = h(x)$ such that the output has relative degree $r = n$.&lt;/p&gt;
&lt;p&gt;In short, if the output of the system satisfies that the relative degree equals to the system degree, then the system is always linearizable. However, if the output has a relative degree smaller than the system degree, it&amp;rsquo;s possible that we didn&amp;rsquo;t pick a good output &amp;ndash; how do we know if a system can in fact be feedback linearizable? We&amp;rsquo;ll have to introduce some more new concepts to answer the question.&lt;/p&gt;
&lt;h3 id="introduction-to-differential-geometry"&gt;Introduction to Differential Geometry
&lt;/h3&gt;&lt;p&gt;Our audience may find themselves familiar with these concepts, if they have taken classes in general relativity.&lt;/p&gt;
&lt;h4 id="manifold"&gt;Manifold
&lt;/h4&gt;&lt;p&gt;Let $M$ be a non-empty set of $\mathbb{R}^n$ and let $1 \le m &amp;lt; n$, then $M$ is an n-dimensional smooth &lt;strong&gt;Manifold&lt;/strong&gt; of $\mathbb{R}^n$ if, $\forall p \in M$, $\exists r &amp;gt; 0$, $F:B_r(p) \to \mathbb{R}^{n-m}$ such that:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;$M \cap B_r(p) = { x \in \mathbb{R}^n | F(x) = 0 }$&lt;/li&gt;
&lt;li&gt;$ F \in C^0 $&lt;/li&gt;
&lt;li&gt;$ \forall \bar{x} \in M \cap B_r(p)$, $\text{rank} \frac{\partial F}{\partial x}(\bar{x}) = n - m $&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Intuitively, a manifold is a shape that &amp;ldquo;embeds&amp;rdquo; into a Euclidean space. We can always find a local mapping (also known as the &amp;ldquo;atlas&amp;rdquo;) to map the manifold into another local region in Euclidean space, given these two spaces have the same dimension.&lt;/p&gt;
&lt;p&gt;Some well-known manifolds are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Circle, a 1D manifold in $\mathbb{R}^2$&lt;/li&gt;
&lt;li&gt;Mobius strip, a 2D manifold in $\mathbb{R}^3$&lt;/li&gt;
&lt;li&gt;Sphere, a 2D manifold in $\mathbb{R}^3$&lt;/li&gt;
&lt;li&gt;Klein bottle, a 2D manifold in $\mathbb{R}^4$&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="tangent-space"&gt;Tangent Space
&lt;/h4&gt;&lt;p&gt;Let $M$ be a smooth manifold in $\mathbb{R}^n$ and let $p \in M$, suppose $F: B_r{p} \to \mathbb{R}^{n-1}$ satisfies conditions from definitions of $M$.
Then the &lt;strong&gt;Tangent Space&lt;/strong&gt; of $p$, denoted as $T_pM$ is such that
&lt;/p&gt;
$$ T_pM = \{ v \in \mathbb{R}^n | \frac{\partial F}{\partial x}(p) v = 0 \} = \mathbb{N}(\frac{\partial F}{\partial x}(p)) $$&lt;p&gt;
Note that, $\text{dim}(T_pM) = m$.&lt;/p&gt;
&lt;h4 id="tangent-vector"&gt;Tangent Vector
&lt;/h4&gt;&lt;p&gt;The &lt;strong&gt;Tangent Vector&lt;/strong&gt; is a vector in tangent space.&lt;/p&gt;
&lt;p&gt;We denote the relationship of manifold, tangent space and tangent vector like below:&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="372px" data-flex-grow="155" height="224" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/feedback-linearization-2/math20260613170104.png" width="348"&gt;&lt;/p&gt;
&lt;h4 id="vector-field"&gt;Vector Field
&lt;/h4&gt;&lt;p&gt;&lt;strong&gt;Vector Field&lt;/strong&gt; $f$ on manifold $M$ is an assignment to each $p \in M$ a vector $f(p) \in T_pM$.
Note that, the vector field is $C^k$ if $f \in C^k$.&lt;/p&gt;
&lt;h4 id="lie-bracket"&gt;Lie Bracket
&lt;/h4&gt;&lt;p&gt;Given $f, g$ as two different vector fields, the &lt;strong&gt;Lie Bracket&lt;/strong&gt; is defined as&lt;/p&gt;
$$
\begin{align}
[f, g](x) &amp;= \frac{\partial g}{\partial x}(x) f(x) - \frac{\partial f}{\partial x}(x) g(x) \\
&amp;= L_fg - L_gf \\
\end{align}
$$&lt;p&gt;The Lie bracket can also be expressed in terms of &amp;ldquo;adjoint&amp;rdquo; operator, i.e.:
&lt;/p&gt;
$$
ad_f g(x) = [f, g](x)
$$&lt;p&gt;
We can use adjoint operator to express nested Lie brackets:
&lt;/p&gt;
$$ \begin{align}
ad_f^2g(x) &amp;= [f, ad_f g(x)] \\
&amp;= [f, [f, g]](x)
\end{align} $$&lt;p&gt;
In general, we have
&lt;/p&gt;
$$
ad_f^kg(x) = [f, ad_f^{k-1}g(x)]
$$&lt;p&gt;An example of Lie bracket calculation is as follows:
&lt;/p&gt;
$$
\begin{align}
f &amp;= \begin{pmatrix} x_2 \\ -\sin x_1 - x_2 \end{pmatrix} \\
g &amp;= \begin{pmatrix} 0 \\ x_1 \end{pmatrix} \\
[f, g](x) &amp;= L_fg - L_gf \\
&amp;= \begin{pmatrix} 0 \\ x_2 \end{pmatrix} - \begin{pmatrix} x_1 \\ -x_1 \end{pmatrix} \\
&amp;= \begin{pmatrix} -x_1 \\ x_2 + x_1 \end{pmatrix}
\end{align}
$$&lt;p&gt;Some useful properties of Lie bracket:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;$[f, f ] = 0$&lt;/li&gt;
&lt;li&gt;$[f, g] = -[g, f]$&lt;/li&gt;
&lt;li&gt;If $f$ and $g$ are constant vectors, then $[f, g] = 0$.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now let&amp;rsquo;s consider a linear system $\dot{x} = Ax + Bu$, if we express this in terms of control-affine system form, we have
&lt;/p&gt;
$$\begin{align}
\dot{x} &amp;= f(x) + g(x)u \\
f(x) &amp;= Ax \\
g(x) &amp;= B
\end{align}
$$$$
\begin{align}
ad_fg &amp;= -AB \\
ad_f^2g &amp;= A^2B \\
ad_f^3g &amp;= -A^3B \\
\vdots \\
ad_f^kg &amp;= (-1)^k A^k B
\end{align}
$$&lt;h4 id="tangent-bundle"&gt;Tangent Bundle
&lt;/h4&gt;&lt;p&gt;The &lt;strong&gt;Tangent Bundle&lt;/strong&gt; of a manifold $M$ is defined as
&lt;/p&gt;
$$ TM = \bigcup_{p \in M} T_pM $$&lt;p&gt;
That is, it&amp;rsquo;s the &amp;ldquo;bundle&amp;rdquo; of all tangent spaces at each point in the manifold.&lt;/p&gt;
&lt;h4 id="distribution"&gt;Distribution
&lt;/h4&gt;&lt;p&gt;Suppose $f_1, f_2, \ldots, f_n$ are vector fields, the &lt;strong&gt;Distribution&lt;/strong&gt; is defined as
&lt;/p&gt;
$$ \Delta (x) = \text{span}\{f_1(x), f_2(x), \ldots, f_n(x)\} $$&lt;p&gt;
whereas at each specific point $x$, $\Delta(x)$ represents the subspace of the tangent space $T_xM$.&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="305px" data-flex-grow="127" height="412" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/feedback-linearization-2/math20260613172713.png" width="524"&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;$\Delta$ is &lt;strong&gt;non-singular&lt;/strong&gt; distribution if $\text{dim}(\Delta(x))$ is a constant $\forall x$.&lt;/li&gt;
&lt;li&gt;$\Delta$ is &lt;strong&gt;involutive&lt;/strong&gt; if

$$ \forall f, g \in \Delta \Rightarrow [f, g] \in \Delta $$&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let&amp;rsquo;s consider the following example:
&lt;/p&gt;
$$
\begin{align}
f_1 &amp;= \begin{pmatrix} 2x_2 \\ 1 \\ 0 \end{pmatrix} \\
f_2 &amp;= \begin{pmatrix} 1 \\ 0 \\ x_2 \end{pmatrix} \\
\Delta &amp;= [f_1, f_2]
\end{align}
$$&lt;p&gt;Because $\text{dim}\Delta(x) = 2$ for all $x$, the distribution $\Delta$ is non-singular.&lt;/p&gt;
&lt;p&gt;$\Delta$ is involutive is equivalent to
&lt;/p&gt;
$$
[f_1, f_2] = \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix} \in \Delta
$$&lt;p&gt;
if and only if $\text{rank}(f_1, f_2, [f_1, f_2]) = 2 \quad \forall x$. Unfortunately the rank is 3, therefore $\Delta$ is not involutive.&lt;/p&gt;
&lt;h3 id="feedback-linearizability"&gt;Feedback Linearizability
&lt;/h3&gt;&lt;p&gt;With all these mathematical definitions, we are finally able to determine whether a nonlinear system can actually be feedback linearized, using the following theorem:&lt;/p&gt;

 &lt;blockquote&gt;
 &lt;p&gt;A nonlinear system $\Sigma$ is feedback linearizable, if an only if:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;$[g(x), ad_fg(x), \ldots, ad_f^{n-1}g(x) ]$ has rank $n$, $\forall x$. This condition guarantees controllability.&lt;/li&gt;
&lt;li&gt;$\Delta = \text{span}{g, ad_fg, \ldots, ad_f^{n-2}g}$ is involutive.&lt;/li&gt;
&lt;/ol&gt;

 &lt;/blockquote&gt;
&lt;p&gt;If we are able to determine whether the system is feedback linearizable, the next step will be to look for the specific output with relative degree $n$. From our earlier discussion, we are looking for a function $y = h(x)$ such that it meets the following conditions:
&lt;/p&gt;
$$\begin{align}
\begin{cases}
L_gh = L_gL_f = &amp;\ldots = L_gL_f^{n-2}h = 0 \forall x \\
L_gL_f^{n-1}h &amp;\neq 0
\end{cases}
\end{align}
$$&lt;p&gt;
In fact, these two conditions are equivalent to the following two conditions:
&lt;/p&gt;
$$\begin{align}
\begin{cases}
L_gh = L_{ad_fg}h = &amp;\ldots = L_{ad_f^{n-2}g}h = 0 \forall x \\
L_{ad_f^{n-1}g}h &amp;\neq 0
\end{cases}
\end{align}
$$&lt;p&gt;
The advantage of the latter formulation is that we can write the first condition as:
&lt;/p&gt;
$$
\frac{\partial h}{\partial x} \begin{pmatrix} g(x) &amp; ad_fg(x) &amp; \cdots &amp; ad_f^{n-2}g(x) \end{pmatrix} = 0
$$&lt;p&gt;
The important fact here is that, the solution for this partial differential equation only exists, if $\Delta = {g, ad_fg, \ldots, ad_f^{n-2}g}$ is involutive, according to the (Frobenius theorem)[https://en.wikipedia.org/wiki/Frobenius_theorem_(differential_topology)].&lt;/p&gt;
&lt;p&gt;To prove that the two conditions are indeed equivalent, we use the following lemma:&lt;/p&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;Lemma&lt;/strong&gt;: Given $L_gh = L_gL_f h = \ldots = L_gL_f^{n-2}h = 0$ for all $x \in B_\delta (x_0)$, then we have
&lt;/p&gt;
$$L_gL_f^kh = (-1)^k L_{ad_f^kg}h, \forall k = 0,1,\ldots, r-1$$&lt;p&gt;.&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;p&gt;This lemma can be proven using induction, and we skip the full proof here.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;In this chapter, we discussed the condition for a nonlinear system to be fully feedback linearizable. In the final chapter, we&amp;rsquo;ll give some examples and extend to multi-input multi-output case.&lt;/p&gt;</description></item><item><title>Feedback Linearization, Part 1</title><link>http://blog.cedard.top/p/feedback-linearization-1/</link><pubDate>Thu, 11 Jun 2026 21:38:58 +0800</pubDate><guid>http://blog.cedard.top/p/feedback-linearization-1/</guid><description>&lt;p&gt;Feedback linearization is a seemingly obvious but powerful technique in control theory that transforms a nonlinear system into a linear one through state and input feedback.&lt;/p&gt;
&lt;p&gt;I learned this technique when I was taking MEC237 from Berkeley, and I later realized it&amp;rsquo;s actually pretty useful and one of the most universal techniques in nonlinear control.&lt;/p&gt;
&lt;h2 id="motivation"&gt;Motivation
&lt;/h2&gt;&lt;p&gt;Let&amp;rsquo;s consider a first-order nonlinear system:&lt;/p&gt;
$$
\dot{x} = x^3 + u
$$&lt;p&gt;Where $x$ is our internal state, and $u$ is our control input. If the system has no control, state $x$ is unstable. Intuitively, if $x$ is greater than 0, $\dot{x}$ is also greater, pushing it away from the equilibrium point, and vice versa if $x &amp;lt; 0$.&lt;/p&gt;
&lt;p&gt;One caveat here is that, we can&amp;rsquo;t use Lyapunov indirect method to conclude instability, because the Jacobian matrix is 0, and nothing can be concluded from a both non-positive and non-negative Jacobian matrix eigenvalue.&lt;/p&gt;
&lt;p&gt;How shall we use the control input to stabilize the system? Let&amp;rsquo;s consider the input $u = -x^3 - x$, where if we sub-into the original system:&lt;/p&gt;
$$ \dot{x} = x^3 + (-x^3 - x) = -x $$&lt;p&gt;This is now a negative feedback system with eigenvalue strictly negative, and we can therefore conclude stability.&lt;/p&gt;
&lt;p&gt;What did we make the control input do? We use a nonlinear term $-x^3$ in the control input to cancel the original system&amp;rsquo;s unstable term, and introduce another stabilizing linear term $-x$ to ensure stability. The mechanism where we use feedback to achieve a stable linear system is called &lt;strong&gt;Feedback Linearization&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;However, is this technique universal? The answer is no. Look at the following system:&lt;/p&gt;
$$
\begin{align}
\begin{cases}
\dot{x}_1 = a \sin x_2 \\
\dot{x}_2 = -x_1^2 + u
\end{cases}
\end{align}
$$&lt;p&gt;In fact, any input $u$ can&amp;rsquo;t linearize both states $x_1$ and $x_2$. However, if we do a &lt;strong&gt;state transformation&lt;/strong&gt; like below:&lt;/p&gt;
$$
\begin{align}
z_1 &amp;= x_1 \\
z_2 &amp;= a \sin x_2 
\end{align}
$$&lt;p&gt;Then it&amp;rsquo;s not too hard to verify that the transformed system can actually be linearized. Thus by combining state transform and control transform, we are able to achieve feedback linearization.&lt;/p&gt;
&lt;h2 id="some-definitions"&gt;Some Definitions
&lt;/h2&gt;&lt;p&gt;We now give some useful definitions to help understand the feedback linearization technique.&lt;/p&gt;
&lt;h3 id="control-affine-system"&gt;Control-Affine System
&lt;/h3&gt;&lt;p&gt;A system that has the following form is called a &lt;strong&gt;Control-Affine System&lt;/strong&gt;:&lt;/p&gt;
$$
\dot{x} = f(x) + g(x)u
$$&lt;p&gt;where $f(x)$ and $g(x)$ are smooth vector fields.&lt;/p&gt;
&lt;p&gt;An example of a system that&amp;rsquo;s not control-affine is:
&lt;/p&gt;
$$
\dot{x} = f(x) + g(x)u^2
$$&lt;h3 id="diffeomorphism"&gt;Diffeomorphism
&lt;/h3&gt;&lt;p&gt;In differential geometry, a &lt;strong&gt;diffeomorphism&lt;/strong&gt; is a smooth invertible map between differentiable manifolds, whose inverse is also smooth. To express in mathematical language, such mapping $T$ satisfies $T \in C^1$ and $T^{-1} \in C^1$.&lt;/p&gt;
&lt;h3 id="feedback-linearizable"&gt;Feedback Linearizable
&lt;/h3&gt;&lt;p&gt;A nonlinear control-affine system $\Sigma: \dot{x} = f(x) + g(x)u$ is said to be &lt;strong&gt;feedback linearizable&lt;/strong&gt; if there exists a control law $u = \alpha (x) + \beta (x)v$ and state transform $z = T(x)$, where $T$ is a diffeomorphism, such that the transformed system $\dot{z} = Az + Bv$ satisfies $(A, B)$ is controllable.&lt;/p&gt;
&lt;h3 id="lie-derivative"&gt;Lie Derivative
&lt;/h3&gt;&lt;p&gt;The &lt;strong&gt;Lie Derivative&lt;/strong&gt; is an operator such that:&lt;/p&gt;
$$ 
L_f u = \frac{\partial u}{\partial x} f(x)
$$&lt;p&gt;We will see how Lie derivative helps us simplify some notations later.&lt;/p&gt;
&lt;h3 id="input-output-linearization"&gt;Input-Output Linearization
&lt;/h3&gt;&lt;p&gt;There are cases that we can&amp;rsquo;t perform full feedback linearization, but we can still achieve input-output linearization.&lt;/p&gt;
&lt;p&gt;Consider the same system that we defined earlier:&lt;/p&gt;
$$
\begin{cases}
\dot{x}_1 = a \sin x_2 \\
\dot{x}_2 = -x_1^2 + u \\
y = x_2
\end{cases}
$$&lt;p&gt;Note that now we assign the output $y$ to be only a function of $x_2$. Now, we can perform &lt;strong&gt;Input-Output Linearization&lt;/strong&gt; $ u = x_1^2 + v$ such that:&lt;/p&gt;
$$ y = x_2 = -x_1^2 + x_1^2 +v = v$$&lt;p&gt;from there, we manage to achieve a linear relationship between the new control law $v$ and output $y$. However, since $x_1$ is an unobservable state from $y$, we can&amp;rsquo;t tell just from $y$ whether the inner system is stable &amp;ndash; therefore it&amp;rsquo;s possible for the inner state to explode while the output shows nothing, causing system failure.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Now with all these definitions, we would like to answer the following questions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;When is a system feedback linearizable?&lt;/li&gt;
&lt;li&gt;If not feedback linearizable, when is the system IO linearizable?&lt;/li&gt;
&lt;li&gt;Is there connection between IO linearization and system linearization?&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="relative-degree-of-output-y"&gt;Relative Degree of Output $y$
&lt;/h2&gt;&lt;p&gt;Let&amp;rsquo;s consider the following system that is a generalization of a SISO control-affine system:&lt;/p&gt;
$$
\begin{align}
\dot{x} &amp;= f(x) + g(x)u \\
y &amp;= h(x)
\end{align}
$$&lt;p&gt;
Where $f, g, h$ are sufficiently smooth.&lt;/p&gt;
&lt;p&gt;We notice that $y$ is not a function of $u$, to the first order because there is no direct control term in $y$. Let&amp;rsquo;s try to take the derivative of $y$:&lt;/p&gt;
$$
\begin{align}
\dot{y} &amp;= \frac{\partial h(x)}{\partial x} \dot{x} \\
&amp;= \frac{\partial h(x)}{\partial x} (f(x) + g(x)u) \\
&amp;= L_f h(x) + L_g h(x) u
\end{align}
$$&lt;p&gt;
Note that we used the Lie derivation notation.&lt;/p&gt;
&lt;p&gt;Now assume that $L_g h(x) \neq 0$, then we have a direct term $u$ in $\dot{y}$. We can therefore make $u$ such that:&lt;/p&gt;
$$
u = L_g h(x) ^ {-1} (-L_f h(x) + v)
$$&lt;p&gt;and so that:&lt;/p&gt;
$$
\dot{y} = v
$$&lt;p&gt;What if $L_g h(x) = 0$? In that case, $u$ doesn&amp;rsquo;t appear in the first derivative of $y$:&lt;/p&gt;
$$
\dot{y} = L_f h(x)
$$&lt;p&gt;But no worries, we can take another derivative operation:
&lt;/p&gt;
$$
\ddot{y} = L_f^2 h(x) + L_gL_fh(x)u
$$&lt;p&gt;
Note that, $L_aL_bc(x) = L_a(L_b c(x))$.
Suppose we have $L_gL_fh(x) \neq 0$, then we can again IO linearize the system as:&lt;/p&gt;
$$
u = L_gL_f h(x)^{-1}[-L_f^2 h(x) + v]
$$&lt;p&gt;
and thus:
&lt;/p&gt;
$$
\ddot{y} = v
$$&lt;p&gt;
If we continue doing this, we will arrive at step $r$:
&lt;/p&gt;
$$
y^{(r)} = L_f^rh(x) +L_gL_f^{r-1}h(x)u
$$&lt;p&gt;
And if we have $L_gL_f^{r-1}h(x) \neq 0$, we can make it such that:
&lt;/p&gt;
$$
u = L_gL_f^{r-1}h(x)^{-1}[-L_f^r h(x) + v]
$$&lt;p&gt;
and therefore
&lt;/p&gt;
$$
y^{r} = v
$$&lt;p&gt;
In this case, the IO linearized system is a $r^{th}$ order linear system.&lt;/p&gt;
&lt;p&gt;We now give the definition of $r$:&lt;/p&gt;
&lt;p&gt;A SISO system $\dot{x} = f(x) + g(x)u, y = h(x)$ has &lt;strong&gt;relative degree&lt;/strong&gt; $r$ with respect to the output $y = h(x)$ around $x_0$ if:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;$\forall 0 \le k &amp;lt; r-1$, $L_gL_f^kh(x) = 0$, $\forall x \in $ neighborhood of $x_0$.&lt;/li&gt;
&lt;li&gt;$L_gL_f^{r-1}h(x) \neq 0$, $\forall x \in $ neighborhood of $x_0$.
Let&amp;rsquo;s look at some examples.&lt;/li&gt;
&lt;/ol&gt;
$$
\begin{align}
\dot{x}_1 &amp;= x_2 \\
\dot{x}_2 &amp;= -x_1^3 + u \\
y &amp;= x_1
\end{align}
$$&lt;p&gt;
It&amp;rsquo;s obvious that the relative degree is not 0 because $u$ doesn&amp;rsquo;t show up directly in $y$. We take the first derivative of $y$:
&lt;/p&gt;
$$ \dot{y} = x_2$$&lt;p&gt;
Still no $u$. Differentiate again:
&lt;/p&gt;
$$ \ddot{y}= -x_1^3 + u$$&lt;p&gt;
Now $u$ shows up, therefore the relative degree of $y$ is 2.
Note that the coefficient of $u$ is always a well-defined 1, therefore output $y$ always has relative degree of 2 anywhere in $\mathbb{R}$.&lt;/p&gt;
$$
\begin{align}
\dot{x}_1 &amp;= x_2 + x_3^3 \\
\dot{x}_2 &amp;= x_3 \\
\dot{x}_3 &amp;= u \\
y &amp;= x_1
\end{align}
$$&lt;p&gt;
We differentiate $y$ twice:
&lt;/p&gt;
$$
\ddot{y} = x_3 + 3x_3 u
$$&lt;p&gt;
Now we realize that $y$ doesn&amp;rsquo;t have a well-defined degree around $x_3 = 0$, and has a relative degree of 2 anywhere else.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s try to apply the concept to our familiar linear system:
&lt;/p&gt;
$$
\begin{align}
\dot{x} &amp;= Ax + Bu \\
y &amp;= Cx
\end{align}
$$&lt;p&gt;
If we differentiate $y$:
&lt;/p&gt;
$$
\dot{y} = CAx + CBu
$$&lt;p&gt;
Now, if $CB = 0$, we&amp;rsquo;ll have to differentiate again:
&lt;/p&gt;
$$
\ddot{y} = CA^2x + CAB u
$$&lt;p&gt;
continue doing this, we have relative degree $r$ if&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;$ CB = CAB = \ldots = CA^{r-2}B = 0$&lt;/li&gt;
&lt;li&gt;$ CA^{r-1}B \neq 0$&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Isn&amp;rsquo;t the quantity $CA^{r-1}B$ familiar? It&amp;rsquo;s a composite of the controllability matrix and observability matrix. In fact, this conclusion leads directly to the concept of &lt;a class="link" href="https://en.wikipedia.org/wiki/Kalman_decomposition" target="_blank" rel="noopener"
 &gt;Kalman decomposition&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="zero-dynamics"&gt;Zero Dynamics
&lt;/h2&gt;&lt;p&gt;A fact regarding the relative degree $r$:&lt;/p&gt;

 &lt;blockquote&gt;
 &lt;p&gt;$r$ is always less than or equal to the order of the system $n$, and cannot be greater than $n$. If we keep differentiating without getting $u$ show up in $y$, the relative degree is usually undefined.&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;p&gt;Now, for the IO linearized system $y^{(r)} = v$, we can choose the state vector:&lt;/p&gt;
$$ 
z = \begin{pmatrix} 
y \\
\dot{y} \\
\vdots \\
y^{(r-1)}
\end{pmatrix} \in \mathbb{R}^r
$$&lt;p&gt;
Thus, we will arrive at:
&lt;/p&gt;
$$
\dot{z} = \begin{pmatrix}
 0 &amp; 1 &amp; 0 &amp; \cdots &amp; 0 \\
 0 &amp; 0 &amp; 1 &amp; \cdots &amp; 0 \\
 \vdots &amp; \vdots &amp; \vdots &amp; \ddots &amp; \vdots \\
 0 &amp; 0 &amp; 0 &amp; \cdots &amp; 1 \\
 0 &amp; 0 &amp; 0 &amp; \cdots &amp; 0 
\end{pmatrix} z + \begin{pmatrix}
 0 \\
 0 \\
 \vdots \\
 0 \\
 1 
\end{pmatrix} v
$$&lt;p&gt;
If you have read another article of mine: &lt;a class="link" href="http://blog.cedard.top/p/masons-gain-formula/" &gt;Mason&amp;rsquo;s Gain Formula and Control Canonical Forms&lt;/a&gt;, you&amp;rsquo;ll realize system follows the controllability canonical form, thus $z$ is always controllable, given matrix $A$ is a complete Jordan block. Therefore, we can always define a feedback control mechanism
&lt;/p&gt;
$$ v = -Kz$$&lt;p&gt;
such that
&lt;/p&gt;
$$ \dot{z} = (A - BK)z $$&lt;p&gt;
is always stable, or &lt;/p&gt;
$$\Re(\lambda(A - BK)) &lt; 0$$&lt;p&gt;
If we convert $v$ back in terms of $x$, we will get
&lt;/p&gt;
$$ v = -k_1 h(x) - k_2 L_f h(x) - \ldots - k_r L_f^{r-1} h(x) $$&lt;p&gt;
Now that if we have $z(t) \to 0$ as $ t \to \infty$, $y \to 0$, $\dot{y} \to 0$, etc. We can guarantee the output $y$ is stable. But, how about $x$? Is the original system stable? This leads to the discussion of &lt;strong&gt;zero dynamics&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If we define the set $Z = {x \in \mathbb{R}^n : h(x) = \dot{h}(x) = \ldots = h^{(r-1)}(x) = 0}$, then $Z$ is called the &lt;strong&gt;zero dynamics&lt;/strong&gt; of the system. It stands for the part of the system where it&amp;rsquo;s not shown explicitly on the output $y$, or it&amp;rsquo;s unobservable.&lt;/p&gt;
&lt;p&gt;Note that the dimension of the zero dynamics set is $n - r$.&lt;/p&gt;
&lt;p&gt;What we did for IO linearization are the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;We construct the surface $Z$ with dimension $n - r$.&lt;/li&gt;
&lt;li&gt;We make $Z$ attractive, i.e. we let $x$ approach the surface asymptotically.&lt;/li&gt;
&lt;li&gt;We also make $Z$ invariant, i.e. $x$ never leaves the surface once it&amp;rsquo;s on the surface.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;However, whether the dynamics &lt;em&gt;on&lt;/em&gt; the surface is stable dictates whether the original system $x$ is stable. The dynamic on the surface is also known as the &lt;strong&gt;zero dynamics&lt;/strong&gt;.
Let&amp;rsquo;s take an example to illustrate the zero dynamics. Consider the following system:
&lt;/p&gt;
$$
\begin{align}
\dot{x}_1 &amp;= x_2 \\
\dot{x}_2 &amp;= \alpha x_3 + u \\
\dot{x}_3 &amp;= \beta x_3 - u \\
y &amp;= x_1
\end{align}
$$&lt;p&gt;
It&amp;rsquo;s easy to get relative degree of 2 for output $y$ because
&lt;/p&gt;
$$
\ddot{y} = \alpha x_3 + u
$$&lt;p&gt;
Now, suppose when $t \to \infty$, both $y$ and $\dot{y}$ approach zero. What happens to the state $x$?
If $y = 0, \dot{y} = 0$, then $x_1 = x_2 = 0$, and we have
&lt;/p&gt;
$$ \dot{x}_3 = (\beta + \alpha) x_3 $$&lt;p&gt;
Therefore, the zero dynamic on $x_3$ is stable if and only if $\beta + \alpha &amp;lt; 0$.&lt;/p&gt;
&lt;p&gt;In fact, in this case $x_3$ is the uncontrollable state of the nonlinear system. Just like linear system theory, if the uncontrollable state is stable, the entire system can be stabilized.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;We discussed IO linearization in this article. In part 2, we are going to talk about actual feedback linearization.&lt;/p&gt;</description></item><item><title>Steady-state Error, part 1</title><link>http://blog.cedard.top/p/steady-state-error-1/</link><pubDate>Thu, 30 Apr 2026 22:09:36 +0800</pubDate><guid>http://blog.cedard.top/p/steady-state-error-1/</guid><description>&lt;p&gt;Before we resume talking about why adding a capacitor solves the step input problem without solving the ramp input problem, let&amp;rsquo;s review some basic knowledge from linear system.&lt;/p&gt;
&lt;h2 id="linear-system-basics"&gt;Linear System Basics
&lt;/h2&gt;&lt;h3 id="initial-value-theorem"&gt;Initial Value Theorem
&lt;/h3&gt;&lt;p&gt;For a function $f(t)$ and its Laplace transform $F(s)$, the initial value theorem states that
&lt;/p&gt;
$$
\lim_{t \to 0} f(t) = \lim_{s \to \infty} sF(s)
$$&lt;p&gt;.&lt;/p&gt;
&lt;h3 id="final-value-theorem"&gt;Final Value Theorem
&lt;/h3&gt;&lt;p&gt;For a function $f(t)$ and its Laplace transform $F(s)$, the final value theorem states that
&lt;/p&gt;
$$
\lim_{t \to \infty} f(t) = \lim_{s \to 0} sF(s)
$$&lt;p&gt;.&lt;/p&gt;
&lt;h3 id="types-of-inputs"&gt;Types of Inputs
&lt;/h3&gt;&lt;p&gt;There are a few basic types of inputs that we use to kickstart the system. Here is a summary table:&lt;/p&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Input Type&lt;/th&gt;
					&lt;th&gt;Time Domain Response $f(t)$&lt;/th&gt;
					&lt;th&gt;Laplace Transform $F(s)$&lt;/th&gt;
					&lt;th&gt;Order&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;Impulse&lt;/td&gt;
					&lt;td&gt;$\delta(t)$&lt;/td&gt;
					&lt;td&gt;1&lt;/td&gt;
					&lt;td&gt;undefined&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;Step&lt;/td&gt;
					&lt;td&gt;$u(t)$&lt;/td&gt;
					&lt;td&gt;$\displaystyle\frac{1}{s}$&lt;/td&gt;
					&lt;td&gt;0&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;Ramp&lt;/td&gt;
					&lt;td&gt;$t \cdot u(t)$&lt;/td&gt;
					&lt;td&gt;$\displaystyle\frac{1}{s^2}$&lt;/td&gt;
					&lt;td&gt;1&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;Parabolic&lt;/td&gt;
					&lt;td&gt;$\displaystyle \frac{t^2}{2} \cdot u(t)$&lt;/td&gt;
					&lt;td&gt;$\displaystyle\frac{1}{s^3}$&lt;/td&gt;
					&lt;td&gt;2&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&amp;hellip;&lt;/td&gt;
					&lt;td&gt;&amp;hellip;&lt;/td&gt;
					&lt;td&gt;&amp;hellip;&lt;/td&gt;
					&lt;td&gt;&amp;hellip;&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id="unity-feedback-system"&gt;Unity Feedback System
&lt;/h3&gt;&lt;p&gt;We call the following system a &lt;strong&gt;Unity-Feedback System&lt;/strong&gt;, if the feedback path has a gain of 1.&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="814px" data-flex-grow="339" height="162" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/steady-state-error-1/math20260430222208.png" width="550"&gt;&lt;/p&gt;
&lt;h2 id="system-types"&gt;System Types
&lt;/h2&gt;&lt;p&gt;For a unity feedback system, we assume the controller has a transfer function that looks like:&lt;/p&gt;
$$ \displaystyle H(s) = \frac{K(s-z_1)(s-z_2)\cdots(s-z_m)}{s^k(s-p_1)(s-p_2)\cdots(s-p_n)} $$&lt;p&gt;That is, the controller has $m$ zeros, $n+k$ poles where $k$ poles are at the origin. To satisfy stability, $m &amp;lt; n+k$ otherwise the transfer function will not be a &lt;strong&gt;proper transfer function&lt;/strong&gt;.&lt;/p&gt;

 &lt;blockquote&gt;
 &lt;p&gt;We define the &lt;strong&gt;type&lt;/strong&gt; of the system as the number of pure integrators in $H(s)$. In our definition of $H(s)$, the type is $k$.&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;p&gt;Now, if we sub $H(s)$ into the unity feedback system, using Mason&amp;rsquo;s Gain Formula, we have the closed-loop transfer function of the overall system:&lt;/p&gt;
$$
\begin{align}
\displaystyle H_{cl}(s) &amp;= \frac{H(s)}{1 + H(s)} \\
&amp;= \frac{K(s-z_1)(s-z_2)\cdots(s-z_m)}{s^k(s-p_1)(s-p_2)\cdots(s-p_n) + K(s-z_1)(s-z_2)\cdots(s-z_m)}
\end{align}
$$&lt;p&gt;Therefore the transfer function of the steady-state error is given by:
&lt;/p&gt;
$$
\begin{align}
E(s) &amp;= 1 - H_{cl}(s) \\
&amp;= \frac{1}{1 + H(s)} \\
&amp;= \frac{s^k(s-p_1)(s-p_2)\cdots(s-p_n)}{s^k(s-p_1)(s-p_2)\cdots(s-p_n) + K(s-z_1)(s-z_2)\cdots(s-z_m)}
\end{align}
$$&lt;p&gt;
Now, let&amp;rsquo;s say if our input is type-N:
&lt;/p&gt;
$$
\begin{align}
F(s) &amp;= \frac{1}{s^{N+1}}
\end{align}
$$&lt;p&gt;
Then the resulting steady-state error is going to be:
&lt;/p&gt;
$$
\begin{align}
e(s) &amp;= E(s) \cdot F(s) \\
&amp;= \frac{s^{k-N-1}(s-p_1)(s-p_2)\cdots(s-p_n)}{s^k(s-p_1)(s-p_2)\cdots(s-p_n) + K(s-z_1)(s-z_2)\cdots(s-z_m)}
\end{align}
$$&lt;p&gt;
If we apply final value theorem, we get
&lt;/p&gt;
$$
\begin{align}
\lim_{t \to \infty} e(t) &amp;= \lim_{s \to 0} s \cdot e(s)
&amp;=\frac{s^{k-N}(s-p_1)(s-p_2)\cdots(s-p_n)}{s^k(s-p_1)(s-p_2)\cdots(s-p_n) + K(s-z_1)(s-z_2)\cdots(s-z_m)} 
\end{align}
$$&lt;p&gt;
It&amp;rsquo;s not too hard to see that the term of interest is $s^{k-N}$. We conclude therefore:
&lt;/p&gt;
$$
\begin{cases}
\lim_{t \to \infty} e(t) = 0 &amp; \text{if } k &gt; N \\
\lim_{t \to \infty} e(t) = \frac{1}{K} &amp; \text{if } k = N \\
\lim_{t \to \infty} e(t) = \infty &amp; \text{if } k &lt; N
\end{cases}
$$&lt;p&gt;
This is a pretty elegant result, in other words, the convergence of steady state error follows such conditions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;If the system type (k) is greater than the input type (N), the steady-state error is zero.&lt;/li&gt;
&lt;li&gt;If the system type (k) is smaller than the input type (N), the steady-state error will diverge to infinity.&lt;/li&gt;
&lt;li&gt;If the system type and input type are the same, the steady state error will converge to a non-zero number, which will be a finite fraction of the input, depending on the DC gain of the system.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Another intuitive way to look into this is that, if our input is of a higher system and the system itself can&amp;rsquo;t generate fast enough response, the system will always fall behind the input, and vice versa.&lt;/p&gt;
&lt;h2 id="the-problems-with-higher-order-system"&gt;The problems with higher order system
&lt;/h2&gt;&lt;p&gt;Now if we take the original system we discussed last time when we added a capacitor, we realize that adding that capacitor helped us to increase the system type, and thus we are able to track the input better.&lt;/p&gt;
&lt;p&gt;Here is the further question: what if the input is of type 2? Based off our discussion just now, we might just want to add another integrator so as to further increase the system type, like below:&lt;/p&gt;
&lt;p&gt;&lt;img alt="type2_system" class="gallery-image" data-flex-basis="614px" data-flex-grow="255" height="468" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/steady-state-error-1/mathtype2_system.png" srcset="http://blog.cedard.top/p/steady-state-error-1/mathtype2_system_hu_a57418f0f26f15b7.png 800w, http://blog.cedard.top/p/steady-state-error-1/mathtype2_system.png 1198w" width="1198"&gt;&lt;/p&gt;
&lt;p&gt;This makes plausible sense; however this system will unfortunately fail. Why? Let&amp;rsquo;s try to simplify the system by assuming $g_m = 1$ and $C=1$. If we perturb our system by a step input, according to our discussion above, the system should be able to track it without problem. First, the open loop gain is given by:
&lt;/p&gt;
$$
H_{ol} = \frac{1}{s^2}
$$&lt;p&gt;
Now, if we closed the loop and calculate the closed loop gain:
&lt;/p&gt;
$$
H_{cl} = \frac{1}{1 + H_{ol}(s)} = \frac{s^2}{1+s^2}
$$&lt;p&gt;
With a step input, the output has a frequency domain representation of:
&lt;/p&gt;
$$
V_{out}(s) = H_{cl} \cdot \frac{1}{s} = \frac{s}{1+s^2}
$$&lt;p&gt;
Now if we perform inverse laplace transform of the s-domain representation, we will get:
&lt;/p&gt;
$$ V_{out}(t) = \sin t$$&lt;p&gt;
That is to say, we increased the system type and we wished for the steady state error to converge faster, however the system is not even able to track a type-1 input, but start oscillating. What&amp;rsquo;s the problem here?&lt;/p&gt;
&lt;p&gt;The reason is that by introducing another pole, we introduced 90 degrees more input phase, and thus the effective &lt;strong&gt;phase margin&lt;/strong&gt; of the system is 0. From another angle, we can apply Barkhausen stability criterion and realize that the system automatically satisfies that criterion, and immediately realize that the system is oscillatory.&lt;/p&gt;
&lt;p&gt;The fix is to introduce &lt;strong&gt;damping&lt;/strong&gt; to either of the integrator to produce a zero in the forward gain, thus making the phase margin positive.&lt;/p&gt;
&lt;p&gt;&lt;img alt="type2_system_with_damping" class="gallery-image" data-flex-basis="614px" data-flex-grow="255" height="468" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/steady-state-error-1/mathtype2_system_with_damping.png" srcset="http://blog.cedard.top/p/steady-state-error-1/mathtype2_system_with_damping_hu_448f428f557d9bbe.png 800w, http://blog.cedard.top/p/steady-state-error-1/mathtype2_system_with_damping.png 1198w" width="1198"&gt;&lt;/p&gt;
&lt;p&gt;The derivation is left to our audience if you would like to give it a try.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;For the next part, we will further expand the damping concept and introduce a few compensation techniques we can use: lead, lag, and lead-lag compensation to improve the system response.&lt;/p&gt;</description></item><item><title>Mason's Gain Formula and Control Canonical Forms</title><link>http://blog.cedard.top/p/masons-gain-formula/</link><pubDate>Thu, 23 Apr 2026 00:28:37 +0800</pubDate><guid>http://blog.cedard.top/p/masons-gain-formula/</guid><description>&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;Pop quiz: what&amp;rsquo;s the transfer function $H(s) = V_{out} / V_{in}$ in the following circuit?&lt;/p&gt;
&lt;p&gt;Assumptions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;$C_c$ is a big coupling capacitor.&lt;/li&gt;
&lt;li&gt;No channel-length modulation.&lt;/li&gt;
&lt;li&gt;You don&amp;rsquo;t have to solve for DC, all small signal parameters are given. Don&amp;rsquo;t assume unspecified parameters, for example $r_o$, $C_g$, etc.&lt;/li&gt;
&lt;li&gt;The circuit is linear.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img alt="Weird Circuit" class="gallery-image" data-flex-basis="373px" data-flex-grow="155" height="367" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/masons-gain-formula/mathweird_circuit_re.png" width="571"&gt;&lt;/p&gt;
&lt;p&gt;OK this circuit does look a bit intimidating. For entry-level analog circuit class takers, they might take out pencil to work through the analysis, but it&amp;rsquo;s super tedious, time consuming and error-prone.&lt;/p&gt;
&lt;p&gt;Look at the circuit, what is the main reason that makes analysis difficult? Feedback. Not just one feedback path, there are two feedbacks from each of the two stages rendering the overall analysis not so straightforward. However, we are going to introduce a very elegant mathematical tool to deal with all these kinds of closed-loop structures.&lt;/p&gt;
&lt;h2 id="masons-gain-formula"&gt;Mason&amp;rsquo;s Gain Formula
&lt;/h2&gt;&lt;p&gt;Samuel Jefferson Mason was born in 1921. As a distinguished electronics engineer, his most famous scientific contributions are Mason&amp;rsquo;s invariant and Mason&amp;rsquo;s rule, or Mason&amp;rsquo;s gain formula, both named after him.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Samuel Jefferson Mason" class="gallery-image" data-flex-basis="167px" data-flex-grow="69" height="1147" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/masons-gain-formula/math20260423004040.png" width="800"&gt;&lt;/p&gt;
&lt;p&gt;Mason&amp;rsquo;s gain formula is used to find the transfer function of a closed-loop system. A closed loop system doesn&amp;rsquo;t need to contain only one loop; it could contain multiple loops, and they can even interact with each other. Conventional algebraic way to find the transfer function usually requires solving complex simultaneous systems, but Mason&amp;rsquo;s gain formula provides an easy way to find it.&lt;/p&gt;
&lt;p&gt;Mason&amp;rsquo;s gain formula is particularly suitable for a system that can be described using a Signal Flow Graph.&lt;/p&gt;
&lt;h3 id="signal-flow-graph-sfg"&gt;Signal Flow Graph (SFG)
&lt;/h3&gt;&lt;p&gt;A Signal Flow Graph (SFG) is a graphical representation of a system. As the name suggests, an SFG is a directed graph, meaning it has the following components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Node&lt;/strong&gt;: a node is a vertex that represents a variable in a system.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Branch&lt;/strong&gt;: a branch is a directed edge that represents a transfer function between two nodes. It has a linear gain. If the gain is 1, we don&amp;rsquo;t annotate it on the SFG.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Input/Output&lt;/strong&gt;: Input / Output nodes are special nodes where we use to denote the transfer function&amp;rsquo;s departure and arrival points.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Addition&lt;/strong&gt;: Two signals could be added together, given SFG is targeting linear systems.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img alt="Examples from Wikipedia" class="gallery-image" data-flex-basis="109px" data-flex-grow="45" height="2099" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/masons-gain-formula/math20260424174736.png" srcset="http://blog.cedard.top/p/masons-gain-formula/math20260424174736_hu_472ea900dde5566e.png 800w, http://blog.cedard.top/p/masons-gain-formula/math20260424174736.png 960w" width="960"&gt;&lt;/p&gt;
&lt;p&gt;Now, with these simple definitions, we are able to construct more complex notations + structures:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Path&lt;/strong&gt;: a path is a sequence of branches that connect nodes in the graph, such that no node is visited more than once.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Forward Path&lt;/strong&gt;: a forward path is a path from the input node to the output node.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Path Gain&lt;/strong&gt;: the product of the gains of all branches in a path.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Loop&lt;/strong&gt;: a loop is a path that starts and ends at the same node. A loop is a specific type of path.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Loop Gain&lt;/strong&gt;: the product of the gains of all branches in a loop.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="example-type-2-pll"&gt;Example: Type 2 PLL
&lt;/h4&gt;&lt;p&gt;Shown below is a type-2 PLL:
&lt;img alt="SFG_type2PLL" class="gallery-image" data-flex-basis="736px" data-flex-grow="306" height="134" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/masons-gain-formula/mathSFG_type2PLL.png" width="411"&gt;&lt;/p&gt;
&lt;p&gt;We are able to see 5 paths here and a simple loop. We defined 4 nodes, with 1 input node and 1 output node.&lt;/p&gt;
&lt;h3 id="the-formula"&gt;The Formula
&lt;/h3&gt;&lt;p&gt;Mason&amp;rsquo;s Gain Formula states the following:&lt;/p&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;Mason&amp;rsquo;s Gain Formula&lt;/strong&gt;:&lt;/p&gt;
$$H(s) = \frac{\sum_{k=1}^{N} P_k \Delta_k}{\Delta}$$&lt;p&gt;where:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;$N$ is the number of forward paths from input to output&lt;/li&gt;
&lt;li&gt;$P_k$ is the path gain of the $k$-th forward path&lt;/li&gt;
&lt;li&gt;$\Delta$ is the determinant of the system: $\Delta = 1 - \sum L_i + \sum L_i L_j - \sum L_i L_j L_k + \ldots$
&lt;ul&gt;
&lt;li&gt;$\sum L_i$ is the sum of all individual loop gains&lt;/li&gt;
&lt;li&gt;$\sum L_i L_j$ is the sum of products of all pairs of non-touching loops&lt;/li&gt;
&lt;li&gt;$\sum L_i L_j L_k$ is the sum of products of all triplets of non-touching loops&lt;/li&gt;
&lt;li&gt;and so on&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;$\Delta_k$ is the cofactor of the $k$-th forward path, obtained by removing all loops that touch the $k$-th path from $\Delta$&lt;/li&gt;
&lt;/ul&gt;

 &lt;/blockquote&gt;
&lt;h2 id="examples"&gt;Examples
&lt;/h2&gt;&lt;h3 id="a-type-2-charge-pump-pll"&gt;A Type 2 Charge Pump PLL
&lt;/h3&gt;&lt;p&gt;Let&amp;rsquo;s take the type-2 PLL system shown above for example.
&lt;img alt="SFG_type2PLL" class="gallery-image" data-flex-basis="736px" data-flex-grow="306" height="134" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/masons-gain-formula/mathSFG_type2PLL.png" width="411"&gt;
In this example, there is 1 single loop, and only 1 forward path from input to output. Therefore, $N=1$, and:&lt;/p&gt;
$$\begin{align}
\Delta &amp;= 1 - L_1 = 1 + K_{PFD}I_{CP}(R + 1/sC)K_{VCO}/s / N \\
\Delta_1 &amp;= 1 \\
\displaystyle \Sigma_{k=1}^{N}P_k \Delta_k &amp;= K_{PFD}I_{CP}(R + 1/sC)K_{VCO}/s
\end{align}$$&lt;p&gt;Bear in mind that $\Delta_1 = 1$ because there is only one loop, and it does touch the forward path, therefore we remove the only contributing loop gain from $\Delta$.&lt;/p&gt;
&lt;p&gt;Thus, combining the terms together, we have the expression for the closed loop gain:&lt;/p&gt;
$$
H(s) = \frac{K_{PFD}I_{CP}(R + 1/sC)K_{VCO}/s}{1 + K_{PFD}I_{CP}(R + 1/sC)K_{VCO}/s / N}
$$&lt;p&gt;We realize that the loop gain is large when frequency is low, the loop gain dominates and $H(s) = N$, meaning the low-frequency phase noise of the PLL will be the reference times $N^2$. At high frequency, the loop gain dies out and $H(s) = 0$. Therefore the reference to output phase transfer function is a low-pass filter.&lt;/p&gt;
&lt;h3 id="a-triple-integrator-system"&gt;A Triple Integrator System
&lt;/h3&gt;&lt;p&gt;Now, let&amp;rsquo;s compute the transfer function of the SISO system below:&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="413px" data-flex-grow="172" height="595" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/masons-gain-formula/math20260425005413.png" srcset="http://blog.cedard.top/p/masons-gain-formula/math20260425005413_hu_f68ca9a9560fdc0.png 800w, http://blog.cedard.top/p/masons-gain-formula/math20260425005413.png 1024w" width="1024"&gt;&lt;/p&gt;
&lt;p&gt;We notice that there are 3 loops and 3 forwarded paths. Luckily, they all touch each other, which makes our calculation very simple.&lt;/p&gt;
$$
\begin{cases}
\Delta = 1 + a_1/s + a_2/s^2 + a_3/s^3 \\
p_1 = b1/s \\
\Delta_1 = 1 \\
p_2 = b2/s^2 \\
\Delta_2 = 1 \\
p_3 = b3/s^3 \\
\Delta_3 = 1
\end{cases}
$$&lt;p&gt;
Combining all the terms, we have&lt;/p&gt;
$$ \begin{align}
H(s) &amp;= \frac{b_1/s + b_2/s^2 + b_3/s^3}{1 + a_1/s + a_2/s^2 + a_3/s^3} \\
&amp;= \frac{b_1 s^2 + b_2 s + b_3}{s^3 + a_1 s^2 + a_2 s + a_3}
\end{align}
$$&lt;h2 id="canonical-forms"&gt;Canonical Forms
&lt;/h2&gt;&lt;p&gt;Doesn&amp;rsquo;t the last example have a very regular transfer function? This is actually intended.&lt;/p&gt;
&lt;p&gt;In a control system modeled in time domain, we have our system defined using state-space model:
&lt;/p&gt;
$$
\begin{align}
\dot{x}(t) &amp;= Ax(t) + Bu(t) \\
y(t) &amp;= Cx(t)
\end{align}
$$&lt;p&gt;
and we know that, if we perform Laplace transform, while assuming a 0 initial condition, we have
&lt;/p&gt;
$$ sX(s) = AX(s) + BU(s) $$&lt;p&gt;
Therefore, by algebraic manipulation, we have
&lt;/p&gt;
$$ Y(s)/U(s) = C(sI - A)^{-1}B $$&lt;p&gt;
Which is the transformation between state space model to transfer functions.&lt;/p&gt;
&lt;p&gt;Now, there could be only one transfer function for a state space model, but there could be infinite state space models for one simple transfer function. The general rule of thumb is that, the number of poles in a transfer function regulates the number of states in the corresponding state space model, because we need that many number of integrators. However, we could create more states (but those come with either constraints, or are redundant, meaning linearly independent of the pre-existing states).&lt;/p&gt;
&lt;p&gt;There are some state space models that are different from generic ones, if we generate from a transfer function. Here are some of them:&lt;/p&gt;
&lt;h3 id="controllable-canonical-form"&gt;Controllable Canonical Form
&lt;/h3&gt;&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="320px" data-flex-grow="133" height="958" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/masons-gain-formula/math20260425010604.png" srcset="http://blog.cedard.top/p/masons-gain-formula/math20260425010604_hu_305b0b97de6ece2f.png 800w, http://blog.cedard.top/p/masons-gain-formula/math20260425010604.png 1280w" width="1280"&gt;&lt;/p&gt;
&lt;p&gt;We already encounter the controllable canonical form in the previous example.&lt;/p&gt;
&lt;p&gt;Controllable canonical form is a specific type of form because the generated state space model is always controllable. The state space model is given by:&lt;/p&gt;
$$
\begin{align}
\frac{d}{dt}X &amp;= \begin{pmatrix}
0 &amp; 1 &amp; 0 &amp; 0 &amp; \ldots &amp; 0 &amp; 0 \\
0 &amp; 0 &amp; 1 &amp; 0 &amp; \ldots &amp; 0 &amp; 0 \\
\vdots &amp; \vdots &amp; \vdots &amp; \vdots &amp; \ddots &amp; \vdots &amp; \vdots \\
0 &amp; 0 &amp; 0 &amp; 0 &amp; \ldots &amp; 1 &amp; 0 \\
-a_0 &amp; -a_1 &amp; -a_2 &amp; -a_3 &amp; \ldots &amp; -a_{n-1} &amp; -a_n
\end{pmatrix}X + \begin{pmatrix}
0 \\
0 \\
\vdots \\
0 \\
1
\end{pmatrix}U \\
Y &amp;= \begin{pmatrix}
b_0 &amp; b_1 &amp; b_2 &amp; \ldots &amp; b_n
\end{pmatrix}X
\end{align}
$$&lt;p&gt;According to Rudolf Kalman, the controllability matrix of the controllability canonical form is always going to be full rank. That&amp;rsquo;s why we call it controllable canonical form.&lt;/p&gt;
&lt;h3 id="observable-canonical-form"&gt;Observable Canonical Form
&lt;/h3&gt;&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="322px" data-flex-grow="134" height="926" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/masons-gain-formula/math20260425012014.png" srcset="http://blog.cedard.top/p/masons-gain-formula/math20260425012014_hu_988c968d4da85244.png 800w, http://blog.cedard.top/p/masons-gain-formula/math20260425012014.png 1244w" width="1244"&gt;
Observability, the dual of controllability, also has its canonical form. Its state space model representation is given by:&lt;/p&gt;
$$
\begin{align}
\frac{d}{dt}X &amp;= \begin{pmatrix}
0 &amp; 0 &amp; 0 &amp; \ldots &amp; 0 &amp; -a_0 \\
1 &amp; 0 &amp; 0 &amp; \ldots &amp; 0 &amp; -a_1 \\
0 &amp; 1 &amp; 0 &amp; \ldots &amp; 0 &amp; -a_2 \\
0 &amp; 0 &amp; 1 &amp; \ldots &amp; 0 &amp; -a_3 \\
\vdots &amp; \vdots &amp; \vdots &amp; \ddots &amp; \vdots &amp; \vdots \\
0 &amp; 0 &amp; 0 &amp; \ldots &amp; 1 &amp; -a_{n-1}
\end{pmatrix}X + \begin{pmatrix}
b_0 \\
b_1 \\
b_2 \\
b_3 \\
\vdots \\
b_{n-1}
\end{pmatrix}U \\
Y &amp;= \begin{pmatrix}
0 &amp; 0 &amp; 0 &amp; \ldots &amp; 0 &amp; 1
\end{pmatrix}X
\end{align}
$$&lt;p&gt;If you take a closer look, you&amp;rsquo;ll notice that the observable canonical form is precisely the transpose of the controllable canonical form: $A_o = A_c^T$, $B_o = C_c^T$, and $C_o = B_c^T$. This is not a coincidence — it is a direct manifestation of the duality between controllability and observability. Taking the transpose of a state space realization preserves the transfer function, since
&lt;/p&gt;
$$
H(s) = C(sI - A)^{-1}B = \left[ B^T (sI - A^T)^{-1} C^T \right]^T
$$&lt;p&gt;
and the transfer function is a scalar for SISO systems, so the transpose is itself.&lt;/p&gt;
&lt;p&gt;By the dual of Kalman&amp;rsquo;s argument, the observability matrix of the observable canonical form is always full rank, which is why we call it the observable canonical form. Notice as well that, unlike the controllable form where the input coefficients $b_i$ are placed in the output matrix $C$, here they show up directly in the input matrix $B$. Each state $x_i$ accumulates a weighted contribution from $u(t)$ and feeds back through $-a_i$ to drive only the last state, which is then read out at the output. Reading the SFG above from right to left makes the structure obvious: it is the controllable canonical form with all arrows reversed.&lt;/p&gt;
&lt;h3 id="diagonal-form-and-jordan-form"&gt;Diagonal Form and Jordan Form
&lt;/h3&gt;&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="302px" data-flex-grow="126" height="576" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/masons-gain-formula/math20260425012250.png" width="726"&gt;&lt;/p&gt;
&lt;p&gt;The controllable and observable canonical forms are built around the coefficients of the polynomials $a_i$ and $b_i$. The Jordan form takes a different approach: instead of starting from the polynomial coefficients, we start from the &lt;em&gt;poles&lt;/em&gt; of the transfer function. Performing partial fraction decomposition,&lt;/p&gt;
$$
H(s) = \frac{b_{n-1}s^{n-1} + \ldots + b_1 s + b_0}{(s - p_1)(s - p_2) \ldots (s - p_n)} = \sum_{i=1}^{n} \frac{r_i}{s - p_i}
$$&lt;p&gt;where $p_i$ are the poles and $r_i$ are the residues. Each first-order term $r_i/(s - p_i)$ corresponds to a single integrator with self-feedback $p_i$ and a gain $r_i$ at the output. The SFG above is exactly that — $n$ parallel branches, each with its own pole, all summed at the output.&lt;/p&gt;
&lt;p&gt;Stacking these parallel branches into a state space model gives the diagonal Jordan form (assuming distinct poles):&lt;/p&gt;
$$
\begin{align}
\frac{d}{dt}X &amp;= \begin{pmatrix}
p_1 &amp; 0 &amp; 0 &amp; \ldots &amp; 0 \\
0 &amp; p_2 &amp; 0 &amp; \ldots &amp; 0 \\
0 &amp; 0 &amp; p_3 &amp; \ldots &amp; 0 \\
\vdots &amp; \vdots &amp; \vdots &amp; \ddots &amp; \vdots \\
0 &amp; 0 &amp; 0 &amp; \ldots &amp; p_n
\end{pmatrix}X + \begin{pmatrix}
1 \\
1 \\
1 \\
\vdots \\
1
\end{pmatrix}U \\
Y &amp;= \begin{pmatrix}
r_1 &amp; r_2 &amp; r_3 &amp; \ldots &amp; r_n
\end{pmatrix}X
\end{align}
$$&lt;p&gt;Because $A$ is diagonal, the states are completely decoupled — each $x_i$ evolves independently as $\dot{x}_i = p_i x_i + u$, and the output is just a weighted sum of these modes. This makes the Jordan form particularly useful for analysis: the eigenvalues of $A$ are read off the diagonal, so stability is immediate (all $\text{Re}(p_i) &amp;lt; 0$), and each mode&amp;rsquo;s contribution to the output is exactly $r_i$.&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="327px" data-flex-grow="136" height="566" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/masons-gain-formula/math20260425012425.png" width="772"&gt;&lt;/p&gt;
&lt;p&gt;When poles are repeated, $A$ is no longer fully diagonalizable. For a pole $\lambda$ with multiplicity $k$, the corresponding diagonal block becomes a Jordan block:&lt;/p&gt;
$$
J_k(\lambda) = \begin{pmatrix}
\lambda &amp; 1 &amp; 0 &amp; \ldots &amp; 0 \\
0 &amp; \lambda &amp; 1 &amp; \ldots &amp; 0 \\
\vdots &amp; \vdots &amp; \ddots &amp; \ddots &amp; \vdots \\
0 &amp; 0 &amp; 0 &amp; \lambda &amp; 1 \\
0 &amp; 0 &amp; 0 &amp; 0 &amp; \lambda
\end{pmatrix}
$$&lt;p&gt;The superdiagonal of 1&amp;rsquo;s couples adjacent states within the block, which corresponds to terms of the form $r_{i,j}/(s - \lambda)^j$ in the partial fraction expansion. The overall $A$ matrix is still block-diagonal, with one Jordan block per distinct pole.&lt;/p&gt;
&lt;p&gt;Unlike the controllable and observable canonical forms — which are guaranteed to be controllable / observable by construction — the Jordan form is only controllable and observable when &lt;em&gt;all&lt;/em&gt; residues $r_i$ are nonzero and all poles are distinct. A zero residue corresponds to a pole-zero cancellation in $H(s)$, which means a mode that is either uncontrollable or unobservable (or both). In that sense, the Jordan form is the most honest of the three: it makes hidden modes visible rather than burying them in the structure.&lt;/p&gt;
&lt;h3 id="modified-form"&gt;Modified Form
&lt;/h3&gt;&lt;p&gt;It becomes even trickier if the original system&amp;rsquo;s poles are not on the real axis, but contains complex conjugate pairs. In this case, we can either sub in diagonal form with the complex entries, or we use what&amp;rsquo;s called the &amp;ldquo;modified form&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;modified Jordan form&lt;/strong&gt; (also known as the &lt;em&gt;real Jordan form&lt;/em&gt;) keeps the state space model entirely real-valued by replacing each pair of complex conjugate poles $p_i = \sigma \pm j\omega$ with a single $2 \times 2$ real block on the diagonal of $A$:&lt;/p&gt;
$$
\begin{pmatrix}
\sigma + j\omega &amp; 0 \\
0 &amp; \sigma - j\omega
\end{pmatrix} \quad \longrightarrow \quad \begin{pmatrix}
\sigma &amp; \omega \\
-\omega &amp; \sigma
\end{pmatrix}
$$&lt;p&gt;This block is similar to the diagonal complex form via the change of basis
&lt;/p&gt;
$$
T = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp; 1 \\ j &amp; -j \end{pmatrix},
$$&lt;p&gt;
so the transfer function is preserved. Concretely, for a system whose poles consist of $m$ real poles $\lambda_1, \ldots, \lambda_m$ and $\ell$ complex conjugate pairs $\sigma_k \pm j\omega_k$, the modified form is&lt;/p&gt;
$$
A = \begin{pmatrix}
\lambda_1 &amp; &amp; &amp; &amp; &amp; &amp; \\
&amp; \ddots &amp; &amp; &amp; &amp; &amp; \\
&amp; &amp; \lambda_m &amp; &amp; &amp; &amp; \\
&amp; &amp; &amp; \sigma_1 &amp; \omega_1 &amp; &amp; \\
&amp; &amp; &amp; -\omega_1 &amp; \sigma_1 &amp; &amp; \\
&amp; &amp; &amp; &amp; &amp; \ddots &amp; \\
&amp; &amp; &amp; &amp; &amp; &amp; \begin{smallmatrix} \sigma_\ell &amp; \omega_\ell \\ -\omega_\ell &amp; \sigma_\ell \end{smallmatrix}
\end{pmatrix}
$$&lt;p&gt;The eigenvalues of each $2 \times 2$ block are exactly $\sigma_k \pm j\omega_k$, so spectral information is unchanged — we have only traded a complex diagonal representation for a real block-diagonal one. This is the form most software packages return by default, since real arithmetic is cheaper and avoids the bookkeeping of conjugate pairs. Repeated complex poles generalize to real Jordan blocks by replacing each scalar entry of the complex Jordan block with the corresponding $2 \times 2$ real block, and each superdiagonal $1$ with a $2 \times 2$ identity.&lt;/p&gt;
&lt;h2 id="where-were-we"&gt;Where were we?
&lt;/h2&gt;&lt;p&gt;We talked a lot about the famous Mason&amp;rsquo;s gain formula, and several canonical forms that we can use to represent linear time-invariant systems. Now going back to the original question: what&amp;rsquo;s the closed loop gain of the original system?&lt;/p&gt;
&lt;p&gt;Well, we do realize that the system had two loops, but they do touch; and the system has only one forward path. That makes our computation significantly easier.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s use some notations here. Let&amp;rsquo;s denote the forward gain as $F_1, F_2$ and the loop gains as $L_1, L_2$. From basic analog circuit theory, we have:
&lt;/p&gt;
$$
\begin{align}
F_1 &amp;= -\frac{g_{m1}R_{d_1}}{1 + g_{m1}R_{d_1}||1/sC_1} \\
F_2 &amp;= \frac{g_{m2}R_{s2}}{1 + g_{m2}R_{s2}} \\
L_1 &amp;= (G_m R_{gate} || R_{g1} || R_{g2} F_1) \\
L_2 &amp;= (-g_{mp} R_{gate} || R_{g1} || R_{g2} ) F_1 F_2
\end{align}
$$&lt;p&gt;
And finally, our closed loop gain:&lt;/p&gt;
$$
\frac{V_{out}}{V_{in}}(s) = \frac{F_1F_2}{1 + L_1 + L_2}
$$&lt;p&gt;This looks a lot faster compared to manually breaking down all expressions.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;I would like to point out at the end of this article that the original circuit is unstable, because both loop gains are positive. Unless the loop determinant is strictly positive in real part, the circuit will be unstable.&lt;/p&gt;</description></item><item><title>Steady-state Error, part 0</title><link>http://blog.cedard.top/p/steady-state-error-0/</link><pubDate>Thu, 16 Apr 2026 22:08:25 +0800</pubDate><guid>http://blog.cedard.top/p/steady-state-error-0/</guid><description>&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;I started to have the very first question regarding &amp;ldquo;steady-state error&amp;rdquo; when I was a sophomore. I still recall the first class in EE2002: Analog Electronics when the professor introduced the very first Operational Amplifier, and here is what he said:&lt;/p&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&amp;ldquo;An Operational Amplifier, or an OpAmp, is a circuit that has infinite gain, infinite input impedance, and 0 output impedance.&amp;rdquo;&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;p&gt;I was very confused back then. Out from all the 3 properties, the most counterintuitive one was the &amp;ldquo;infinite gain&amp;rdquo; property. I can still understand the engineering approximation of infinite input impedance due to CMOS nature, and 0 output impedance if you treat the output as a current source, but infinite gain doesn&amp;rsquo;t make any sense. For the next few classes, I learned that infinite gain of the OpAmp allows feedback structure to kick in, so that it can provide a gain per the feedback impedance structure.&lt;/p&gt;
&lt;p&gt;&lt;img alt="unit buffer made from an ideal OpAmp" class="gallery-image" data-flex-basis="474px" data-flex-grow="197" height="92" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/steady-state-error-0/mathideal_opamp.png" width="182"&gt;&lt;/p&gt;
&lt;p&gt;However, I feel that something is off here but I can&amp;rsquo;t quite put my finger on it. I didn&amp;rsquo;t quite get the correct terminology until I turned into a junior when I was taking EE3019: Integrated Electronics when we were introduced feedback in a more well-defined way, and I become aware that there is a term called &amp;ldquo;steady-state error&amp;rdquo; that defines the difference between the desired settling value versus the actual settled value. I feel like, yes, this is the correct word I&amp;rsquo;ve been looking for.&lt;/p&gt;
&lt;p&gt;I came across this once again when I started my PhD and started to design what&amp;rsquo;s called &amp;ldquo;Phase-Locked Loops (PLLs)&amp;rdquo;, a specific feedback structure that&amp;rsquo;s used to amplify a clean clock. I came across two different terms now: &lt;em&gt;Type-1 and Type-2 PLLs&lt;/em&gt;. (I doubt whether a lot of PLL designers can actually tell the difference between the two). Interestingly enough, the textbook, nor the slides talk anything about why it&amp;rsquo;s named type-1 or type-2, as if it&amp;rsquo;s just a naming convention.&lt;/p&gt;
&lt;p&gt;I wasn&amp;rsquo;t 100% clear on this matter until I took MEC237: linear control where I was introduced the book: &lt;em&gt;Control System Engineering&lt;/em&gt; by Norman Nise, and looking into the book actually helped me understand the entire steady-state error theory.&lt;/p&gt;
&lt;h2 id="the-problem-setup"&gt;The Problem Setup
&lt;/h2&gt;&lt;p&gt;Let&amp;rsquo;s go back and give the problem intuition. Suppose we have an OpAmp, and we would like to use it as a voltage follower, so we configure it like it&amp;rsquo;s a unit buffer:&lt;/p&gt;
&lt;p&gt;&lt;img alt="ideal_opamp" class="gallery-image" data-flex-basis="474px" data-flex-grow="197" height="92" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/steady-state-error-0/mathideal_opamp.png" width="182"&gt;&lt;/p&gt;
&lt;p&gt;Elementary analog circuit professor will tell you that because an ideal OpAmp has infinite gain, and it will always make sure both inputs are equal to each other.
&lt;strong&gt;WRONG&lt;/strong&gt;.
There are at least two very hand-wavy explanation here:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The assumption of infinite gain is an idealization that doesn&amp;rsquo;t hold in practice.&lt;/li&gt;
&lt;li&gt;The infinite gain assumption also doesn&amp;rsquo;t explain why it will make two inputs equal to each other.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In reality, the OpAmp&amp;rsquo;s gain depends on the transconductance gain $g_m$ and the loading impedance $R$, and we define our open loop gain to be
&lt;/p&gt;
$$ A = g_m R$$&lt;p&gt;&lt;img alt="real_OTA" class="gallery-image" data-flex-basis="474px" data-flex-grow="197" height="92" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/steady-state-error-0/mathreal_OTA.png" width="182"&gt;&lt;/p&gt;
&lt;p&gt;For the OpAmp connected in the abovementioned way, the small signal relationship between the input and output is given by:&lt;/p&gt;
$$ V_{out} = A(V_+ - V_-) $$&lt;p&gt;where $V_+$ and $V_-$ are the voltages at the non-inverting and inverting inputs, respectively.&lt;/p&gt;
&lt;p&gt;Now we try to use that relationship to analyze the behavior of the unit buffer. We realize that here we have $V_- = V_{out}$, so solving the equation we have:&lt;/p&gt;
$$
 V_{out} = A(V_{in} - V_{out}) \\
 V_{out} = \frac{A}{1+A} V_{in}
$$&lt;p&gt;Now, if we find the transfer function from input to output, we identify&lt;/p&gt;
$$ H(s) = \frac{V_{out}(s)}{V_{in}(s)} = \frac{A}{1+A} \neq 1 $$&lt;p&gt;which basically means that the output is going to be just slightly smaller compared to the input.&lt;/p&gt;
&lt;p&gt;The reason we would like to make our amplifier to be infinite gain is that, if $A \to \infty$, we easily have&lt;/p&gt;
$$
H(s) = \lim_{A \to \infty} \frac{A}{1+A} = 1
$$&lt;p&gt;which means that the output will approach the input as the gain approaches infinity; otherwise there will be an error term between the real output versus the desired output, which is given by&lt;/p&gt;
$$ \begin{align}
\Delta V &amp;= V_{out,desired} - V_{out,real} \\
&amp;= V_{in} - V_{out,real} \\
&amp;= V_{in} - \frac{A}{1+A} V_{in} \\
&amp;= \frac{1}{1+A} V_{in}
\end{align}
$$&lt;p&gt;
We can conclude two things from this expression:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The error is inversely proportional to $(1+A)$. The larger the gain is, the smaller the error is. However, if the gain is finite, no matter what non-zero input we see, the output can never achieve the desired value.&lt;/li&gt;
&lt;li&gt;The larger the input voltage is, the larger the error is.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;We call the error value between the desired and actual output the &lt;strong&gt;steady-state error&lt;/strong&gt;. This phenomenon happens in closed-loop systems where we would like to control a control plant to approach a value that we want, in this example, the OpAmp is both a controller, a control plant and a detector.&lt;/p&gt;
&lt;p&gt;Now, the question becomes if we are able to reduce this error at all.&lt;/p&gt;
&lt;h2 id="the-temporary-elixir-a-capacitor"&gt;The Temporary Elixir: A Capacitor
&lt;/h2&gt;&lt;p&gt;The fix is surprisingly simple. We replace the resistor with a pure capacitor:&lt;/p&gt;
&lt;p&gt;&lt;img alt="gmC_integrator" class="gallery-image" data-flex-basis="474px" data-flex-grow="197" height="92" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/steady-state-error-0/mathgmC_integrator.png" width="182"&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s do a time-domain calculation here first. Let&amp;rsquo;s assume the output current of the $g_m$ cell is defined as $i$, then we have the relationship between $V_{out}$ and $i$:&lt;/p&gt;
$$
\begin{align}
i &amp;= g_m (V_{in} - V_{out}) \\
i &amp;= C\frac{dV_{out}}{dt}
\end{align}
$$&lt;p&gt;This ODE is not too hard to solve by hand. Assume a 0 initial condition on $V_{out}$, we have&lt;/p&gt;
$$
V_{out} = V_{in} (1 - e^{-\frac{g_m t}{C}})
$$&lt;p&gt;
&lt;img alt="step response" class="gallery-image" data-flex-basis="403px" data-flex-grow="168" height="1762" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/steady-state-error-0/math20260416232959.png" srcset="http://blog.cedard.top/p/steady-state-error-0/math20260416232959_hu_a59ede0fc133f055.png 800w, http://blog.cedard.top/p/steady-state-error-0/math20260416232959_hu_4af9ebfbf8f01a79.png 1600w, http://blog.cedard.top/p/steady-state-error-0/math20260416232959_hu_4b2431d191cd5b3c.png 2400w, http://blog.cedard.top/p/steady-state-error-0/math20260416232959.png 2964w" width="2964"&gt;&lt;/p&gt;
&lt;p&gt;The assumption that we had initial condition 0 is equivalent to say that, if we provide a step response at the input, the output looks like an exponential decay curve that gradually goes to the input voltage. If we let $t \to \infty$, then we can easily see that
&lt;/p&gt;
$$
\lim_{t \to \infty} V_{out} = V_{in}
$$&lt;p&gt;
Nothing too fancy here; however, let&amp;rsquo;s move one step further; how about it if my input is not a step function, but a ramp function?&lt;/p&gt;
&lt;h2 id="ramp-response"&gt;Ramp Response
&lt;/h2&gt;&lt;p&gt;Same circuit, but now my $V_{in} = t$. What happens to $V_{out}$?
The ODE now becomes:&lt;/p&gt;
$$
\begin{align}
V_{in}(t) &amp;= t \\
i &amp;= g_m (V_{in}(t) - V_{out}) \\
i &amp;= C\frac{dV_{out}}{dt}
\end{align}
$$&lt;p&gt;Again, we can solve the ODE system by direct integration. This gives us:
&lt;/p&gt;
$$
V_{out}(t) = t - \tau + \tau e^{-\frac{t}{\tau}}
$$&lt;p&gt;where $\tau = \frac{C}{g_m}$.&lt;/p&gt;
&lt;p&gt;Interestingly, if we now consider the steady-state error as a function of time, we have&lt;/p&gt;
$$
\begin{align}
e(t) &amp;= V_{in}(t) - V_{out}(t) \\
&amp;= t - (t - \tau + \tau e^{-\frac{t}{\tau}}) \\
&amp;= \tau - \tau e^{-\frac{t}{\tau}} \\
&amp;= \tau(1 - e^{-\frac{t}{\tau}})
\end{align}
$$&lt;p&gt;As $t \to \infty$, unfortunately the error doesn&amp;rsquo;t die out, which would be what we have seen for a step response case. We show the plotting here as well:&lt;/p&gt;
&lt;p&gt;&lt;img alt="ramp response" class="gallery-image" data-flex-basis="288px" data-flex-grow="120" height="3000" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://blog.cedard.top/p/steady-state-error-0/math20260416234125.png" srcset="http://blog.cedard.top/p/steady-state-error-0/math20260416234125_hu_5db1c83cca21ee7e.png 800w, http://blog.cedard.top/p/steady-state-error-0/math20260416234125_hu_43160745907aa458.png 1600w, http://blog.cedard.top/p/steady-state-error-0/math20260416234125_hu_c21e31fd571903b3.png 2400w, http://blog.cedard.top/p/steady-state-error-0/math20260416234125.png 3600w" width="3600"&gt;&lt;/p&gt;
&lt;p&gt;In fact, we will see in later parts of this series, step input is called a &amp;ldquo;type-0&amp;rdquo; input, and ramp input is called a &amp;ldquo;type-1&amp;rdquo; input. The original R-loaded OpAmp is called a &amp;ldquo;type-0&amp;rdquo; system, and the C-loaded improved OpAmp is called a &amp;ldquo;type-1&amp;rdquo; system.&lt;/p&gt;
&lt;p&gt;In the next section, we will introduce some very useful mathematics tool to help us analyze the system without solving the ODE every single time.&lt;/p&gt;</description></item></channel></rss>