enter image description here

I sent in a function $$T = -0.1 \frac{s+400}{(s+20)*(s+2000)}$$

> T = -0.1*(s+400)/((s+20)*(s+2000));
> bode(T)
> grid on

I was expecting the phase to start at -180 deg, but instead the MATLAB is showing +180 deg.

Is this an inconsistency or a conceptual thing?

  • \$\begingroup\$ Why do you expect it to start at -180? \$\endgroup\$ – justing Apr 12 '15 at 4:03

You can add or subtract 360 deg (pi rad) as many times as needed in Bode phase graph. Right click in your graph, Properties > Options > Phase Response > Adjust phase offsets [on] > Keep phase close to [-pi] (in your case), At frequency [0.000]. Done in MATLAB R2015a.

  • \$\begingroup\$ you mean 2pi rad \$\endgroup\$ – Scott Seidman Jan 14 '16 at 14:26

The phase plot should start at -180. You need to write the numerator block as (-0.1s -40)

  • \$\begingroup\$ Chu so what might be causing matlab to plot it at +180 deg? \$\endgroup\$ – Carlos - the Mongoose - Danger Apr 12 '15 at 16:18
  • \$\begingroup\$ I suspect that it's interpretted the -0.1, on the negative real axis, as +180 instead of -180, then, at say 1 rad/s, the overall phase angle would be 180 + atan(1/400) - atan(1/20) - atan(1/2000)= 180+0.14-2.86-0.03 = 177.25. And so on at other frequencies. \$\endgroup\$ – Chu Apr 12 '15 at 18:15
  • \$\begingroup\$ ... consider w=20 rad/s, where the Matlab phase is just greater than +135 from your graph. Using +180 for the -0.1 term instead of -180 will give: 180+atan(20/400)-atan(20/20)-atan(20/2000) = 180+2.86-45-0.57 = 138. True phase angle is -222 \$\endgroup\$ – Chu Apr 12 '15 at 18:27
  • \$\begingroup\$ +180 degrees and -180 degrees are the same angle. Your answer is not correct \$\endgroup\$ – Scott Seidman Jan 14 '16 at 14:25
  • \$\begingroup\$ @Scott Seidman, At \$\omega=0\$ the vector is along the -ve real axis. As \$\omega\$ increases, the first term to have an effect is the \$(s+20)\$ lag which adds phase lag and hence rotates the vector clockwise into the 2nd quadrant. This represents a total phase lag which is greater than 180deg \$\endgroup\$ – Chu Jan 14 '16 at 17:22

When you doubt your tools goto 1st principals or use other tools


enter image description here

at \$\omega=0\$

\$T = -0.1 \frac{s+400}{(s+20)*(s+2000)}\$ reduces to -0.001

With negative gain the phaseshift is +180degrees (or -180 ;) )

  • \$\begingroup\$ To check a Matlab answer, Excel is probably better than a package that uses a more 'sophisticated' algorithm like Wolfram, where you don't really know what it's doing. In Excel you can use ATAN2 which resolves the phase angle issue. If you're plotting on a logarithmic frequency scale, w=0 or 'DC' does not exist, so the low frequency phase angle rounds to -180, not to +180 \$\endgroup\$ – Chu Apr 12 '15 at 9:59
  • \$\begingroup\$ I don't disagree, Excel is great. I guess it comes downto exactly what he is trying todo \$\endgroup\$ – JonRB Apr 12 '15 at 10:06
  • \$\begingroup\$ The true phase angle is always lagging, it is never positive. eg, at 100rad/s, the true phase angle is (-166-79-3)=-248. Wolfram is giving something quite different. \$\endgroup\$ – Chu Apr 12 '15 at 10:23
  • \$\begingroup\$ @Chu, you can do EXACTLY the same thing in Matlab. Just because there are high level functions available, it doesn't mean that you have to use them. \$\endgroup\$ – Scott Seidman Jan 14 '16 at 21:31
  • \$\begingroup\$ It's all about readability. It's like using different scales on the axes of a root locus - strictly correct, but does not lend itself to design. \$\endgroup\$ – Chu Jan 15 '16 at 0:48

Just FYI for your normal phase plot. You can add some options to the bode plot:

opts = bodeoptions('cstprefs');

opts.PhaseWrapping = 'on';

opts.PhaseWrappingBranch = -180;

bode(***your_transfer_function***, opts);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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