How to check if two transfer functions are the same?
20 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Bill Tubbs
el 12 de Ag. de 2020
Editada: Bill Tubbs
el 7 de Nov. de 2020
I want to verify that two transfer functions are equal.
For example:
Kc = 0.4262; Ti=1.35;
C1 = pidstd(Kc,Ti);
tf(C1)
s = tf('s');
Gc1 = Kc*(1+1/(Ti*s))
assert(tf(C1) == Gc1)
Raises:
Undefined operator '==' for input arguments of type 'tf'.
Also note:
Gc1
tf(C1)
Gc1 - tf(C1)
Gc1 =
0.5754 s + 0.4262
-----------------
1.35 s
Continuous-time transfer function.
ans =
0.4262 s + 0.3157
-----------------
s
Continuous-time transfer function.
ans =
0
Static gain.
0 comentarios
Respuesta aceptada
Walter Roberson
el 12 de Ag. de 2020
Editada: Walter Roberson
el 12 de Ag. de 2020
isequal(tfdata(tf(C1) - Gc1), {[0]})
This will probably fail if there are delays in the tf.
5 comentarios
Walter Roberson
el 12 de Ag. de 2020
tf are deliberately designed to commonly be used in arrays, Number of Inputs by Number of Outputs of them. So tfdata is designed to return the numerators of each of the tf array elements in distinguishable form, with the elements commonly not being the same length as each other. Rather than build a multidimensional array of coefficients with the first or last dimension being padded out to the longest numerator, and each element padded with leading zeros to match the longest numerator, the tfdata function simply creates a cell array of the numerators, like arrayfun of tfdata with 'uniform, 0. In the case of a scalar tf, that gives you a scalar cell array. tfdata does not then special case that scalar cell to extract the contents.
Más respuestas (2)
Bill Tubbs
el 6 de Nov. de 2020
Editada: Bill Tubbs
el 6 de Nov. de 2020
4 comentarios
Paul
el 7 de Nov. de 2020
Well, based on my own experience you never know what a student will submit ;).
I'm not aware of any built-in way to display the transfer function in the form of (as+1)/(bs+1). You could probably write your own, but probably not worth it.
I suppose another alternative that doesn't rely on comparing transfer functions algebraically would be to come up with some criteria on the difference between the impulse responses for the two cases.
Ver también
Categorías
Más información sobre Classical Control Design en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!