How to check if two transfer functions are the same?
조회 수: 72 (최근 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!