minreal tolerance not respected
8 views (last 30 days)
minreal documentation says that it does a simple pole-zero comparsion for cancelation. However, simple examples seem to behave differently. Even the example in the Pole-Zero simplification document fails to behave as described:
G = zpk(3e-8,[-1,-3],1);
C = pid(1,0.3);
T = feedback(G*C,1)
% compute minreal with a tolerance that ought to cancel
Tred = minreal(T, 1e-7)
As you can see, the zero at 3e-8 and 0 do not cancel, even though they are less than 1e-7 away. It eventually cancels at tolerance of 1e-3. It appears that the elimination criteria is the the square of the distance, rather than the distance, but that is not at all clear from the documentation or the example above.
Paul on 19 Nov 2022
Edited: Paul on 19 Nov 2022
As best I can tell after sifting through the code, tol is generally compared to the distance between the zero and pole under test. However, the tol that is used is modified from what the user provides. This modification is very small, except when checking for cancellations of poles and zeros on (or perhaps very close to?) the imaginary axis, which includes the origin.
H = zpk(-3e-8,0,1);
minreal(H,1e-7) % real pole/zero at/near the origin
H = zpk(-1-3e-8,-1,1); % real pole/zero at -1 separated by 3e-8
minreal(H,3e-8) % exact tol, cancellation occurs
H = zpk(1j*(1-3e-8)*[1 -1] ,[-j,j],1) % imaginary pole/zero at 1j separated by 3e-8
minreal(H,3e-7) % doesn't cancel
minreal(H,3e-4) % need a larger tolerance
H = zpk(-1+1j*(1-3e-8)*[1 -1] ,-1+[-j,j],1) % complex poles and zeros separated by 3e-8
minreal(H,3e-7) % cancels
I don't know if this helps, but it shows that poles/zeros around the origin and on the imaginary axis are treated a bit differently than those that aren't.