\documentclass[12pt]{article}
\usepackage{latexsym}
\usepackage{graphicx}
\usepackage[hypertex]{hyperref}
\usepackage{epsfig}
\usepackage{subfigure}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{mathrsfs}
\usepackage{cases}
\usepackage{array}
\renewcommand{\baselinestretch}{1.12}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textwidth}{6.5in}
\setlength{\topmargin}{0in}
\setlength{\textheight}{8.5in}
%\input setbmp
%\input{psfig.sty}
\usepackage{epsfig}
\newtheorem{defn}{Definition}
\newtheorem{thm}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{example}{Example}
\newtheorem{corollary}{Corollary}
\newtheorem{proposition}{Proposition}
\newtheorem{algorithm}{Algorithm}
\newtheorem{exercise}{Exercise}
%\usepackage[centertags]{amsmath}
\newcommand{\markex}{\nopagebreak\begin{center}\rule{5in}{.01in}\end{center}}
\newcommand{\markdefn}{\nopagebreak\hfill$\Diamond$}
\newcommand{\mb}{\mbox}
\newcommand{\bm}{\boldmath}
\def\b#1{\mb{\bm$#1$}}
\newfont{\Bb}{msbm10 scaled\magstep1}
\newfont{\Fr}{eufm10 scaled\magstep1}
\newfont{\Sc}{eusm10 scaled\magstep1}
%\pagestyle{empty}
\begin{document}
\noindent{\large ECE 602}\hfill{\Large Fall 2010}
\begin{center}
{\Large \bf State-Space Realization Examples}\\
by\\
{\large Stanislaw H. \.{Z}ak}
\end{center}
\bigskip
\begin{flushright}
%\parbox{5in}{Early amplifiers were made of crude materials that tended to disintegrate over use, causing the amp to ``run away.'' Not only would an aging relay amplify the phone signal, it would mistakenly compound any tiny deviation from the range it expected until the mushrooming error filled and killed the system. What was needed was Heron's {\it regula}, a counter signal to rein in the chief signal, to dampen the effect of the perpetual recycling. Black came up with a {\it negative} feedback loop, which was designated negative in contrast to the snowballing positive loop of the amplifier. Conceptually, the electrical negative feedback loop is a toilet flusher or thermostat. This braking circuit keeps the amplifier honed in on a steady amplification in the same way a thermostat hones in on a steady temperature. But instead of metallic levers, a weak train of electrons talks to itself.~\cite[page~116]{kelly94}}
\end{flushright}

\begin{example}\rm
We find a state-space realization of the transfer function matrix,
\begin{equation}
\b G(s)=\frac{1}{s^3+3s^2+2s}\left[\begin{array}{ccc}
s+1 & 2s^2+ s -1 & s^2 -1\\
-s^2 - s & -s^2 + s & s
\end{array}\right].
\label{eqn:twobythreetf}
\end{equation}
The above transfer function is strictly proper; therefore
 \[
 \b D=\b G(\infty) = \left[\begin{array}{ccc}
 0 & 0 & 0\\
 0 & 0 & 0
 \end{array}\right].
 \]
We proceed to represent $\b G(s)$ as
\begin{eqnarray*}
\b G(s) &=& \frac{1}{s^3+3s^2+2s}\left(\left[\begin{array}{ccc}
0 & 2 & 1\\
-1 & -1 & 0
\end{array}\right]s^2 + \left[\begin{array}{ccc}
1 & 1 & 0\\
-1 & 1 & 1
\end{array}\right]s + \left[\begin{array}{ccc}
1 & -1 & -1\\
0 & 0 & 0
\end{array}\right]
 \right)\\
 &=& \frac{1}{s^3+3s^2+2s}\left( \b N_2s^2 + \b N_1 s + \b N_0 \right).
\end{eqnarray*}
Using realization formulas found in the proof of Theorem~1, we obtain
\begin{eqnarray}
\b A &=& \left[\begin{array}{ccc}
\b O & \b I_3 & \b O\\
\b O & \b O & \b I_3\\
\b O & -2\b I_3 & -3\b I_3
\end{array}\right]\nonumber\\
&=& \left[\begin{array}{ccccccccccc}
0 & 0 & 0 & \vdots & 1 & 0 & 0 & \vdots & 0 & 0 & 0\\
0 & 0 & 0 & \vdots & 0 & 1 & 0 & \vdots & 0 & 0 & 0\\
0 & 0 & 0 & \vdots & 0 & 0 & 1 & \vdots & 0 & 0 & 0\\
\cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots\\
0 & 0 & 0 & \vdots & 0 & 0 & 0 & \vdots & 1 & 0 & 0\\
0 & 0 & 0 & \vdots & 0 & 0 & 0 & \vdots & 0 & 1 & 0\\
0 & 0 & 0 & \vdots & 0 & 0 & 0 & \vdots & 0 & 0 & 1\\
\cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots\\
0 & 0 & 0 & \vdots & -2 & 0 & 0 & \vdots & -3 & 0 & 0\\
0 & 0 & 0 & \vdots & 0 & -2 & 0 & \vdots & 0 & -3 & 0\\
0 & 0 & 0 & \vdots & 0 & 0 & -2 & \vdots & 0 & 0 & -3
\end{array}\right].
\label{eqn:amatfirstmeth}
\end{eqnarray}
The input matrix $\b B$ is
\begin{equation}
\b B=\left[\begin{array}{c}
\b O\\
\b O\\
\b I_3
\end{array}\right]=\left[\begin{array}{ccc}
0 & 0 & 0\\
0 & 0 & 0\\
0 & 0 & 0\\
\cdots & \cdots & \cdots\\
0 & 0 & 0\\
0 & 0 & 0\\
0 & 0 & 0\\
\cdots & \cdots & \cdots\\
1 & 0 & 0\\
0 & 1 & 0\\
0 & 0 & 1
\end{array}\right],
\label{eqn:bmatfmet}
\end{equation}
and the matrix $\b C$ has the form
\begin{equation}
\b C=\left[\begin{array}{ccc}
\b N_0 & \b N_1 & \b N_2
\end{array}\right]=\left[\begin{array}{ccccccccccc}
1 & -1 & -1 & \vdots & 1 & 1 & 0 & \vdots & 0 & 2 & 1\\
0 & 0 & 0 & \vdots & -1 & 1 & 1 & \vdots & -1 & -1 & 0
\end{array}\right].
\label{eqn:cmatfirme}
\end{equation}
The dimension of this realization is 9.
\end{example}
\markex

We can obtain another realization of $\b G(s)$ using Theorem~1. We begin by constructing a realization for $\b G(s)^{\top}$ using realization formulas from the proof of Theorem~1 to obtain
\begin{equation}
\b G(s)^{\top} = \tilde{\b C}(s \b I - \tilde{\b A})^{-1}\tilde{\b B} + \tilde{\b D} .
\label{eqn:realiz_gtrans_mimo}
\end{equation}
We next transpose both sides of~\eqref{eqn:realiz_gtrans_mimo} to obtain
\begin{eqnarray*}
\left(\b G(s)^{\top}\right)^{\top} &=& \b G(s)\\
&=& \left( \tilde{\b C}(s \b I - \tilde{\b A})^{-1}\tilde{\b B} + \tilde{\b D} \right)^{\top}\\
&=& \tilde{\b B}^{\top}\left(s \b I - \tilde{\b A}^{\top}  \right)^{-1}\tilde{\b C}^{\top} +\tilde{\b D}^{\top}.
\end{eqnarray*}
The resulting realization has the form
\begin{equation}
\left.\begin{array}{lll}
\dot{\tilde{\b x}} &=& \left[\begin{array}{cccccc}
\b O & \b O & \b O &\cdots & \b O & -\alpha_0 \b I_p\\
\b I_p & \b O & \b I_m & \cdots & \b O & -\alpha_1 \b I_p\\
\vdots & \vdots & \vdots & \ddots & \vdots &\vdots \\
\b O & \b O & \b O & \cdots & \b O & -\alpha_{r-2} \b I_p\\
\b O & \b O & \b O & \cdots & \b I_p & -\alpha_{r-1} \b I_m
\end{array}\right]\tilde{\b x} + \left[\begin{array}{c}
\b N_0\\
\b N_1\\
\vdots\\
\b N_{r-2}\\
\b N_{r-1}
\end{array}\right]\b u\\
\b y&=& \left[\begin{array}{cccccc}
\b O & \b O & \b O & \cdots & \b O & \b I_p
\end{array}\right]\tilde{\b x} + \b G(\infty)\b u .
\end{array}\right\}
\label{eq:anot_realiz_g}
\end{equation}
Note that although the realization~\eqref{eq:anot_realiz_g} is based on the realization found in the proof of Theorem~1, their dimensions will be different if $p\ne m$.
\begin{example}\rm
We use the above method to construct a state-space realization of the transfer function matrix given by~\eqref{eqn:twobythreetf}. We first apply realization formulas of Theorem~1 to $\b G(s)^{\top}$, where
\begin{eqnarray*}
\b G(s)^{\top} &=& \frac{1}{s^3+3s^2+2s}\left[\begin{array}{cc}
s+1 & -s^2 - s\\
2s^2+ s -1 & -s^2 + s\\
s^2 -1 & s
\end{array}\right]\\
&=& \frac{1}{s^3+3s^2+2s}\left(\left[\begin{array}{cc}
0 & -1\\
2 & -1\\
1 & 0
\end{array}\right] s^2 + \left[\begin{array}{cc}
1 & -1\\
1 & 1\\
0 & 1
\end{array}\right] s + \left[\begin{array}{cc}
1 & 0\\
-1 & 0\\
-1 & 0
\end{array}\right]\right)\\
&=& \frac{1}{s^3+3s^2+2s}\left( \b N_2^{\top}s^2 + \b N_1^{\top} s + \b N_0^{\top} \right).
\end{eqnarray*}
Applying to the above~\eqref{eq:anot_realiz_g}, we obtain another state-space realization of the transfer function~\eqref{eqn:twobythreetf}, where
\begin{eqnarray}
\hat{\b A} &=& \left[\begin{array}{ccc}
\b O & \b O & \b O\\
\b I_2 & \b O & -2\b I_2\\
\b O & \b I_2 & -3\b I_3
\end{array}\right]\nonumber\\
&=& \left[\begin{array}{cccccccc}
0 & 0 &  \vdots &  0 & 0 & \vdots &  0 & 0\\
 0 & 0 & \vdots & 0 & 0 & \vdots & 0 & 0\\
 \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots\\
1 & 0 & \vdots & 0 & 0  & \vdots & -2 & 0\\
0 & 1 & \vdots &  0 & 0 & \vdots &  0 & -2\\
\cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots\\
0 & 0 & \vdots & 1 & 0 & \vdots & -3 & 0 \\
 0 & 0 & \vdots & 0 & 1 & \vdots &  0 & -3
\end{array}\right].
\label{eqn:amatsectmeth}
\end{eqnarray}
The input matrix is
\begin{equation}
\hat{\b B} = \left[\begin{array}{c}
\b N_0\\
\b N_1\\
\b N_2
\end{array}\right]=\left[\begin{array}{ccc}
1 & -1 & -1\\
0 & 0 & 0\\
\cdots & \cdots & \cdots\\
1 & 1 & 0\\
-1 & 1 & 1\\
\cdots & \cdots & \cdots\\
0 & 2 & 1\\
-1 & -1 & 0
\end{array}\right],
\label{eqn:bmatsecmet}
\end{equation}
and the output matrix has the form
\begin{equation}
\hat{\b C}=\left[\begin{array}{ccc}
\b O & \b O & \b I_2
\end{array}\right]=\left[\begin{array}{cccccccc}
0 & 0 & \vdots & 0 & 0 & \vdots & 1 & 0\\
0 & 0 & \vdots & 0 & 0 & \vdots & 0 & 1
\end{array}\right].
\label{eqn:cmatsecme}
\end{equation}
The obtained realization is of lower dimension than the previous one. This does not mean that the alternative method will always yield lower dimension realizations than the first method.
\end{example}
\markex

