1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Bode Plot in Matlab

  1. Aug 15, 2014 #1
    1. The problem statement, all variables and given/known data

    I'm trying to make a theoretical Bode plot of a High pass filter (made up of a capacitor and a resistor). The transfer function is:

    ##T=\frac{V_{out}}{V_{in}}= \frac{R}{R+1/(j\omega C)} = \frac{1}{1-j\omega_0 / \omega}##

    With a corner frequency of 5 kHz or in radians:

    ##\omega_0 = \frac{1}{RC} = \frac{1}{(1440.96 \Omega)(22 \ nF)}##

    3. The attempt at a solution

    I rewrote the transfer function as:

    ##\frac{s}{s+\omega_0}## where s=jω

    And used the following code:

    And here is what I got:

    qrdjc7.jpg

    Clearly this is wrong, it is not the graph of a high-pass filter. Here is my experimental result (how the curve should look like):

    iqg9vp.jpg

    So what is wrong with my code? :confused:

    Any help is greatly appreciated.
     

    Attached Files:

  2. jcsd
  3. Aug 15, 2014 #2
    MATLAB usually expects that when you're working with transfer functions, they're expressed in the complex variable of the Laplace transform. You can make things easier for yourself if you instead use:
    [tex]
    \frac{V_\mathrm{out}}{V_\mathrm{in}} = \frac{R}{R + \frac{1}{s C}}
    [/tex]
    Both commands 'bodeplot' and 'bode' expect an argument of 'Dynamic System Model' type. Here's a trick you can use to make your code more readable when creating these objects:
    Code (Text):

    s = tf('s');
    sys = R/(R + 1/(s*C));
     
    Maybe give that a try.
     
  4. Aug 16, 2014 #3
    Thank you so much for the prompt reply. I modified my code as you instructed, and the resulting curve looks correct (I get the 5kHz corner frequency where required). :)
     
  5. Aug 23, 2014 #4

    jhae2.718

    User Avatar
    Gold Member

    I'm late to the party, but the problem is you've defined the transfer function incorrectly.
    Code (Text):

    N=[1];
    D=[1 w];
     
    will produce[tex]\frac{1}{s+\omega_0};[/tex]to get the desired TF of[tex]\frac{s}{s+\omega_0}[/tex]you need to do
    Code (Text):

    N=[1 0];
    D=[1 w];
     
    The vectors defining the numerator and denominator of the TF are descending powers of [itex]s[/itex], so you need [itex][s^1\;s^0][/itex].
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Bode Plot in Matlab
  1. Bode Plot Plotting (Replies: 1)

  2. Bode Plot (Replies: 5)

  3. Bode Plot question (Replies: 2)

Loading...