For the example of Eq. (E.7), we obtain the following results:
>> % Initial state space model from example above:
>> A = [-1/2, -1/3; 1, 0]; % state transition matrix
>> B = [1; 0];
>> C = [2-1/2, 3-1/3];
>> D = 1;
>>
>> eig(A) % find eigenvalues of state transition matrix A
ans =
-0.2500 + 0.5204i
-0.2500 - 0.5204i
>> roots(den) % find poles of transfer function H(z)
ans =
-0.2500 + 0.5204i
-0.2500 - 0.5204i
>> abs(roots(den)) % check stability while we're here
ans =
0.5774
0.5774
% The system is stable since each pole has magnitude < 1.
Our second-order example is already in real
form,
because it is only second order. However, to illustrate the
computations, let's obtain the eigenvectors and compute the
complex modal representation:
>> [E,L] = eig(A) % [Evects,Evals] = eig(A)
E =
-0.4507 - 0.2165i -0.4507 + 0.2165i
0 + 0.8660i 0 - 0.8660i
L =
-0.2500 + 0.5204i 0
0 -0.2500 - 0.5204i
>> A * E - E * L % should be zero (A * evect = eval * evect)
ans =
1.0e-016 *
0 + 0.2776i 0 - 0.2776i
0 0
% Now form the complete diagonalized state-space model (complex):
>> Ei = inv(E); % matrix inverse
>> Ab = Ei*A*E % new state transition matrix (diagonal)
Ab =
-0.2500 + 0.5204i 0.0000 + 0.0000i
-0.0000 -0.2500 - 0.5204i
>> Bb = Ei*B % vector routing input signal to internal modes
Bb =
-1.1094
-1.1094
>> Cb = C*E % vector taking mode linear combination to output
Cb =
-0.6760 + 1.9846i -0.6760 - 1.9846i
>> Db = D % feed-through term unchanged
Db =
1
% Verify that we still have the same transfer function:
>> [numb,denb] = ss2tf(Ab,Bb,Cb,Db)
numb =
1.0000 2.0000 + 0.0000i 3.0000 + 0.0000i
denb =
1.0000 0.5000 - 0.0000i 0.3333
>> num = [1, 2, 3]; % original numerator
>> norm(num-numb)
ans =
1.5543e-015
>> den = [1, 1/2, 1/3]; % original denominator
>> norm(den-denb)
ans =
1.3597e-016