We now present yet another method of constructing a state-space realization of a given transfer function matrix. This method is being used by the MATLAB's function \verb!tf2ss!. We begin by denoting the $i$-th column of a proper transfer function matrix $\b G(s)$ as $\b g_i(s)$. We observe that the input-output relation of an MIMO system can be expressed as
\begin{eqnarray*}
\b Y(s) &=& \b G(s) \b U(s)\\
&=& \b g_1(s) U_1(s) + \b g_2(s)U_2(s) + \cdots + \b g_m(s) U_m(s),
\end{eqnarray*}
where $U_i(s)$ is the $i$-th component of the input vector $\b U(s)$. We construct a state-space realization of each column $\b g_i(s)$ and then combine these realizations to obtain the state-space realization of $\b G(s)$ as follows. If the quadruple $(\b A_i, \b b_i, \b C_i, \b d_i)$ is the realization of $\b g_i(s)$, then a realization $(\b A,\b B,\b C, \b D)$ of $\b G(s)$ has the form,
\begin{equation}
\left.\begin{array}{lll}
\b A &=& \left[\begin{array}{cccc}
\b A_1 & \b O & \cdots & \b O\\
\b O & \b A_2 & \cdots & \b O\\
\vdots & \vdots & \ddots & \vdots\\
\b O & \b O & \cdots & \b A_m
\end{array}\right],\quad \b B=\left[\begin{array}{cccc}
\b b_1 & \b 0 & \cdots & \b 0\\
\b 0 & \b b_2 & \cdots & \b 0\\
\vdots & \vdots & \ddots & \vdots\\
\b 0 & \b 0 & \cdots & \b b_m
\end{array}\right],\\
 \b C &=& \left[\begin{array}{cccc}
\b C_1 & \b C_2 & \cdots & \b C_m
\end{array}\right], \quad\mb{and}\quad\b D=\left[\begin{array}{cccc}
\b d_1 & \b d_2 & \cdots & \b d_m
\end{array}\right].
\end{array}\right\}
\label{eqn:colbycolrael}
\end{equation}

