• Support PF! Buy your school textbooks, materials and every day products Here!

Filter graphing help

7
0
1. Homework Statement
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. Homework 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.
 

berkeman

Mentor
55,934
5,980
1. Homework Statement
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. Homework 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.
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.
 
7
0
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.

I'm confused. so I just plug in 1's and 0's into the formula?
 

berkeman

Mentor
55,934
5,980
I'm confused. so I just plug in 1's and 0's into the formula?
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.
 
7
0
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.
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.
 

berkeman

Mentor
55,934
5,980
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.
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.
 
7
0
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.
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?
 

berkeman

Mentor
55,934
5,980
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?
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.
 

collinsmark

Homework Helper
Gold Member
2,849
1,171
1. Homework Statement
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. Homework 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.
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.
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.
@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:

berkeman

Mentor
55,934
5,980
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.
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:
 
7
0
I'm still confused by this :/
 

Attachments

Related Threads for: Filter graphing help

Replies
3
Views
601
  • Last Post
Replies
7
Views
21K
  • Last Post
Replies
1
Views
6K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
0
Views
4K
  • Last Post
Replies
6
Views
679
Replies
5
Views
3K
  • Last Post
Replies
5
Views
14K
Top