minreal not working as expected

32 Ansichten (letzte 30 Tage)
Fabio Bonassi
Fabio Bonassi am 26 Jun. 2016
Beantwortet: Harvey Louzon am 21 Sep. 2021
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 Kommentare
Star Strider
Star Strider am 26 Jun. 2016
@Flavio Tonelli —
That is an excellent Answer! Please list it as one so Fabio Bonassi can Accept it.
Flavio Tonellli
Flavio Tonellli am 26 Jun. 2016
oh well you are right! I mistakenly posted it as a comment

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Flavio Tonellli
Flavio Tonellli am 26 Jun. 2016
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 Kommentare
Star Strider
Star Strider am 26 Jun. 2016
Excellent Answer!
+1
Fabio Bonassi
Fabio Bonassi am 26 Jun. 2016
Bearbeitet: Fabio Bonassi am 26 Jun. 2016
Thank you Sir, I suspected it was due to the approximations. Setting the tollerance definitely works.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Harvey Louzon
Harvey Louzon am 21 Sep. 2021
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.

Kategorien

Mehr zu Stability Analysis 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!

Translated by