FIR Filter and Signal to Noise ratios

In summary: The Attempt at a SolutionI believe that the width of each FIR filter would correspond to a specific gain for the output signal, would I be correct in assuming that the summation of the co-efficients would give me said answer?I am interviewing with Motorola for an internship, and have not completed my DSP coursework, since I am enrolled in it right now. Can anyone shed some light into what I need to do?No, that is not correct. The width of the FIR filter corresponds to the sampling rate of the signal. The filter's gain is determined by the width, not by the sum of the co-efficients.
  • #1
anolo
1
0

Homework Statement



A noisy but slowly-shifting sensor signal is being filtered with a low-pass, finite impulse response filter. What is the mean delay and expected SNR boost (noise standard deviation of output compared to input) for two filter variations:

N filter taps uniformly weighted: y[n] = (x[n] + ... + x[n - N + 1])/N
M filter taps harmonically weighted: z[n] = (M*x[n] + (M-1)*x[n-1] ... 1*x[n - M + 1])/(M*(M+1)/2)

What depths (N and M) for each setup are needed to boost the SNR by a factor of 5?
Which setup a) or b) has the lowest mean delay at the required depth?
Which setup would you recommend gives the best tradeoff between SNR and delay?

Homework Equations



The Attempt at a Solution



I believe that the width of each FIR filter would correspond to a specific gain for the output signal, would I be correct in assuming that the summation of the co-efficients would give me said answer?

I am interviewing with Motorola for an internship, and have not completed my DSP coursework, since I am enrolled in it right now. Can anyone shed some light into what I need to do?
 
Last edited:
Physics news on Phys.org
  • #2
Hello anolo,

Welcome to Physics Forums!

Well, it's been over a day, and nobody replied, so I'll give it a bite.

anolo said:

Homework Statement



A noisy but slowly-shifting sensor signal is being filtered with a low-pass, finite impulse response filter. What is the mean delay and expected SNR boost (noise standard deviation of output compared to input) for two filter variations:

N filter taps uniformly weighted: y[n] = (x[n] + ... + x[n - N + 1])/N
M filter taps harmonically weighted: z[n] = (M*x[n] + (M-1)*x[n-1] ... 1*x[n - M + 1])/(M*(M+1)/2)

What depths (N and M) for each setup are needed to boost the SNR by a factor of 5?
Which setup a) or b) has the lowest mean delay at the required depth?
Which setup would you recommend gives the best tradeoff between SNR and delay?

Homework Equations



The Attempt at a Solution



I believe that the width of each FIR filter would correspond to a specific gain for the output signal, would I be correct in assuming that the summation of the co-efficients would give me said answer?

Summing the coefficients turns out to be one small part of what needs to be done, but no, that alone will not give you your final answer.

It will however give you the signal gain at DC (i.e., 0 Hz). Imagine for a moment that the signal, ignoring noise, is a constant value of 1. s[n] = 1 for all n. If you then wanted to calculate the signal gain at the output of the filter, you would simply add up the filter coefficients. Since these are both lowpass filers, that's something you'll want to do, perhaps as a first step.

Go ahead and do this. You'll find that both filters are unity gain at DC. (Don't take my word for it, go ahead and do it yourself).

We also need to make an assumption here, that the bandwidth of the signal is close to DC. If the signal's bandwidth is greater than the filter's bandwidth, the filter would cut into the signal power, reducing the signal somewhat, along with the noise. But the problem statement never specified what the signal bandwidth was, so we have to assume it's close to DC, otherwise there wouldn't be enough information to solve our problem. The problem statement did say however, "slowly-shifting sensor signal," which equivalent to saying that the signal has a small bandwidth. So that justifies our assumption.

So now you can easily make a conclusion about the, the RMS signal amplitude at the output of each filter relative to the RMS signal amplitude at the input. [Edit: Hint: both filters are unity gain at DC. And by that I mean, since the signal power has low bandwidth, the signal power (and RMS amplitude) at the output of the filter is equal to the signal power (and RMS amplitude) at the input of the filter. But you should show this to yourself. :wink:]

Noise is a bit different though. Using superposition, treat each x[n] as the sum of a signal sample, and a noise sample.

x[n] = s[n] + xn[n],

