Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question is similar to a previous question, but I did not find an adequate answer there.

If I type in the command BodePlot[1/(s^2)] I get a horizontal line at +180° for the phase plot. Based on the books Linear Control System Analysis & Design, 3rd Ed by D'Azzo and Houpis (pg. 259) and Feedback Control of Dynamic Systems by Franklin and Powell, 3rd Ed (pg 348), as well as MATLAB, the phase should be -180°. This particular problem is about as basic as it gets.

Furthermore, for BodePlot[1/(s^3)] and BodePlot[1/(s^4)], Mathematica gives +90° and 0°, instead of the conventional -270° and -360°.

I believe this all stems from the way Mathematica calculates the phase of a complex number. If I type Arg[1/(I^2)], Arg[1/(I^3)], and Arg[1/(I^4)], I get $\pi$, $\pi/2$ and $0$, respectively.

So, my question is, how do I get BodePlot to follow the convention I would like to follow? I do not see an option under the BodePlot documentation to make this happen.

share|improve this question

closed as not a real question by whuber, m_goldberg, Oleksandr R., halirutan, Yves Klett Mar 18 '13 at 7:12

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

In what way are the answers to the previous question not "adequate"? –  whuber Mar 16 '13 at 21:22
The phases of 1/I^n seem correct to me. –  Sjoerd C. de Vries Mar 17 '13 at 23:17
It's correct to the extent that it is essentially returns the "phase". But the phase of a transfer function, in addition to being just the phase of a complex number also has the interpretation of how much the output lags the input. This is what the result with 1/(s+1)^12 shows. Then someone may want to wrap the phase beween 0 and -360. In cases like 1/s^3 the default turns out to be just the phase difference and not the phase lag. (I think the overall behavior needs to be reevaluated for consistency.) At any rate, an option is needed to overrule whatever default phase range is returned. –  Suba Thomas Mar 18 '13 at 0:52

1 Answer 1

A workaround for the pure integrator/differentiator cases that you mention.

Arg[_]/;IntegerQ[$pureIntegratorCount]:= $pureIntegratorCount Pi/2

bodePlot[tfm:Times[_?NumericQ, Power[_?AtomQ, n_]]|Power[_?AtomQ, n_]]:=                               
    $pureIntegratorCount = n; 
    res = BodePlot[tfm]; 
    $pureIntegratorCount = None; 
bodePlot[args___] := BodePlot[args]

It does not help for transfer functions like 1/(s^2(s+1)), which eventually will need an option in Mathematica to specify a desired phase range.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.