Given a state space model of the following form,
$$
\dot{x} = A\,x + B\,u, \tag{1}
$$
$$
y = C\,x + D\,u. \tag{2}
$$
The openloop transfer function of this system can be found by taking the Laplace transform and assuming all initial conditions to be zero (such that $\mathcal{L}\{\dot{x}(t)\}$ can just be written as $s\,X(s)$). Doing this for equation $(1)$ yields,
$$
s\,X(s) = A\,X(s) + B\,U(s), \tag{3}
$$
which can be rewritten as,
$$
X(s) = (s\,I - A)^{-1} B\,U(s). \tag{4}
$$
Substituting this into equation $(2)$ and defining the openloop transfer function $G(s)$ as the ratio between output ($Y(s)$) and input ($U(s)$) yields,
$$
G(s) = C\,(s\,I - A)^{-1} B + D. \tag{5}
$$
In a normal block diagram representation the controller has as an input $r-y$, with $r$ the reference value you would like to have for $y$, and an output $u$, which would be the input to $G(s)$. For now $r$ can be set to zero, so the controller can be defined as the transfer function from $-y$ to $u$.
For an observer based controller ($L$ and $K$ such that $A-B\,K$ and $A-L\,C$ are Hurwitz) for a state space model we can write the following dynamics,
$$
u = -K\,\hat{x}, \tag{6}
$$
$$
\dot{x} = A\,x - B\,K\,\hat{x}, \tag{7}
$$
$$
\dot{\hat{x}} = A\,\hat{x} + B\,u + L(y - C\,\hat{x} - D\,u) = (A - B\,K - L\,C + L\,D\,K) \hat{x} + L\,y. \tag{8}
$$
Similar to equations $(1)$, $(2)$ and $(5)$, the transfer function of the controller $C(s)$, defined as the ratio of $U(s)$ and $-Y(s)$, can be found to be,
$$
C(s) = K\,(s\,I - A + B\,K + L\,C - L\,D\,K)^{-1} L. \tag{9}
$$
If you want to find the total openloop transfer function from "$-y$" to "$y$" you have to keep in mind that in general $G(s)$ and $C(s)$ are matrices of transfer functions, so the order of multiplication matters. Namely you first multiply the error ($r-y$) with the controller and then the plant, the openloop transfer function can be written as $G(s)\,C(s)$. The closedloop transfer function can then be found with,
$$
\frac{Y(s)}{R(s)} = (I + G(s)\,C(s))^{-1} G(s)\,C(s). \tag{10}
$$
It can also be found directly using equations $(2)$ and $(6)$, and the closedloop state space model dynamics,
$$
\begin{bmatrix}
\dot{x} \\ \dot{\hat{x}}
\end{bmatrix} = \begin{bmatrix}
A & -B\,K \\
L\,C & A - B\,K - L\,C
\end{bmatrix} \begin{bmatrix}
x \\ \hat{x}
\end{bmatrix} + \begin{bmatrix}
0 \\ -L
\end{bmatrix} r, \tag{11}
$$
$$
\frac{Y(s)}{R(s)} = \begin{bmatrix}
C & -D\,K
\end{bmatrix} \begin{bmatrix}
s\,I - A & B\,K \\
-L\,C & s\,I - A + B\,K + L\,C
\end{bmatrix}^{-1} \begin{bmatrix}
0 \\ -L
\end{bmatrix}. \tag{12}
$$
Well, when we have a transfer function that looks like:
$$\mathcal{T}:=\frac{\text{Y}\left(\text{s}\right)}{\text{X}\left(\text{s}\right)}=\frac{\text{G}\left(\text{s}\right)}{1+\text{G}\left(\text{s}\right)\text{H}\left(\text{s}\right)}\tag1$$
Where $\text{H}\left(\text{s}\right):=1$ because of the unity feedback and $\text{G}\left(\text{s}\right):=\text{K}\cdot\frac{1}{\text{s}-\alpha}$
We get a complete transfer function that looks like:
$$\mathcal{T}=\frac{\text{Y}\left(\text{s}\right)}{\text{X}\left(\text{s}\right)}=\frac{\text{K}\cdot\frac{1}{\text{s}-\alpha}}{1+\text{K}\cdot\frac{1}{\text{s}-\alpha}}\tag2$$
Now, for the poles and zeros:
- Poles:
$$1+\text{K}\cdot\frac{1}{\text{s}-\alpha}=0\space\Longleftrightarrow\space\text{s}=\alpha-\text{K}\tag3$$
- Zeros:
$$\text{K}\cdot\frac{1}{\text{s}-\alpha}=0\space\Longleftrightarrow\space\text{K}=0\tag4$$
For the settling-time we have that:
$$t\space_{2\text{%}}=-\frac{\ln\left(50\right)}{\lambda}\space\Longleftrightarrow\space\lambda=-\frac{\ln\left(50\right)}{t\space_{2\text{%}}}\tag5$$
We need to use:
$$\text{s}=\lambda+\omega\text{j}\tag6$$
Where $\lambda\space\wedge\space\omega\in\mathbb{R}$ and $\text{j}^2=-1$
Now, we need to solve for $\text{K}$ in the pole equation (assuming $\text{K}\ne0$):
$$1+\text{K}\cdot\frac{1}{\left(-\frac{\ln\left(50\right)}{t\space_{2\text{%}}}+\omega\text{j}\right)-\alpha}=0+0\text{j}\space\Longleftrightarrow\space\text{K}=\alpha+\frac{\ln\left(50\right)}{t\space_{2\text{%}}}\space\space\space\wedge\space\space\space\omega=0\tag7$$
Conclusion, we get a transfer function that looks like:
$$\color{red}{\mathcal{T}=\frac{\text{Y}\left(\text{s}\right)}{\text{X}\left(\text{s}\right)}=\frac{\alpha\cdot t\space_{2\text{%}}+\ln\left(50\right)}{\text{s}\cdot t\space_{2\text{%}}+\ln\left(50\right)}}\tag8$$
Best Answer
For tracking of periodic references you can make use of the internal model principle. Your plant is:
$$ \begin{align} \dot{x} &= A x + B u \newline y &= C x \end{align} $$
with
$$ \begin{align} A &= \begin{bmatrix} 0 & 1 \newline -b & 0 \end{bmatrix}, B = \begin{bmatrix} 0 \newline a \end{bmatrix}, C = \begin{bmatrix} 1 & 0 \end{bmatrix} \newline x &= \begin{bmatrix} x_1 \newline x_2 \end{bmatrix} = \begin{bmatrix} r \newline v \end{bmatrix} \newline y &= x_1 = r \end{align} $$
By the internal model principle you should use the information about your reference signal in the controller. You can do that by using the following controller dynamics:
$$ \begin{align} \dot{x}_c &= A_c x_c + B_c e \newline y_c &= C_c x_c \end{align} $$
with $\omega_0 = 2 \pi f_0$ (the frequency of your reference signal),
$$ \begin{align} A_c &= \begin{bmatrix} 0 & 1 \newline -\omega_0^2 & 0 \end{bmatrix} , B_c = \begin{bmatrix} 0 \newline \omega_0 \end{bmatrix}, C_c = \begin{bmatrix} 1 & 0 \newline 0 & 1 \end{bmatrix} \newline x_c &= \begin{bmatrix} x_{c,1} \newline x_{c,2} \end{bmatrix} \newline e &= r_{ref} - y \end{align} $$
Finally let $u = -(K x + K_c y_c)$ where $K = \begin{bmatrix} k_1 & k_2 \end{bmatrix}$ and $K_c = \begin{bmatrix} k_{c,1} & k_{c,2} \end{bmatrix}$. Put everything together:
$$ \begin{align} \dot{z} &= A_z z + B_z u + B_r r_{ref} \newline y &= C_z z \end{align} $$
with
$$ \begin{align} A_z &= \begin{bmatrix} A & 0 \newline -B_c C & A_c \end{bmatrix}, B_z = \begin{bmatrix} B \newline 0 \end{bmatrix}, B_r = \begin{bmatrix} 0 \newline B_c \end{bmatrix}, C_z = \begin{bmatrix} C & 0 \end{bmatrix} \newline z &= \begin{bmatrix} z_1 \newline z_2 \newline z_3 \newline z_4 \end{bmatrix} = \begin{bmatrix} x_1 \newline x_2 \newline x_{c,1} \newline x_{c,2} \end{bmatrix} \newline u &= -K_z z \newline y &= z_1 = r \end{align} $$
Design a controller matrix $K_z = \begin{bmatrix} K & K_c \end{bmatrix} = \begin{bmatrix} k_1 & k_2 & k_{c,1} & k_{c,2} \end{bmatrix}$ for $(A_z, B_z)$, for example with LQR. This will give you the open loop transfer function from $r_{ref}$ to $y$:
$$ G_o(s) = \frac{b_1 s + b_0}{s^4 + a_3 s^3 + a_2 s^2 + a_1 s + a_0} $$
and
$$ \begin{align} b_1 &= a k_{c,2} \omega_0 \newline b_0 &= -a k_{c,1} \omega_0 \newline a_3 &= a k_2 \newline a_2 &= \omega_0^2 + b + a k_1 \newline a_1 &= a k_2 \omega_0^2 \newline a_0 &= \omega_0^2 (b + a k_1) \end{align} $$ And the closed loop transfer function $G_{cl} = G_o/(1 + G_o)$.
We can now insert values: $a = 4, b = 6, f_0 = 0.1$. I use the following weight matrices for the LQR design:
$$ Q = \begin{bmatrix} 1 & 0 & 0 & 0 \newline 0 & 1 & 0 & 0 \newline 0 & 0 & 1 & 0 \newline 0 & 0 & 0 & 1 \end{bmatrix}, R = 1 $$
That gives me $K_z = \begin{bmatrix} 0.9789 & 1.2204 & 0.0466 & -1.8782\end{bmatrix}$ using the Matlab
lqr
function. The overall open loop transfer function is$$ G_o(s) = \frac{4.72 s - 0.1171}{s^4 + 4.882 s^3 + 10.31 s^2 + 6.648 s + 3.797} $$
which has a gain margin of $20$ dB and a phase margin of $65.7^\circ$. Finally, we can look at the tracking performance:
You can see that both $r_{ref}$ and $v_{ref}$ are tracked successfully, with the error converging asymptotically to zero and the control input $u$ is in the allowed interval of $-2 \leq u \leq 2$. Of course that also depends on the amplitude of your reference signal, if it gets larger, $u$ will also get larger so this gives you a limit on how large the amplitudes of your reference signal can be.