# Different bode plots for the same input in mathematica, wolfram alpha

**URL:** <https://community.wolfram.com/t/different-bode-plots-for-the-same-input-in-mathematica-wolfram-alpha/5997>\
**Category:** Questions\
**Tags:** control-systems, engineering, mathematica, wolfram-alpha\
**Created:** [June 21, 2015, 8:48am UTC](https://community.wolfram.com/t/different-bode-plots-for-the-same-input-in-mathematica-wolfram-alpha/5997 "2015-06-21T08:48:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![riccardoloddo](https://avatars.discourse-cdn.com/v4/letter/r/50afbb/32.png) [@riccardoloddo](https://community.wolfram.com/u/riccardoloddo)\
**Post date:** [June 21, 2015, 8:48am UTC](https://community.wolfram.com/t/different-bode-plots-for-the-same-input-in-mathematica-wolfram-alpha/5997/1 "2015-06-21T08:48:18Z")

</div>

The phase diagrams of both look wrong to me.  
What am I missing?

 ![wolframalpha.png](https://global.discourse-cdn.com/wolfram/original/3X/a/f/af39d304d837116f3c9f4e8f53607c670af35ef9.png)

 ![mathematica.png](https://global.discourse-cdn.com/wolfram/original/3X/d/9/d950972a548f15d84414701612389276437cb221.png)

---

<div class="post-metadata">

**Author:** ![wolframcommunity](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wolframcommunity/32/8335_2.png) [@wolframcommunity](https://community.wolfram.com/u/wolframcommunity)\
**Post date:** [June 22, 2015, 11:48am UTC](https://community.wolfram.com/t/different-bode-plots-for-the-same-input-in-mathematica-wolfram-alpha/5997/2 "2015-06-22T11:48:53Z")

</div>

Thank you, we will look into this.

---

<div class="post-metadata">

**Author:** ![dlkeith](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/dlkeith/32/31494_2.png) [@dlkeith](https://community.wolfram.com/u/dlkeith)\
**Post date:** [June 22, 2015, 5:30pm UTC](https://community.wolfram.com/t/different-bode-plots-for-the-same-input-in-mathematica-wolfram-alpha/5997/3 "2015-06-22T17:30:33Z")

</div>

I would also be grateful for responses to this from those with experience using Mathematica for control theory. In the code below, I treat the transfer function as that of the complete system. (Not a component with feedback around it.)

I observe that the transfer function is unstable, with conjugate poles on the axis. The OutputResponse to a step is oscillatory. I don’t think a Bode plot of such a system is meaningful.

```
syss = (1 + 0.001 s)/(s^2 + 0.5);

sys = TransferFunctionModel[{{syss}}, s];

BodePlot[sys, FeedbackType -> None, PhaseRange -> {-Pi, Pi}]

```

 ![bode.png](https://global.discourse-cdn.com/wolfram/original/2X/8/8d4eb883b3abaf2746bccb84dce9735fc932b95b.png)

```
In[4]:= (* poles on the axis == unstable *)
TransferFunctionPoles[sys]

Out[4]= {{{0. - 0.707107 I, 0. + 0.707107 I}}}

In[5]:= sysOutput = OutputResponse[sys, UnitStep[t], t] // Chop

Out[5]= {2. (-1. Cos[0.707107 t] UnitStep[t] + 
    1. Cos[0.707107 t]^2 UnitStep[t] + 
    0.000707107 Sin[0.707107 t] UnitStep[t] + 
    1. Sin[0.707107 t]^2 UnitStep[t])}

In[6]:= Plot[sysOutput, {t, 0, 100}]

```

 ![response.png](https://global.discourse-cdn.com/wolfram/original/2X/b/b61932ca784bb9d1e43893c29c16664ad3e64bd3.png)

---

<div class="post-metadata">

**Author:** ![subat](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/subat/32/32564_2.png) [@subat](https://community.wolfram.com/u/subat)\
**Post date:** [June 22, 2015, 5:32pm UTC](https://community.wolfram.com/t/different-bode-plots-for-the-same-input-in-mathematica-wolfram-alpha/5997/4 "2015-06-22T17:32:53Z")

</div>

You can get, what I think you are looking for, by doing the following.

```
BodePlot[tf, PlotLayout -> "Phase", PhaseRange -> {-\[Pi], \[Pi]}]

```

 ![ScreenShot2015-06-22at12.28.25PM.png](https://global.discourse-cdn.com/wolfram/original/2X/e/eb896cd2a4b190b0c8fefc1dc7db9560f96c833f.png)

In v10, an unnecessary (but mathematically not incorrect) phase lag of 360 gets added.

---

<div class="post-metadata">

**Author:** ![josklaps1](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/josklaps1/32/22044_2.png) [@josklaps1](https://community.wolfram.com/u/josklaps1)\
**Post date:** [June 22, 2015, 8:01pm UTC](https://community.wolfram.com/t/different-bode-plots-for-the-same-input-in-mathematica-wolfram-alpha/5997/5 "2015-06-22T20:01:44Z")

</div>

Hi David,

I got an error from sysOutput line and I don’t know why?  
See file attached.

Can you help…Thanks

---

<div class="post-metadata">

**Author:** ![dlkeith](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/dlkeith/32/31494_2.png) [@dlkeith](https://community.wolfram.com/u/dlkeith)\
**Post date:** [June 22, 2015, 8:19pm UTC](https://community.wolfram.com/t/different-bode-plots-for-the-same-input-in-mathematica-wolfram-alpha/5997/6 "2015-06-22T20:19:14Z")

</div>

Hi Jos,

I don’t get an error when I evaluate your notebook. Perhaps some variable is defined. I suggest starting with a fresh kernel.

Best,  
David

```
In[6]:= sysOutput = 
 OutputResponse[sys, UnitStep[t], t] // Chop (* ERROR ?? *)

Out[6]= {2. (-1. Cos[0.707107 t] UnitStep[t] + 
    1. Cos[0.707107 t]^2 UnitStep[t] + 
    0.000707107 Sin[0.707107 t] UnitStep[t] + 
    1. Sin[0.707107 t]^2 UnitStep[t])}

```

---

<div class="post-metadata">

**Author:** ![josklaps1](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/josklaps1/32/22044_2.png) [@josklaps1](https://community.wolfram.com/u/josklaps1)\
**Post date:** [June 22, 2015, 10:13pm UTC](https://community.wolfram.com/t/different-bode-plots-for-the-same-input-in-mathematica-wolfram-alpha/5997/7 "2015-06-22T22:13:11Z")

</div>

Hi David,

Thanks, all works fine…Jos
