Bode plot in MatLab for given transfer function

Thread Starter

Fluxxx

Joined Jun 21, 2015
3
In this video
it is explained how to plot the Bode diagram for a given transfer function. I included some snapshots from the video.


Here are the Bode diagrams, being drawn about 9 minutes into the video:

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

Here's a screenshot of the Bode diagrams that MatLab plots:

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:
s=zpk('s');
p1=-1;
Hs=1/(1+s/p1);
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?
 

Attachments

Last edited:

Thread Starter

Fluxxx

Joined Jun 21, 2015
3
I'm suspecting that this way of writing:
Code:
Hs=1/(1+s/p1)
is incorrect (but why?), because, if I instead write
Code:
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:
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?
 

Brownout

Joined Jan 10, 2012
2,390
"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.
 

Thread Starter

Fluxxx

Joined Jun 21, 2015
3
"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.
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.
 

Brownout

Joined Jan 10, 2012
2,390
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.
 
Top