How to check if two transfer functions are the same?
49 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Walter Roberson
2020 年 8 月 12 日
編集済み: Walter Roberson
2020 年 8 月 12 日
isequal(tfdata(tf(C1) - Gc1), {[0]})
This will probably fail if there are delays in the tf.
5 件のコメント
Walter Roberson
2020 年 8 月 12 日
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.
その他の回答 (2 件)
Bill Tubbs
2020 年 11 月 6 日
編集済み: Bill Tubbs
2020 年 11 月 6 日
4 件のコメント
Paul
2020 年 11 月 7 日
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.
参考
カテゴリ
Help Center および File Exchange で Classical Control Design についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!