Clear CLC Syms A (-1 1 0 0 0 0 - 1 1 0 0 0 0 - 1 0 0 0 0 0 - 1 1 0 0 0 0 - 1) B (0 0 0 0 A B 0 0 C D) P Length (A) R B

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

The code for problem 1 is as under:

% Condition for reachability

clear all
clc

syms a b c d

A = [-1 1 0 0 0; 0 -1 1 0 0; 0 0 -1 0 0; 0 0 0 -1 1; 0 0 0 0 -1];
B = [ 0 0; 0 0; a b; 0 0; c d];

p = length(A);
R = B;

% Reachability matrix

for i = 1: length(A)-1
R = [R A^i*B];
end
R
Det_R = det(R(:,1:p))
Det_R_ = det(R(:,1+p:end))

Reduced_R = rref(R)

The output of the above code is obtained as:


R=

[ 0, 0, 0, 0, a, b, -3*a, -3*b, 6*a, 6*b]


[ 0, 0, a, b, -2*a, -2*b, 3*a, 3*b, -4*a, -4*b]
[ a, b, -a, -b, a, b, -a, -b, a, b]
[ 0, 0, c, d, -4*c, -4*d, 12*c, 12*d, -32*c, -32*d]
[ c, d, -2*c, -2*d, 4*c, 4*d, -8*c, -8*d, 16*c, 16*d]

Det_R =

-a*(a^2*d^2 - 2*a*b*c*d + b^2*c^2)


Det_R_ =

- 64*a^2*b*d^2 + 128*a*b^2*c*d - 64*b^3*c^2

Reduced_R =

[ 1, 0, 0, 0, 0, (4*b)/a, -(a*d + 4*b*c)/(a*d - b*c), -(b*(17*a*d - 12*b*c))/(a*(a*d - b*c)),


(3*(a*d + 8*b*c))/(a*d - b*c), (3*b*(17*a*d - 8*b*c))/(a*(a*d - b*c))]
[ 0, 1, 0, 0, 0, -4, (5*a*c)/(a*d - b*c), (16*a*d - 11*b*c)/(a*d - b*c), -
(27*a*c)/(a*d - b*c), -(3*(16*a*d - 7*b*c))/(a*d - b*c)]
[ 0, 0, 1, 0, 0, (4*b)/a, -(3*a*d)/(a*d - b*c), (3*(4*c*b^2 - 5*a*d*b))/(a*(a*d - b*c)),
(8*(a*d + b*c))/(a*d - b*c), -(8*(3*c*b^2 - 5*a*d*b))/(a*(a*d - b*c))]
[ 0, 0, 0, 1, 0, -4, (3*a*c)/(a*d - b*c), (3*(4*a*d - 3*b*c))/(a*d - b*c), -
(16*a*c)/(a*d - b*c), -(16*(2*a*d - b*c))/(a*d - b*c)]
[ 0, 0, 0, 0, 1, b/a, -3, -(3*b)/a, 6,
(6*b)/a]
In the above code, first, reachability matrix is obtain. In order to have the rank of
reachability matrix rank equals to size of matrix A, there must be at least that amount of
independent column vectors. For that, the determinant of a matrix formed from reachability
matrix with number of columns equal to the length of matrix A is calculated. We need to
check the criteria, which is going to make the determinant zero. On observing the value of
the determinant we can conclude the criteria as:
𝑎𝑑 − 𝑏𝑐 ≠ 0
On observing the reachability matrix we can say that another condition to be fulfilled is
𝑎 ≠ 𝑏 or 𝑐 ≠ 𝑑
The code for the problem 2 is as under:
% Condition for reachability

clear all
clc

syms a b c d

A = [-1 1 0 0 0; 0 -1 1 0 0; 0 0 -1 0 0; 0 0 0 -1 1; 0 0 0 0 -1];
B = [ 0 0; 0 0; a b; 0 0; c d];

p = length(A);
R = B;

% Reachability matrix

for i = 1: length(A)-1
R = [R A^i*B];
end
R
Det_R = det(R(:,1:p))
Det_R_ = det(R(:,1+p:end))

Reduced_R = rref(R)

The output of the code is:


R=

[ 0, 0, 0, 0, a, b, -3*a, -3*b, 6*a, 6*b]


[ 0, 0, a, b, -2*a, -2*b, 3*a, 3*b, -4*a, -4*b]
[ a, b, -a, -b, a, b, -a, -b, a, b]
[ 0, 0, c, d, -2*c, -2*d, 3*c, 3*d, -4*c, -4*d]
[ c, d, -c, -d, c, d, -c, -d, c, d]

Det_R =

-a*(a^2*d^2 - 2*a*b*c*d + b^2*c^2)


Det_R_ =

- a^2*b*d^2 + 2*a*b^2*c*d - b^3*c^2

Reduced_R =

[ 1, 0, 0, 0, 0, b/a, -1, -(3*b)/a, 3, (6*b)/a]


[ 0, 1, 0, 0, 0, -1, 0, 2, 0, -3]
[ 0, 0, 1, 0, 0, (2*b)/a, -3, -(6*b)/a, 8, (12*b)/a]
[ 0, 0, 0, 1, 0, -2, 0, 3, 0, -4]
[ 0, 0, 0, 0, 1, b/a, -3, -(3*b)/a, 6, (6*b)/a]

On observing the condition on determinant we have one condition as


𝑎𝑑 − 𝑏𝑐 ≠ 0
And, on observing the row reduced Echelon form we have
𝑏
≠ 1 that is 𝑎 ≠ 𝑏
𝑎

Thus, for both cases, the sufficient condition is


𝑎 ≠ 𝑏 and 𝑎𝑑 − 𝑏𝑐 ≠ 0

You might also like