# How to create a connecting model transfer function out of multiple transfer function?

13 views (last 30 days)
Aditya Dilip Kothari on 25 Sep 2019
Answered: Asvin Kumar on 4 Oct 2019
Hi,
I am trying to create a transfer function in matlab to model a channel from rfmodel.rational. My channel consists of 500 complex conjugate poles and zeros. I found in documentation of rf toolbox code: (https://www.mathworks.com/help/rf/ug/rfckt.rfmodel.rational.html), That would allow me to create individual transfer function blocks for a pair of complex conjugate poles. So for instance if there is a pair of complex conjugagte poles, single transfer function block is created. If there are 4 complex conjugate poles, 2 transfer functions are crated. Therfore if there are 500 complex conjugate poles, I expect to create 250 transfer function blocks. Finaly to get a total channel model I combine them in series all tf blocks i.e multiply all individual transfer funcrtion blocks into a single transfer function. The problem I am running into is that transfer function breaks beyond 30 poles, the polynomial values start going to infinity.
It would be great if you could help or guide me how to get rid of infinities.
P.S I am attaching rational models for 34, 30, 4 amd 2 poles if someone wants to try it out on the code bellow.
Example of 34 complex pole conjugate system:
load RationalFunc_34.mat RationalFunc %RationalFunc_34.mat contains 34 complex conjugate poles and zeros that model the channel
npoles = length(RationalFunc.A);
%Get the Numerator and Denominator of the Laplace Transform S-Domain Transfer Functions (https://www.mathworks.com/help/rf/ug/rfckt.rfmodel.rational.html)
A = RationalFunc.A;
C = RationalFunc.C;
den = cell(size(A));
num = cell(size(A));
k = 1; % Index of poles and residues
n = 0; % Index of numerators and denominators
while k <= npoles
if isreal(A(k)) % Real poles
n = n + 1;
num{n} = C(k);
den{n} = [1, -A(k)];
k = k + 1;
else % Complex poles
n = n + 1;
real_a = real(A(k));
imag_a = imag(A(k));
real_c = real(C(k));
imag_c = imag(C(k));
num{n} = [2*real_c, -2*(real_a*real_c+imag_a*imag_c)];
den{n} = [1, -2*real_a, real_a^2+imag_a^2];
k = k + 2;
end
end
den = den(1:n);
num = num(1:n);
sys_channel = tf(num, den) %create transfer function
%Combine all the individual transfer functions:
k = 1;
ntf = length(sys_channel);
H = sys_channel(1);
while k < ntf
k = k + 1
%H = H*sys_channel(k)
H = series(H, sys_channel(k))
%H.num
end
Output Transfer function:
9.699e131 s^17 + 4.479e143 s^16 + 3.612e154 s^15 - 2.117e165 s^14 - 1.025e176 s^13 + 2.444e186 s^12
+ 5.036e196 s^11 - 5.903e206 s^10 - 1.121e217 s^9 + 1.929e226 s^8 + 9.358e236 s^7 + 4.211e246 s^6
+ 1.231e255 s^5 - 2.093e265 s^4 - 1.471e274 s^3 + 3.07e283 s^2 + 8.274e291 s - 7.337e298
--------------------------------------------------------------------------------------------------------------
s^34 + 3.077e09 s^33 + 2.843e21 s^32 + 8.344e30 s^31 + 3.479e42 s^30 + 9.712e51 s^29 + 2.418e63 s^28
+ 6.403e72 s^27 + 1.063e84 s^26 + 2.661e93 s^25 + 3.112e104 s^24 + 7.335e113 s^23 + 6.238e124 s^22
+ 1.377e134 s^21 + 8.662e144 s^20 + 1.782e154 s^19 + 8.349e164 s^18 + 1.588e174 s^17 + 5.55e184 s^16
+ 9.673e193 s^15 + 2.505e204 s^14 + 3.953e213 s^13 + 7.484e223 s^12 + 1.051e233 s^11 + 1.42e243 s^10
+ 1.731e252 s^9 + 1.604e262 s^8 + 1.632e271 s^7 + 9.736e280 s^6 + 7.736e289 s^5 + 2.723e299 s^4
+ 1.498e308 s^3 + Inf s^2 + Inf s + Inf

Asvin Kumar on 4 Oct 2019
It would help to convert from transfer function representation to state space representation for better accuracy. Here’s a bit of modified code you can refer to:
den = den(1:n);
num = num(1:n);
sys_channel = tf(num, den) %create transfer function
%Combine all the individual transfer functions:
k = 1;
ntf = length(sys_channel);
H = sys_channel(1);
while k < ntf
k = k + 1
tmp = ss(sys_channel(k),'minimal');
H = series(H, tmp);
end