필터 지우기
필터 지우기

minreal not working as expected

조회 수: 27 (최근 30일)
Fabio Bonassi
Fabio Bonassi 2016년 6월 26일
답변: Harvey Louzon 2021년 9월 21일
Hi everyone, I need to calculate the minimal realization form of a transfer function, which is a combination of other transfer function previously defined.
minreal(-G12*G21*R1 /(1+R1*G11))
The expected result is be 10 / (s^2+6s+5), while minreal returns (10s^2+20s+10)/(s^4+8s^3+18s^2+16s+5). Now, launching the roots command on the numerator and the denominator returns the roots I expected, which can be simplified, obtaining the expected result. There are also two strange behaviors:
  • The roots of the numerator are treated as real numbers, while the roots of the denominator are treated as complex number with a null immaginary part.
  • Launching
pzmap(minreal(-G12*G21*R1 /(1+R1*G11)))
I obtain the attacched map, in which some zeros don't have null immaginary part, while the roots of numerator are real numbers.
  • Launching
minreal(-G12*G21*R1 /(1 + minreal(R1*G11)))
returns the expected result. Can someone explain me what is happening?
Here is the data used:
s = tf('s')
G11 = 1/(s+1)
G12 = 2/(s+1)
G21 = -1/(s+1)
G22 = -1/(s+1)
R1 = 5*(s+1)/s
  댓글 수: 3
Star Strider
Star Strider 2016년 6월 26일
@Flavio Tonelli —
That is an excellent Answer! Please list it as one so Fabio Bonassi can Accept it.
Flavio Tonellli
Flavio Tonellli 2016년 6월 26일
oh well you are right! I mistakenly posted it as a comment

댓글을 달려면 로그인하십시오.

채택된 답변

Flavio Tonellli
Flavio Tonellli 2016년 6월 26일
I agree they should give you the same result.
On my point of view it depends on representation/calculation errors that occur when matlab internally solve the operation between the transfer functions. It could depend on the limited number of bits the PC has to represent number during operation or by same approximation in the mathematical approach mathworks choose to solve the TF multiplication. Remember that from your point of view is just an easy multiplication between TF but from a PC point of view it has to be solved has a series of binary operations.
In the second case it works because you simplify during the calculation , in this way matlab solve two simpler multiplication instead of a bigger/complex one.
-5.00000000000000e+000 + i
-1.00001071414599e+000 + i
-999.994642927007e-003 + 9.27842853818312e-006i
-999.994642927007e-003 - 9.27842853818312e-006i
Above i listed the poles of the case that give you the wrong result. Has you could notice the results are the expected ones but with a little epsilon error(the correct one should be -5,-1,-1,-1 This little delta stop minreal in the simplification process because -1 and -999.994642927007e-003 + 9.27842853818312e-006i are recognized has two different number. One workaround is to specify to minreal the tolerance:
minreal(-G12*G21*R1 /(1+R1*G11),1e-2)
Since the epsilon is lower than 1e-2 the pole/zero cancellation occurs. Keep in mind that if the tolerance is too high you could have undesired cancellation as well.
  댓글 수: 2
Star Strider
Star Strider 2016년 6월 26일
Excellent Answer!
+1
Fabio Bonassi
Fabio Bonassi 2016년 6월 26일
편집: Fabio Bonassi 2016년 6월 26일
Thank you Sir, I suspected it was due to the approximations. Setting the tollerance definitely works.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Harvey Louzon
Harvey Louzon 2021년 9월 21일
Interestingly the same problem arises in the following senario: Take
TF = (0.0001998*s + 2e-6)/(s^3 + 0.03*s^2 + 0.0003998*s + 2e-6).
this has poles at
-0.0100 + 0.0100i
-0.0100 - 0.0100i
-0.0100 + 0.0000i
and a zero at -0.0100
However minreal will not cancel the the zero at -0.0100 with the pole at -0.0100 + 0.0000i unless a tolerance is stipulated.

카테고리

Help CenterFile Exchange에서 State-Space Control Design and Estimation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by