matlabsimulinktransfer-function

Is it possible to find a block for multi-input single-output transfer function in Matlab simulink?


I have a system with two inputs and one common output.

Let inputs be in1, in2 and output - out.

So I have two transfer functions: out / in1, out / in2.

Using simulink I can use transfer fcn block for each transfer function and then sum their outputs to get a desired output.

But is it possible to join transfer functions out/in1, out/in2 somehow together and to use some simulink block to avoid summation of transfers functions outputs?

Thank you for your time and help in advance!

% in symbolic

syms Ht s D K Hg

TF1 = tf([D K],[4*Hg*Ht (2*Hg*D+2*Ht*D) (2*Hg*K+2*Ht*K) 0]);

TF2 = tf([-2*Ht -D -K],[4*Hg*Ht (2*Hg*D+2*Ht*D) (2*Hg*K+2*Ht*K) 0]);

% or in numerical way

Ht = 2.2667;
Hg = 0.92952;
D = 2.29;
K = 1.0216;

TF1 = tf([D K],[4*Hg*Ht (2*Hg*D+2*Ht*D) (2*Hg*K+2*Ht*K) 0]);

TF2 = tf([-2*Ht -D -K],[4*Hg*Ht (2*Hg*D+2*Ht*D) (2*Hg*K+2*Ht*K) 0]);

Solution

  • There is a really simple solution for this. Given two transfer functions TF1=tf(num1,den1) and TF2=tf(num2,den2), the sum TF1+TF2 can be expressed as a single transfer function tf(num1*den2+num2*den1,den1*den2).

    For actual implementation, you will want to use conv to compute the numerator and denominator polynomials from the polynomial coefficient vectors from the component transfer functions.

    num = polyadd(conv(num1,den2),conv(num2,den1));
    den = conv(den1,den2);
    

    Note polyadd is not a built-in Matlab function but you can write your own or use https://stackoverflow.com/a/55085308.

    If you already have the single-input, single-output (SISO) transfer function objects tf1 and tf2 in Matlab, you can also get the sum using tf1+tf2 or by using parallel(tf1,tf2,1,1,1,1) (see https://www.mathworks.com/help/control/ref/parallel.html).

    Why does this work?

    You have two transfer functions:

    Y_1=\frac{N_1(s)}{D_1(s)}\cdot U
    Y_2=\frac{N_2(s)}{D_2(s)}\cdot U

    and you are interested in the combined system:
    Y=Y_1+Y_2=\bigg(\frac{N_1(s)}{D_1(s)}+\frac{N_2(s)}{D_2(s)}\bigg)\cdot U

    which has the the transfer function:

    \frac{N_1(s)}{D_1(s)}+\frac{N_2(s)}{D_2(s)}=\frac{N_1(s) \cdot D_2(s) + N_2(s) \cdot D_1(s)}{D_1(s) \cdot D_2(s)}