where xn[n] is a random variable representing the noise. (I chose the variable xn[n] to represent the noise, but you should choose the variable that your coursework uses).

Note that xn[n], xn[n+1], xn[n+2], ... are independent of one another. (we're making another assumption here about the noise being white noise. But again, since the problem statement didn't say anything about the noise characteristics either, it's all we can do).

xn has a mean, μ and standard deviation, σ. Let's make another assumption that the average value of the noise is zero, making μ = 0. But we can't do that with the standard deviation though.

-----------------

Now here are some math that you are going to need to to solve the rest of this problem. When you add together random variables, the result has a mean which is the sum of the random variables' means. In other words,

xn[n] + xn[n+1] + xn[n+2]

has a mean of
μ + μ + μ = 3μ.
Of course this doesn't matter to us, since we already assumed that μ = 0.

The variances also add together. The sum of those three random variables gives a result having a variance of
σ2 + σ2 + σ2 = 3σ2.

The standard deviations do not simply add like that though. You need to calculate the variance of the sum first, and then take the square root to get the standard deviation of the result. [Edit: So in this case, summing together the three random variables like we did gives a result having the standard deviation of [itex] \sqrt{\sigma^2 + \sigma^2 + \sigma^2} [/itex] = (√3)σ].

----

Even more math:

In the process of solving this problem, you might find these relationships useful:

1 + 2 + 3 + 4 + ... + (n-1) + n = n(n+1)/2

12 + 22 + 32 + 42 + ... + (n-1)2 + n2 = n(n+1)(2n+1)/6
 
Last edited:
  • Like
Likes cellurl
  • #3
Oh, I forgot to mention about the average delay of the filter.

When calculating the average delay of the filter, it might be useful to consider the impulse response of the filter. The impulse response uses an input of s[n] = 1 at n = 0, and zero elsewhere.

Ignore noise when calculating the filter delay. Noise doesn't matter for this.

The following applies to unity gain, FIR filters. (If the filter is not unity gain, an additional scaling factor is necessary, which we won't worry about here.)

The average delay (in units of samples) is the sum of {the delay at each tap times the coefficient of that tap} for all taps.

In other words, each tap has an intrinsic, individual delay weighted by its coefficient. The average delay is the sum of these weighted, individual delays (this is true for a unity gain, FIR filter, btw. If it wasn't unity gain, you would need to scale everything by the reciprocal of the overall filter gain).

The delay of tap 0 is 0 samples.
The delay of tap 1 is 1 sample.
The delay of tap 2 is 2 samples.
The delay of tap 3 is 3 samples.
etc.
(That's before weighting the individual delays by their corresponding coefficients.)
 
Last edited:
  • #4
At the risk of rambling, let me bring up one last point about summing random variables. This is mostly self evident, but I figure it couldn't hurt.

Suppose the random variable xnoise has mean, μ, and standard deviation, σ.

When you scale a random variable by a constant, the resulting mean and standard deviation are also scaled by that constant. In other words, the mean of axnoise is . The standard deviation of axnoise is .

With only a small leap in logic, the variation (the square of the standard deviation) of axn is a2σ2. To calculate the scaled variation, we not only square the standard deviation of the original random variable, but also we square the scaling factor.

So if we sum together individually scaled random variables,

a0xnoise[n] + a1xnoise[n-1] + a2xnoise[n-2] + ... + aM-1xnoise[M-1]

The resulting mean is
a0μ + a1μ + a2μ + ... + aM-1μ
= μ(a0 + a1 + a2 + ... + aM-1)

[Edit: As already said though, for this problem we are making the assumption that the mean of the noise is zero. So summing the individual means don't really matter for this particular problem.]

But before we move onto the standard deviation, remember we can not add standard deviations so simply. We must calculate the resultant variance first.

The resulting variance of that sum is
a02σ2 + a12σ2 + a22σ2 + ... + aM-12σ2
= σ2(a02 + a12 + a22 + aM-12)


Only now we can find the resulting standard deviation, the square root of the variance, which is
[itex] \sigma \sqrt{a_0^2 + a_1^2 + ... + a_{M-1}^2} [/itex]
 
Last edited:
  • #5
Hello collinsmark,

A quick question. For computing the mean delay, you mentioned ...

"each tap has an intrinsic, individual delay weighted by its coefficient. The average delay is the sum of these weighted, individual delays.
"

What is the basis of this observation? Could you point me to some references where I can study this in more detail?

Thanks a lot!
 
  • #6
Wow. It's been well over a year since I wrote that. I don't recall my original thought process, but I think I was referring to the delay in the particular case where the input signal was white noise. [Edit: then again, that doesn't necessarily make sense. Hmm. What was I thinking at the time. -- Oh, maybe assuming that the filter response is lowpass, then the delay at DC. Or this might be even better: the delay of the output signal, for an input signal that is an impulse (also assuming a lowpass response).]

Anyway, don't forget that my quoted comment applies to unity gain FIR filters (unity gain at DC). If the filter is not unity gain, you need to scale it accordingly, before delay calculations.

Finding the delay of an FIR filter is pretty straightforward if the filter is symmetric. That's because a symmetric FIR filter has generalized linear phase, and has zero phase distortion. The delay is constant over all frequency.

But if the filter is not symmetric, you can't say that. So the group delay might be a function of frequency.

As far as references go, if you can't find any, recall that the group delay is negative derivative of the phase response. In other words, the negative slope of the phase.

----

Another edit:

I remember now. Don't worry about the group delay as a function of frequency; the problem statement asks about the "mean delay," i.e., average delay. Assuming the response is lowpass and unity gain (unity gain at DC), look at the filter's impulse response. Calculate the "center of weight," so to speak, of the impulse response. That's what I meant by the average delay of the filter.
 
Last edited:
  • #7
Got it. Thanks!
 
  • Like
Likes collinsmark
  • #8
Hello Collinsmark!

Since it's been more than an year from the time the question was first posted, can you give exact answers? Specifically to the following questions.
1. What is the mean delay and expected SNR boost (noise standard deviation of output compared to input) for two filter variations.
2. What depths (N and M) for each setup are needed to boost the SNR by a factor of 5?
3. Which setup a) or b) has the lowest mean delay at the required depth?
4. Which setup would you recommend gives the best tradeoff between SNR and delay?

I have some idea, but I just want to make sure if my intuition is correct. Thanks.
 
  • #9
whatever said:
Hello Collinsmark!

Since it's been more than an year from the time the question was first posted, can you give exact answers? Specifically to the following questions.
1. What is the mean delay and expected SNR boost (noise standard deviation of output compared to input) for two filter variations.
2. What depths (N and M) for each setup are needed to boost the SNR by a factor of 5?
3. Which setup a) or b) has the lowest mean delay at the required depth?
4. Which setup would you recommend gives the best tradeoff between SNR and delay?

Sorry, but per the forum rules you'll have to work out the answers yourself. The good news is that working out the answers yourself is more rewarding then getting them from somebody else -- even me. o0):smile:

But as far as hints go, the posts above involving the summing of weighted, random variables should help with the SNR part of the questions.

To find the mean delay, just look at the impulse response of the filter in question. Imagine that the impulse response has mass and that you're tying to balance it on its center of gravity. The pivot point (on the time axis) is the mean delay of the filter.
 
Last edited:
  • #10
Hi Collins,

Can you explain the reasoning behind the statement and its assumptions "Assuming the response is lowpass and unity gain (unity gain at DC), look at the filter's impulse response. Calculate the "center of weight," so to speak, of the impulse response." Is there any theory behind this? Can you point me to some source.

Thanks
 
  • #11
ultramarine said:
Hi Collins,

Can you explain the reasoning behind the statement and its assumptions "Assuming the response is lowpass and unity gain (unity gain at DC), look at the filter's impulse response. Calculate the "center of weight," so to speak, of the impulse response." Is there any theory behind this? Can you point me to some source.

Thanks
In terms of the filter being unity-gain, consider the special case DC input, where x[n] = 1, for all n. (In other words, x[n] = 1, x[n - 1] = 1, x[n - 2] = 1, etc.) In this case, what are y[n] and z[n]?

The output of the filter's first variation, y[n] = (x[n] + ... + x[n - N + 1])/N should be pretty easy to calculate with this special case, constant, DC input.

The filter response of the second variation, z[n] = (M*x[n] + (M-1)*x[n-1] ... 1*x[n - M + 1])/(M*(M+1)/2) is a bit trickier for this DC input. But you might find that my hints given near the end of Post #2 might come in useful. :wink:

As far as the comment about the "Center of weight" goes, your textbook might have good information about how to calculate the group delay of a filter. [Edit: and given the way the problem was phrased, I'm assuming the delay the problem statement is looking for is the "weighted average" delay of an impulse. I suppose I might be making a bit of an assumption on that though.] You'll find much of it found through analyzing the impulse response of a filter.

If you'd rather figure some of this out on your own, start by putting a unit impulse through the filter, where x[0] = 1, and x[n] = 0 for all n ≠ 0. Obviously the peak of the input occurs at n = 0. And the weighted "bulk" of the input is concentrated completely at n = 0. But where is the average "bulk" -- the weighted center, if you will -- of the output*?

*(Edit: The hints near the end of Post #2 might come in useful for this exercise too. :wink:)
 
Last edited:
  • #12
ultramarine said:
Hi Collins,

collinsmark said:
In terms of the filter being unity-gain, consider the special case DC input, where x[n] = 1, for all n. (In other words, x[n] = 1, x[n - 1] = 1, x[n - 2] = 1, etc.) In this case, what are y[n] and z[n]?

The output of the filter's first variation, y[n] = (x[n] + ... + x[n - N + 1])/N should be pretty easy to calculate with this special case, constant, DC input.

The filter response of the second variation, z[n] = (M*x[n] + (M-1)*x[n-1] ... 1*x[n - M + 1])/(M*(M+1)/2) is a bit trickier for this DC input. But you might find that my hints given near the end of Post #2 might come in useful. :wink:

As far as the comment about the "Center of weight" goes, your textbook might have good information about how to calculate the group delay of a filter. [Edit: and given the way the problem was phrased, I'm assuming the delay the problem statement is looking for is the "weighted average" delay of an impulse. I suppose I might be making a bit of an assumption on that though.] You'll find much of it found through analyzing the impulse response of a filter.

If you'd rather figure some of this out on your own, start by putting a unit impulse through the filter, where x[0] = 1, and x[n] = 0 for all n ≠ 0. Obviously the peak of the input occurs at n = 0. And the weighted "bulk" of the input is concentrated completely at n = 0. But where is the average "bulk" -- the weighted center, if you will -- of the output*?

*(Edit: The hints near the end of Post #2 might come in useful for this exercise too. :wink:)

Thank you! I have solved both the problems. I found some good resources to calculate group delay in a textbook.

Thanks
 
  • #13
Hi Ultramarine and Collinsmark,

Can you please tell me how you got the group delay of the harmonic weighted filter?
 

FAQ: FIR Filter and Signal to Noise ratios

What is a FIR filter and how does it work?

A Finite Impulse Response (FIR) filter is a type of digital filter used to process a discrete-time signal. It works by convolving the input signal with a finite sequence of coefficients (called the impulse response) to produce an output signal. The filter's impulse response determines its frequency response, which affects the filtering of the input signal.

How does a FIR filter affect the signal to noise ratio?

A FIR filter can improve the signal to noise ratio by filtering out unwanted noise from the input signal. By removing noise, the filtered signal becomes clearer and easier to analyze, thus increasing the signal to noise ratio.

What is the importance of the signal to noise ratio in scientific research?

The signal to noise ratio is an essential measure in scientific research as it indicates the quality and reliability of the collected data. A higher signal to noise ratio means that the signal is stronger compared to the noise, which improves the accuracy and precision of the data analysis.

How can one optimize the signal to noise ratio using a FIR filter?

To optimize the signal to noise ratio, one can adjust the filter's parameters, such as the number of coefficients or the filter order. Higher filter orders and more coefficients can lead to better noise reduction, but it also increases the computational complexity and may introduce artifacts in the filtered signal.

Can a FIR filter be used for both analog and digital signals?

Yes, a FIR filter can be used for both analog and digital signals. For analog signals, the input signal is converted to a discrete-time signal using an analog-to-digital converter before being processed by the filter. For digital signals, the filter directly processes the discrete-time signal without the need for conversion.

Similar threads

Back
Top