%We can also use the row-by-row approach to construct a state-space-realization of a given transfer function matrix---see Exercise~\ref{ex:row-by-row_real}.

\begin{example}\rm
We use the column-by-column method to construct a realization of the transfer function matrix,
\begin{equation}
\b G(s)=\left[\begin{array}{cc}
\frac{1}{s+1} & \frac{2}{s+1}\\
\frac{-1}{s^2+3s+2} & \frac{1}{s+2}
\end{array}\right].
\label{eqn:fourone}
\end{equation}
This transfer function matrix is strictly proper, therefore
\[
\b D=\left[\begin{array}{cc}
0 & 0\\
0 & 0
\end{array}\right].
\]
There are two columns, that is,
\[
\b G(s)=\b g_1(s)+\b g_2(s)=\left[\begin{array}{c}
\frac{1}{s+1}\\
\frac{-1}{s^2+3s+2}
\end{array}\right]+\left[\begin{array}{c}
\frac{2}{s+1}\\
\frac{1}{s+2}
\end{array}\right].
\]
We apply the realization formulas from the proof of Theorem~1 to
\[
\b g_1(s)=\left[\begin{array}{c}
\frac{1}{s+1}\\
\frac{-1}{s^2+3s+2}
\end{array}\right]=\frac{1}{{s^2+3s+2}}\left[\begin{array}{c}
s+2\\
-1
\end{array}\right]=\left[\begin{array}{c}
1\\
0
\end{array}\right]s+\left[\begin{array}{c}
2\\
-1
\end{array}\right]=\b N_1 s + \b N_0.
\]
We obtain
\[
\b A_1=\left[\begin{array}{cc}
0 & 1\\
-2 & -3
\end{array}\right],\quad \b b_1=\left[\begin{array}{c}
0\\
1
\end{array}\right], \quad \b C_1=\left[\begin{array}{cc}
2 & 1\\
-1 & 0
\end{array}\right], \quad\b d_1=\left[\begin{array}{c}
0\\
0
\end{array}\right].
\]
We next concern ourselves with the second column of $\b G(s)$,
\[
\b g_2(s)=\left[\begin{array}{c}
\frac{2}{s+1}\\
\frac{1}{s+2}
\end{array}\right]=\frac{1}{{s^2+3s+2}}\left[\begin{array}{c}
2(s+2)\\
s+1
\end{array}\right]=\left[\begin{array}{c}
2\\
1
\end{array}\right]s+\left[\begin{array}{c}
4\\
1
\end{array}\right]=\b N_1 s + \b N_0.
\]
We apply realization formulas from the proof of Theorem~1 to obtain
\[
\b A_2=\left[\begin{array}{cc}
0 & 1\\
-2 & -3
\end{array}\right],\quad \b b_2=\left[\begin{array}{c}
0\\
1
\end{array}\right], \quad \b C_2=\left[\begin{array}{cc}
4 & 2\\
1 & 1
\end{array}\right], \quad\b d_2=\left[\begin{array}{c}
0\\
0
\end{array}\right].
\]
Combining the above realizations gives an overall realization of $\b G(s)$ of the form,
\begin{eqnarray*}
\b A &=&\left[\begin{array}{cc}
\b A_1 &\b O\\
\b O & \b A_2
\end{array}\right]=\left[\begin{array}{ccccc}
0 & 1 &\vdots & 0 & 0\\
-2 & -3 & \vdots & 0 & 0\\
\cdots & \cdots & \cdots & \cdots & \cdots\\
0 & 0 & \vdots & 0 & 1\\
0 & 0 & \vdots & -2 & -3
\end{array}\right], \quad \b B=\left[\begin{array}{cc}
\b b_1 &\b 0\\
\b 0 & \b b_2
\end{array}\right]=\left[\begin{array}{ccc}
0 &\vdots &  0\\
1 & \vdots & 0 \\
\cdots & \cdots \\
0 & \vdots & 0 \\
0 & \vdots & 1
\end{array}\right],\\
\b C &=& \left[\begin{array}{cc}
\b C_1 & \b C_2
\end{array}\right]= \left[\begin{array}{ccccc}
2 & 1 & \vdots & 4 & 2\\
-1 & 0 & \vdots & 1 & 1
\end{array}\right],\quad\mb{and}\quad \b D = \left[\begin{array}{cc}
\b d_1 & \b d_2
\end{array}\right]= \left[\begin{array}{ccc}
0 & \vdots & 0\\
0 & \vdots & 0
\end{array}\right].
\end{eqnarray*}
\end{example}
\markex

