1
votes

How can I define an n-by-n transfer function matrix in matlab? I just need to initialize it since I will load it with the correct tf in a second part of my code.

I tried with the definition:

MATRIX=zeros(n);

but each element of MATRIX is of double type. I want each element to be of tf data type.

2

2 Answers

1
votes

You are looking to create Model Array. The command also depends on the number of inputs and outputs in your system. You can create it using for example:

MATRIX = tf(zeros(no_inputs, no_outputs, n, n));
0
votes

If you have two transfer functions for a S/MIMO system (actually a concatenation of SISO models):

s = tf('s')
h11 = (s-1)/(s+1)
h21 = (s+2)/(s^2+4*s+5)
% or
% h11 = tf([1 -1],[1 1])
% h21 = tf([1 2],[1 4 5]) 

they can be concatenated to form H(s).

H = [h11; h21]

You can also pass directly by tf using cell arrays:

h11 = {[1 -1];[1 2]}
h21 = {[1 1];[1 4 5]}
H = tf(N,D)

Both works also for zpk models.