Bode plot in MatLab for given transfer function

Discussion in 'General Electronics Chat' started by Fluxxx, Jun 21, 2015.

  1. Fluxxx

    Thread Starter New Member

    Jun 21, 2015
    3
    0
    In this video

    it is explained how to plot the Bode diagram for a given transfer function. I included some snapshots from the video.
    [​IMG]
    [​IMG]
    Here are the Bode diagrams, being drawn about 9 minutes into the video:
    [​IMG]
    However, when I try to plot this same thing with the bode function in MatLab, the phase plot is different.
    The phase function is given as
    [​IMG]
    Here's a screenshot of the Bode diagrams that MatLab plots:
    [​IMG]
    As you can see although the magnitude plot is the same as in the video, the phase plot is different. Although it's still showing zero degrees for low frequencies, for high frequencies it shows a phase shift of +90° instead of -90° like in the video. Why?

    Here's my MatLab code:
    Code (Text):
    1. s=zpk('s');
    2. p1=-1;
    3. Hs=1/(1+s/p1);
    4. bode(Hs);
    As you can see I put in the value p1=-1 for the pole, same as in the video.

    I think the video explains very well how to plot the Bode diagram. For the phase function given above, where φ=arctan(-ω/ω0), you can see the expession -ω/ω0 cannot be >0 since frequency is always positive, so the phase will be only be ≤0. It seems to me that the video shows a correct phase plot which is -90° for HF, while MatLab seems to plots it incorrectly, since it shows a positive phase, which should not be possible.

    So why doesn't MatLab plot the phase correctly?
     
    Last edited: Jun 21, 2015
  2. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Confirmation that the phase is negative:
    Laplace.gif
     
  3. Fluxxx

    Thread Starter New Member

    Jun 21, 2015
    3
    0
    I'm suspecting that this way of writing:
    Code (Text):
    1. Hs=1/(1+s/p1)
    is incorrect (but why?), because, if I instead write
    Code (Text):
    1. Hs=1/(1+s)
    then it's correct! The problem then, is that this expression doesn't include the variable p1, which is given as
    Code (Text):
    1. p1=-1
    which I want to include in the expression. So I want to be able to write the transfer function algebraically, with a variable p1 for the pole, like I did first. How should I write then in order to make it correct?
     
  4. Brownout

    Well-Known Member

    Jan 10, 2012
    2,375
    998
    "S" is a negative pole at -1 as a solution to the equation s + 1 = 0. That's how you calculate the pole. However, you don't use the negative for s in the transfer function. If you did, you would get an incorrect result when solving the equation above.
     
  5. Fluxxx

    Thread Starter New Member

    Jun 21, 2015
    3
    0
    I'm not exactly sure what you mean the pole value gives an incorrect answer, the pole value is what makes the transfer function go to infinity. Unfortunately this doesn't answer my question though. The question is rather about the MatLab code.
     
  6. Brownout

    Well-Known Member

    Jan 10, 2012
    2,375
    998
    Sorry if I confused you. My answer wan't exactly precise. When plotting a transer function, you enter the funciton. The pole is not a part of the function, ranther it is a soluiton for the denominator. It doens't belong in the function you are plotting.
     
Loading...