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]);
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).
You have two transfer functions:
and you are interested in the combined system:
which has the the transfer function: