Minreal function difference between 2021a and 2021b

Hello all,
i am trying to simplifiy the following transfer function
num= [0 2.326783565332 0.047642481534536 1.1320523206336 0.018636773326054 0.1736525620563 0.0018797084587909 0.0095824683611615 5.0490779499017e-05 0.0001278775430483 3.1601961291737e-07 -4.7792321851035e-08 4.7241839384478e-12 1.6520593468991e-16 -3.5261492799393e-35]
den=[1 0.16677519120767 0.49411474213873 0.072903194148789 0.077462329441744 0.0095429580373996 0.0043848511975007 0.00044880580115597 6.2185817443617e-05 5.5616071215642e-06 3.4904054871597e-08 -1.8966547971896e-09 -1.5452863299211e-11 -2.9766685962549e-15 4.4489378695401e-21]
In matlab 2021a with a tolerance of 0.005 i get:
num=[0 2.326783565332 0.0242847369269 0.29192839103876 -6.2309086400998e-20]
den = [1 0.15310693671003 0.13130203172257 0.012309590052138 9.2125282212156e-05]
While in matlab 2021b with the same tolerance i get:
num=[0 2.326783565332 0.041644199007858 1.1327911885271 0.015731663720654 0.17402398971009 0.0014368084118137 0.0096420548390914 2.6156798199821e-05 0.00013131681404352 -1.2992874796127e-08 -4.5425159381868e-13 9.6955289981649e-32]
den=[1 0.16403829533202 0.49402991560459 0.071610816843538 0.077446228810322 0.0093570713626183 0.0043874423008049 0.00044020501132602 6.2578618017865e-05 5.5506274585318e-06 4.249926757687e-08 8.1746675586304e-12 -1.2218020065151e-17]
There is quite a difference in order, but which one is the correct one? There is not any notice about changes in this function in the 2021b list of changes, or at least, i could not find anything.
Kind regards
Roberto

 採用された回答

Paul
Paul 2022 年 2 月 17 日

0 投票

Running 2021b in the Answers facility yieds results that are very close to, but not exactlyl the same as, what you got in 2021a.
num= [0 2.326783565332 0.047642481534536 1.1320523206336 0.018636773326054 0.1736525620563 0.0018797084587909 0.0095824683611615 5.0490779499017e-05 0.0001278775430483 3.1601961291737e-07 -4.7792321851035e-08 4.7241839384478e-12 1.6520593468991e-16 -3.5261492799393e-35];
den= [1 0.16677519120767 0.49411474213873 0.072903194148789 0.077462329441744 0.0095429580373996 0.0043848511975007 0.00044880580115597 6.2185817443617e-05 5.5616071215642e-06 3.4904054871597e-08 -1.8966547971896e-09 -1.5452863299211e-11 -2.9766685962549e-15 4.4489378695401e-21];
format long e
[numr,denr] = minreal(num,den,0.005) % obsolete usage?
10 pole-zero(s) cancelled
numr = 1×5
0 2.326783565332000e+00 2.428473692692200e-02 2.919283910388171e-01 -6.230908640101220e-20
denr = 1×5
1.000000000000000e+00 1.531069367100458e-01 1.313020317225583e-01 1.230959005213707e-02 9.212528221215011e-05
I get these exact same results on my local installation (2021b, Update 2). Can you post the exact code you ran in 2021b?

3 件のコメント

Roberto Echeverria
Roberto Echeverria 2022 年 2 月 21 日
Hello Paul and thanks for your answer.
I'm also using R2021b update 2. I was surprised by your remark about the obsolete usage as i didn't know it could be used that way...
my code is:
a=tf(num,den)
minreal(a,0.005)
As you can see, i first create the transfer function and then apply the minreal.
If I call the minreal with the num and den i get the same results as you (minreal cancels 10poles/zeros) obtaining same result as in 2021a, but if i do it with the system already built as a tf minreal only removes 2poles/zeros.
I built a parallel minreal cancellation function by myself. On first instance I remove all poles/zeros which absolute distance between them is below the defined threshold. This option produces the same cancellation as 2021a with a transfer function or 2021b with the num/den parameters to the minreal function.
Alternatevely i constructed another one on which i calculate the relative distance between poles and zeros with respect to their distance to the origin, meaning that;
  1. i will cancel certain poles/zeros which on first instance are well separated but because their far from origin their relative distance is small.
  2. I will NOT cancel certain poles/zeros which on first instance are very close to each other but because they are close to the origin their relative distance is big.
I don't know if this is what r2021b is doing because although the behavior is more similar i can't get to make it work the same.
Kind regards
Roberto
Paul
Paul 2022 年 2 月 21 日
編集済み: Paul 2022 年 2 月 21 日
I get the same results as you with 2021b U2 with the "modern" approach using a tf object. I had thought that the modern and obsolete methods would yield the same answer because I assumed that the obsolete function call would just convert to tf and call the modern. Bad assumption, at least for 2021b.
However, for 2019a, the modern and obsolete methods yield the exact same answer. So something has definitely changed for the modern since 2019a (and I guess since 2021a based on your results). In 2021b, I did see that the algorthm for selecting which poles and zeros to cancel is much more complicated than in the obsolete code, which just checked if the magnitude of the difference is <= tol.
After reviewing the code, it sure looks like the minreal function for tf and zpk objects has changed since 2019a (the most recent version I have before 2021b). Not discussed in the release notes as far as I could tell.
Roberto Echeverria
Roberto Echeverria 2022 年 2 月 22 日
Thank you very much Paul on taking the effort to confirm my theories. I think the only option to get a good answer would be to ask the official support from mathworks, as it looks to me that they forgot to fix the complete minreal function.
In my case, I will use my own approach because i need the caller function to be consistent between different versions.
Thanks again and kind regards
Roberto

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by