I'm iterating a single-input-single-output linear system by sending inputs to it and getting outputs from it. The nominator and denominator of the transfer function of the system are represented by Nom
and Den
in the code respectively.
Nom
and Den
are calculated after some complex operations on some polynomials, so I don't have prior information on the degree of these polynomials. The only thing I know is that the system is proper (i.e.; the degree of Den
is greater than or equal to the degree of Nom
).
My code goes like this:
% ...
Nom = (...); % calculated after some complex operations
Den = (...); % calculated after some complex operations
[A, B, C, D] = tf2ss(Nom, Den);
x = zeros(size(B)); % state vector
xp = x; % derivative of the state vector
% ...
for t = 0 : SAMPLING_PERIOD : TIME_END
% ...
xp = A * x + B * u; % 'u' is some scalar input, calculated in the code previously
y = C * x + D * u; % 'y' is some irrelevant output signal, to be used in somewhere else in the code
x = xp * SAMPLING_PERIOD;
% ...
end
% ...
When Den
is 0th order (which requires Nom
to be 0th order as well), tf2ss()
returns empty matrices for A
, B
, C
and D
. This is somewhat problematic in my other parts of code. I need these matrices to be at least 1-by-1.
So, my question is, what equivalent non-empty matrices can I use instead of A
, B
, C
and D
for those who return empty? For example, can I assume that all empty matrices are 1-by-1 zero matrices?
Example:
[A, B, C, D] = tf2ss([1], [2])
returns
A = [] % Empty matrix
B = [] % Empty matrix
C = [] % Empty matrix
D = 0.5 % 1-by-1 matrix