\begin{example}\rm
We now apply the method resulting in the state-space realization given by~\eqref{eq:anot_realiz_g} to the transfer function~\eqref{eqn:fourone} from the previous example. We begin by transposing $\b G(s)$ to obtain
\[
\b G(s)^{\top} = \left[\begin{array}{cc}
\frac{1}{s+1} & \frac{-1}{s^2 + 3 s + 2}\\
\frac{2}{s+1} & \frac{1}{s+2}
\end{array}\right]=\tilde{\b g}_1(s) + \tilde{\b g}_2(s) = \left[\begin{array}{c}
\frac{1}{s+1}\\
\frac{2}{s+1}
\end{array}\right]+\left[\begin{array}{c}
\frac{-1}{s^2 + 3 s + 2}\\
\frac{1}{s+2}
\end{array}\right].
\]
The column $\tilde{\b g}_1(s)$ can be represented as
\[
\tilde{\b g}_1(s)=\frac{1}{s+1}\left[\begin{array}{c}
1\\
2
\end{array}\right].
\]
Hence, we have one-dimensional realization of $\tilde{\b g}_1(s)$,
\begin{equation}
\tilde{\b A}_1=\left[\begin{array}{c}
-1
\end{array}\right],\quad \tilde{\b b}_1=\left[\begin{array}{c}
1
\end{array}\right], \quad \tilde{\b C}_1=\left[\begin{array}{c}
1\\
2
\end{array}\right], \quad\mb{nad}\quad \tilde{\b d}_1=\left[\begin{array}{c}
0\\
0
\end{array}\right].
\label{eqn:realgonetil}
\end{equation}
We then find a realization of $\tilde{\b g}_2(s)$, which we first represent as
\[
\tilde{\b g}_2(s)=\left[\begin{array}{c}
\frac{-1}{s^2 + 3 s + 2}\\
\frac{1}{s+2}
\end{array}\right]=\frac{1}{s^2 + 3 s + 2}\left[\begin{array}{c}
-1\\
s+1
\end{array}\right]=\left[\begin{array}{c}
0\\
1
\end{array}\right]s + \left[\begin{array}{c}
-1\\
1
\end{array}\right]=\tilde{\b N}_1 s + \tilde{\b N}_0.
\]
We obtain a second-order realization of $\tilde{\b g}_2(s)$, where
\begin{equation}
\tilde{\b A}_2=\left[\begin{array}{cc}
0 & 1\\
-2 & -3
\end{array}\right],\quad \tilde{\b b}_2=\left[\begin{array}{c}
0\\
1
\end{array}\right], \quad \tilde{\b C}_2=\left[\begin{array}{cc}
-1 & 0\\
1 & 1
\end{array}\right], \quad\mb{and}\quad \tilde{\b d}_2=\left[\begin{array}{c}
0\\
0
\end{array}\right].
\label{eqn:realgtwotil}
\end{equation}
Combining~\eqref{eqn:realgonetil} and~\eqref{eqn:realgtwotil} and applying the transposition operation we obtain a third-order realization of~\eqref{eqn:fourone},
\begin{eqnarray*}
\hat{\b A} &=& \left[\begin{array}{cc}
\tilde{\b A}_1 & \b 0\\
\b 0 & \tilde{\b A}_2
\end{array}\right]^{\top}=\left[\begin{array}{ccc}
-1 & 0 & 0\\
0 & 0 & -2\\
0 & 1 & -3
\end{array}\right],\quad \hat{\b B}=\left[\begin{array}{cc}
\tilde{\b C}_1 & \tilde{\b C}_2
\end{array}\right]^{\top}=\left[\begin{array}{cc}
1 & 2\\
-1 & 1\\
0 & 1
\end{array}\right],\\
\hat{\b C} &=& \left[\begin{array}{cc}
\tilde{\b b}_1 & 0\\
\b 0 & \tilde{\b b}_2
\end{array}\right]^{\top}=\left[\begin{array}{ccc}
1 & 0 & 0\\
0 & 0 & 1
\end{array}\right],\quad \hat{\b D}=\left[\begin{array}{cc}
\tilde{\b D}_1 & \tilde{\b D}_2
\end{array}\right]^{\top}=\left[\begin{array}{cc}
0 & 0\\
0 & 0
\end{array}\right].
\end{eqnarray*}
\end{example}
\markex


In the above examples, we obtained realizations of different dimensions for the same transfer function. A natural questions arises of how to find a minimal realization for a given transfer function matrix. To answer this question we need notions of controllability and observability. We will prove that a realization is minimal if and only if it is both reachable and observable.



%\bibliography{root2}
%\bibliographystyle{plain}
\end{document} 