I have a discrete time system
Suppose I have the following AB matrix of my system $$A = \begin{bmatrix} 0 & 1 \\ 1 & 1.5 \\ \end{bmatrix} $$
$$B = \begin{bmatrix} 0 \\ 1 \\ \end{bmatrix}$$
To design a state feedback stabilizer, I want relationship $$u = Kx$$
where K is my feedback gain, u is input to my discrete time system
To design this, use well known ackerman's formula as follows:
$$K = - \begin{bmatrix} 0 1 \end{bmatrix}*C^{-1}_{AB}*r(A)$$
where r(A) is my characteristic polynomial containing the pole I want to place
MATLAB directly calculates this using "acker" (and "place", but we will limit to one problem at a time)
But I keep on getting two different results and it is driving me crazy! I checked every single step!
Please help me to pin point the error in the following code:
%Approach 1: Raw formula
A = [0 1; 1 1.5]
B = [0 1]'
CAB = ctrb(A,B)
K1 = -1*[0 1]*inv(ctrb(A,B))*(A^2 - A + 0.25) %I wish to place the poles at {0.5, 0.5}
%Note (A^2 - A + 0.25) = (A - 0.5)(A - 0.5), the characteristic equation containing the two poles
%Approach 2: Using Build-in Acker
K2 = -1*acker(A,B,[0.5,0.5])
It is completely illogical to me why
K1 =
-1.2500 -0.7500
K2 =
-1.2500 -0.5000
I am using (in principle) identical way to calculate the K vector! Also note this error has never occurred to me in any previous designs before my system started blowing up all over.
Can someone who knows control theory pin point exactly what maybe the problem? MATLAB also contains bugs so that is something to be kept in mind.
Thanks