Function sdo.requirements.GainPhaseMargin returns wrong outputs
Info
This question is closed. Reopen it to edit or answer.
Show older comments
I'm having problems when I try to tune the gains of a system using the optimization function that check Gain and Phase margin. The point is that the output of the function: c = evalRequirement(req,lin_sys) returns positive values (which means that the system doesn't meet the criteria) when it actually does (I've checked it using margin(lin_sys)).
So first here is how I define the criteria:
GainPhase = sdo.requirements.GainPhaseMargin;
set(GainPhase, ...
'GainMargin', [], ...
'PhaseMargin', 45, ...
'Type', '>=', ...
'FeedbackSign', -1);
(The last two lines are not really necessary since are the default ones)
Here how I call the function that evaluates if the Phase Margin is above 45deg:
cGainPhase = evalRequirement(GainPhase,lin_sys)
And the transfer function (is not actually this one but for the point it's enough):
lin_sys=tf([2 3],[1 0])*tf([1 0],[3 8 2]);
If you evaluate:
margin(lin_sys)
You will see that the PM is 136deg and therefore grater that 45 so the cGainPhase variable should be negative meaning that the bound is satisfied while it is actually positive which indicate the bound is violated.
I went inside evalRequirement function and in line 182 seems to be the origin of all this problem when it executes the line code:
marg = this.computeMargins(TestPoint(:,:,ct),this.FeedbackSign);
That gives the same results as margin() but with the signs changed and I can not really understand why! And of course then messes with all my code.
I would appreciate some help here since there is not much info about this optimizing functions either on matlab help or internet.
Currently using MATLAB 2012.a
Answers (0)
This question is closed.
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!