1. Not finding help here? Sign up for a free 30min 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!

Filter graphing help

  1. May 10, 2016 #1
    1. The problem statement, all variables and given/known data
    Calculate and graph the response of the filter:

    y(n) = ½*x(n) + ½*x(n-1)

    at the frequencies: i) 0 Hz, ii) sr/4, iii) sr/2 (Nyquist frequency).

    2. Relevant equations


    3. The attempt at a solution
    If I put each of those into the formula as n? But how do i know what sample rate/4 is? I'm guessing that it's a low pass.
     
  2. jcsd
  3. May 10, 2016 #2

    berkeman

    User Avatar

    Staff: Mentor

    Yes, it does look like a lowpass filter. Your sample rate is just integers -- 1, 2, 3, 4, etc. The SR/2 is just every other sample, the SR/4 is just every 4th sample, etc.

    So can you show us what you get for the frequencies above? Just input 1's and 0's as indicated.
     
  4. May 10, 2016 #3

    I'm confused. so I just plug in 1's and 0's into the formula?
     
  5. May 10, 2016 #4

    berkeman

    User Avatar

    Staff: Mentor

    I'm assuming the x() are the inputs and y() is the output, right? So for the first DC case, input all 1's and see what you get for the y(n) outputs. Then for an input frequency of SR/2, you would have alternating 1's and 0's. For SR/4, you would have two 1's in a row followed by two 0's in a row, and so on. You should then be able to keep lowering the frequency of the input variations to see what kind of a frequency response you get.
     
  6. May 10, 2016 #5
    That makes more sense but how do I get the all ones, one zero one zero and two ones two zeros part? is that always the same?. Thankyou for the help.
     
  7. May 10, 2016 #6

    berkeman

    User Avatar

    Staff: Mentor

    You just work it out by hand, I guess. Alternately you can do this in Excel -- I do a lot of my basic digital filter checks in Excel. You just make a column for n that counts 1, 2, 3, 4, ... And then the next column is x(n), and the next column is y(n). You put a formula into the 2nd cell down for y(n) so you can add the x(n) and x(n-1) terms using the formula you were given. Then just click that y(2) cell and drag it down a ways, and do a Fill-Down. That pastes the formula into all the cells in that column.

    You would make Excel sheets for each of the input sequences. One for the DC case where x(n)=1 for all n, one for the SR/2 case where you alternate 1/0 in each row, etc.
     
  8. May 10, 2016 #7
    Sorry i'm just getting more confused. Where did you get the 1 for all n from and the alternate one. How do you know its 1 for all n and alternating?
     
  9. May 10, 2016 #8

    berkeman

    User Avatar

    Staff: Mentor

    This is for a digital filter, right? So the input to the digital filter is a single bit that can take values of 0 or 1, and can change for each n. You can have an input bitstream that is 100 bits long, numbered n=1, n=2, n=3, etc.

    The problem asks you what the output of your filter equation is for frequency = 0Hz. That means that the input value is holding steady at either a 0 or a 1 always for the whole bitstream. Having x(n) = 0 for the whole bitstream is pretty uninteresting, so instead set them all to 1. The output of your digital filter equation for each value of n will be the response of the filter to a DC input signal of x(n) = 1.

    Then to find out what the response of the filter is to the highest frequency input that you can have, you want to make the x(n) alternate between 0 and 1 each time. That looks to be what they are calling the SR/2 case. Then you can do lower frequencies like SR/4 by changing the x(n) in each row of your spreadsheet more slowly.
     
  10. May 10, 2016 #9

    collinsmark

    User Avatar
    Homework Helper
    Gold Member

    @berkeman, I'm not sure if that's that's quite right. I don't see any indication in the problem statement that the filter is quantized in amplitude. It is obviously a discrete-time filter, in that it is quantized in the time domain, but as far as I can tell the amplitudes can take on any value.

    To me it appears that the problem statement is asking for the frequency response, where the input function is assumed to be sinusoidal such as
    [tex] x[n] = A e^{j \frac{\omega}{\omega_s} n} [/tex]
    where
    [tex] e^{j \theta} = \cos \theta + j \sin \theta, [/tex]
    [tex] \omega = 2 \pi f, [/tex]
    [tex] \omega_s = 2 \pi f_s, [/tex]
    and for this particular problem,
    [tex] f = 0 \ \mathrm{Hz}, \ \frac{f_s}{4}, \ \frac{f_s}{2}. [/tex]

    @MYMLA should be able to confirm that. MYMLA, is there there a specific input waveform, [itex] x[n] [/itex], that you are expected to use or is the input assumed to be sinusoidal?

    What's not clear in the problem statement though if it is asking to calculate and graph the frequency response or the transient response.

    If you are being asked to calculate the frequency response, [itex] H(e^{j \frac{\omega}{\omega_s}}) = \frac{Y(e^{j \frac{\omega}{\omega_s}})}{X(e^j {\frac{\omega}{\omega_s}})} [/itex], there is more than one way to approach the problem. You could take the discrete-time Fourier transform of the impulse response, [itex] h[n] [/itex], or you could calculate the steady-state ratio of [itex] \frac{y[n]}{x[n]} [/itex] (the "steady state" ratio assumes that [itex] n [/itex] approaches infinity, but that's easy here since the filter has a finite impulse response. This latter method also assumes that [itex] x[n] [/itex] is sinusoidal as expressed above [i.e., [itex] x[n] = A e^{j \frac{\omega}{\omega_s} n} [/itex] ]). Note that the frequency response is complex, and has a varying magnitude and phase as function of the input frequency.

    If you are being asked to calculate the transient response (instead of the frequency response), then you need a specific input signal. I sort of doubt this is what is being asked of you unless the problem gives you more information than was given here.

    [Edit: The "impulse response" of which I spoke earlier, is special case of the transient response where the input signal is [itex] x[n] = \delta[n] [/itex]. This is an easy to calculate waveform for a FIR filter. The discrete-time Fourier transform of the impulse response is the filter's "frequency response," as expressed as a function of frequency.]
     
    Last edited: May 10, 2016
  11. May 10, 2016 #10

    berkeman

    User Avatar

    Staff: Mentor

    You may be right. At the very least the values x(n) could be multi-bit values, rather than the single-bit example I was thinking of. And the filter response would be a lot clearer if the values could be multi-bit. Thanks for seeing that. :smile:
     
  12. Mar 11, 2017 #11
    I'm still confused by this :/
     

    Attached Files:

  13. Mar 12, 2017 #12

    collinsmark

    User Avatar
    Homework Helper
    Gold Member

    Sorry, but I'm confused too. :confused:
     
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: Filter graphing help
  1. Help graph (Replies: 6)

  2. Graph Help (Replies: 1)

  3. Help with graphs (Replies: 5)

  4. Help with graphs (Replies: 4)

  5. Help with graphs (Replies: 4)

Loading...