Hi Carlos,
In 2024a, allmargin introduced a new "Focus" input. Check the doc page for more information. As far as I can tell, what's happening is as follows:
For a discrete time system, the default Focuse is Focus = [0 pi/Ts], that is the upper bound is the Nyquist frequency.
Then, allmargin uses an undocumented call to damp to compute the "natural frequency" of the closed loop poles. In your example, we have clp = pole(feedback(gz,1))
clp =
-1.2707
-0.7293
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
wn = damp(clp,4)
wn =
0.7877
0.7894
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
I'm not exactly sure yet what wn is supposed to represent in the context of this problem.
Nevertheless, both elements of wn are greater than the upper bound of Focus, which is
Hence, allmargin excludes both closed loop poles from the unit circle test, and since there are no poles left it returns Stable = 1, as you've observed.
I'd have to do some more digging to get a better idea of what they mean with that wn computation, or anyone can as damp is an ordinary m-file.
Also, at present I don't see a way to use the explicit Focus name/value pair to override the default. As best I can tell, if Focus(2) on input is greater than pi/Ts, then it's set to pi/Ts internally.
I'd say that this situation looks very suspicious, but I'd need to get a better understanding of what's happening with damp before going so far as to say that there is a bug, though it certainly looks like that's the case.