MATLAB: Error with basic tf function when num and den data are enormous

tf.dentf.num

I have trouble with the tf function when I write the following code:
G = -G0*((1+Wz1/s)*(1+s/Wz2))/((1+s/Wp1)*(1+s/Wp2));
[n,d]=numden(simplify(G));
numtf = coeffs(n,s);
dentf = coeffs(d,s);
num = [numtf(1,2) numtf(1,1)];
den = [dentf(1,3) dentf(1,2) dentf(1,1)];
H = tf(num, den);
The error is as follows:
??? Error using ==> tf.tf>tf.tf at 293 The values of the "num" and "den" properties must be row vectors or cell arrays of row vectors, where each vector is nonempty and containing numeric data. Type "help tf.num" or "help tf.den" for more information.
I suppose that my num and den arrays are too big, like;
num =
[ -10255136766097329602890536050147357991662675558400, -459832128482391426299493586726723482988006929678529725]
den =
[ 155212291532809910445709165852975169536, 54585058686258589305546999447174307622420480, 4799118359695855171743692191395565126163208601600]
Could you please help to solve the problem?

Best Answer

You are trying to pass symbolic variables to a routine that needs numeric data.
You could
tf(double(num), double(den))
but you will lose precision if you do that. Your largest value exceeds -2^178 and to represent it without precision loss would require floating point numbers with at least 179 bits of mantissa.
Related Question