How to check if two transfer functions are the same?
71 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Bill Tubbs
am 12 Aug. 2020
Bearbeitet: Bill Tubbs
am 7 Nov. 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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 12 Aug. 2020
Bearbeitet: Walter Roberson
am 12 Aug. 2020
isequal(tfdata(tf(C1) - Gc1), {[0]})
This will probably fail if there are delays in the tf.
5 Kommentare
Walter Roberson
am 12 Aug. 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.
Weitere Antworten (2)
Bill Tubbs
am 6 Nov. 2020
Bearbeitet: Bill Tubbs
am 6 Nov. 2020
4 Kommentare
Paul
am 7 Nov. 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.
Siehe auch
Kategorien
Mehr zu Classical Control Design finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!