Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Decimation Filter SNR Improvement

Status
Not open for further replies.

stenzer

Advanced Member level 3
Joined
Oct 1, 2012
Messages
864
Helped
122
Reputation
248
Reaction score
185
Trophy points
1,323
Activity points
8,925
Hi,

I'm curious how a FIR decimation filter improves the Signal to Noise Ratio of a digitized signal. I have read a decimation by N = 2 leads (theoretically) to an improvement of 3 dB. So where does this 3 dB come from?

By having a look at Oppenheim's Signals & Systems, I have seen that the frequency spectrum is widened by the decimation factor (so -w_M to +w_M gets -2.w_M to +2.w_M for N = 2). So I assume, for a constant noise power in the range of -w_M to +w_M, the same "amount" of noise is spread in the range of -2.w_M to +2.w_M, for a decimation of 2.

Thus a decimation by N = 2 (-2.w_M to +2.w_M) in combination with a low pass filter which reduces the bandwidth by N = 2 (-> -w_M to +w_M) leads to the same bandwith, with a reduced noise contribution by N. So for N = 2, the noise bandwidth is halved and leads to a reduction of sqrt(2), where the effective voltage noise V_M is determined by V_n = e_n . sqrt(Bandwidth), with e_n as the voltage noise spectrale densety in V/sqrt(Hz). This leads to 20.log10(sqrt(2)) = 3 dB.

Are my thoughts correct, or have I missed something?

BR
 

I'm curious how a FIR decimation filter improves the Signal to Noise Ratio of a digitized signal.

This really depends on your assumptions about the signal and the noise. More specifically, it depends on their frequency spectra (i.e. power spectral densities). A decimating filter filters out and discards part of the frequency band. If that part of the band contains more noise power than signal power, then you are left with proportionally more signal power afterwards (i.e. the SNR is increased). However, if the part you discard contains more signal than noise, then your SNR will of course decrease.

I have read a decimation by N = 2 leads (theoretically) to an improvement of 3 dB. So where does this 3 dB come from?

If you decimate by a factor of 2, then half of the frequency band is discarded and half is retained. If we assume that (i) The noise is "white" (i.e. spectrally flat: the power spectral density is equal across the whole band) and (ii) the signal power is contained entirely within the retained half of the band, then that would mean you've halved the noise power, while the signal power remains unchanged. In other words, the SNR has doubled (increased by about 3dB).

Note that this result is entirely dependent on the nature of these two assumptions. For example, if all of the noise power were instead contained within the discarded half of the band, then you would have ended up with no noise at all (i.e. an infinite SNR). Or, if all the signal power were instead contained within the discarded half of the band, then we would have ended up with no signal (i.e. an SNR of zero). If the noise were not spectrally flat, but some other arbitrary shape, then the resulting SNR could be any other number, depending on what is left after the decimating filter has been applied.

I have seen that the frequency spectrum is widened by the decimation factor

It is important to understand why this is incorrect. Decimation does not widen the spectrum, it narrows it (since some frequency content is discarded). However, if the author of the book plots the decimated spectrum on a graph with the same width (in centimetres) as the original spectrum, then it will look like it has been stretched horizontally (because the horizontal scaling has changed to fit a smaller frequency span across the same number of centimetres). I have never understood why textbooks do this. It is much clearer to plot the decimated spectrum with the same scaling as the input. It is then clear that the stuff near DC (usually the "signal") has remained unchanged and the graph itself has become narrower (i.e. the spectrum is narrower).
 
Last edited:

Hi weetabixharry,

thank you for your reply. I completely agree with your explanations. Thx!

The only point I still confused is the following one....

It is important to understand why this is incorrect. Decimation does not widen the spectrum, it narrows it (since some frequency content is discarded). However, if the author of the book plots the decimated spectrum on a graph with the same width (in centimetres) as the original spectrum, then it will look like it has been stretched horizontally (because the horizontal scaling has changed to fit a smaller frequency span across the same number of centimetres). I have never understood why textbooks do this. It is much clearer to plot the decimated spectrum with the same scaling as the input. It is then clear that the stuff near DC (usually the "signal") has remained unchanged and the graph itself has become narrower (i.e. the spectrum is narrower).

By having a look in the mentioned textbook, not only the figure of the frequency spectrum is widened by the decimation, this is also mentioned in the text. "... the effect of decimation is to spread the spectrum of the original sequence over a larger portion of the frequency band."

BR
 

"... the effect of decimation is to spread the spectrum of the original sequence over a larger portion of the frequency band."

I consider this at best misleading and, in my opinion, simply wrong. Yes, you could argue that after decimation the sequence occupies proportionally more of the remaining spectrum, but that is really because less of the spectrum remains, not because the signal's frequency content has been widened or "spread" in any way. I really don't like it when textbooks take this perspective. Perhaps this perspective is more useful in some area of study that I have never encountered. However, to me it greatly confuses matters.

Are you familiar with Matlab? I could write up a few lines of code that would demonstrate this all clearly.
 

Hi weetabixharry,

yes, I'm familiar with Matlab. It would be great if you share some code.

BR & THX
 

Here's something I threw together very quickly using GNU Octave. I don't have a Matlab licence, so I'm not sure if all the function calls will behave the same. Part (1) just generates a signal + noise (as an example, I generated a digital QPSK signal ... but you can ignore part (1) if you want). Part (2) does the decimation that you're interested in.

The code looks quite bulky, but much of that is actually just plotting the graphs.

I'll add some description and screenshots of the graphs when I have some time later.


Code Matlab M - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
close all; clear all; clc;
 
% ****************************
% (1) CREATE A SIGNAL + NOISE
% ****************************
 
% Generate some binary data for our "signal"
Nbits = 8192;
data = randi([0,1],Nbits,1);
 
% Let's modulate the data as QPSK and say the baud rate is 10kHz.
syms = bi2de(reshape(data,2,[]).');
x = exp(1j*2*pi*syms/4);
fbaud = 1e4;
 
% Upsample to 10x baud rate
upsamp = 10;
y = resample(x,upsamp,1); % (let Matlab use its default interpolation filter)
fsamp_y = fbaud * upsamp;
 
% Add some noise. Let's give it about 1% of the signal power (SNR ~20dB).
Psig = y'*y / length(y);
n = sqrt(0.01 * Psig) * complex(randn(size(y)), randn(size(y))) / sqrt(2);
z = y + n;
fsamp_z = fsamp_y;
% Print the actual SNR in dB. 
SNRdb = 10*log10((y'*y) / (n'*n))
 
% Plot the QPSK constellation
figure();
plot(z(1:upsamp:end),'x');
grid on; axis equal;
xlabel('Real'); ylabel('Imag')
title('Noisy QPSK constellation');
 
% Compute spectrum
Nfft = 1024;
Pz = pwelch(z,hann(Nfft),[],[],fsamp_z);
% Unwrap spectrum
Pz = fftshift(Pz);
f = [ -(ceil((Nfft-1)/2):-1:1), 0, (1:floor((Nfft-1)/2)) ] * fsamp_z / Nfft;
% Plot spectrum
figure();
plot(f, 10*log10(Pz));
axis tight; grid on;
xlabel('Freq (Hz)'); ylabel('PSD (dB)');
title('Spectrum of 10x oversampled signal');
 
% *************************
% (2) DECIMATE AND COMPARE
% *************************
 
% Decimate and retain whatever default filter, h, is used
downsamp = 4;
[zdec, h] = resample(z,1,downsamp);
fsamp_zdec = fsamp_z / downsamp;
 
% Compute the frequency response of the decimating filter
H = freqz(h,1,Nfft,"whole",fsamp_z);
% Unwrap spectrum
H = fftshift(H);
 
% Compute spectrum of decimated signal with the same resolution as before
Nfft_zdec = Nfft/downsamp;
Pzdec = pwelch(zdec,hann(Nfft_zdec),[],[],fsamp_zdec);
% Unwrap spectrum
Pzdec = fftshift(Pzdec);
fzdec = [ -(ceil((Nfft_zdec-1)/2):-1:1), 0, (1:floor((Nfft_zdec-1)/2)) ] * fsamp_zdec / Nfft_zdec;
 
figure(); hold on;
ax = plotyy(f, 10*log10(Pz), f,10*log10(abs(H)));
plot(fzdec, 10*log10(Pzdec), '--g');
axis tight;
grid on;
legend('Decimated Signal + Noise', 'Input Signal + Noise', 'Filter');
line([-1,-1]*fsamp_zdec/2,ylim,'LineStyle','--','Color','k');
line([1,1]*fsamp_zdec/2,ylim,'LineStyle','--','Color','k');
xlabel('Freq (Hz)'); ylabel(ax(1), 'PSD (dB)'); ylabel(ax(2), '(dB)');

 
  • Like
Reactions: stenzer

    stenzer

    Points: 2
    Helpful Answer Positive Rating
Here's some description...

Part (1) of the code generates some signal + noise. For this example, I chose to generate a QPSK signal with a baud rate of 10 kHz. I upsampled it 10x to get a sample rate of 100 kHz. I added noise to get an SNR of 20dB.

As a sanity check, I plotted every 10th sample (i.e. the QPSK symbol points) on a scatter plot to ensure I get what I expect (i.e. noisy clusters around the 4 symbol points 1, j, -1 and -j):

fig1.png

I also plot the spectrum to check that makes sense. We see a flat noise floor (because the noise is additive white Gaussian) with a strong signal component occupying the central 10% of the spectrum (because the baud rate is 10% of the sample rate and the interpolation filter filtered accordingly):

fig2.png

Part (2)
is the interesting part in relation to your original question. First, we downsample by a factor of 4 (leaving a sample rate of 25 kHz, or 2.5x the baud rate). We then plot the spectrum of the decimated signal on the same graph as the original signal. We can see that (across the 25 kHz band where the decimated signal exists) the two are virtually identical. If you inspect them closely, you will see they are only noticeably different at the extreme edges of the band. This is because our FIR filter (i.e. the anti-aliasing filter used in decimation) is not an ideal rectangle in the frequency domain. I plot the frequency response of the filter on the same graph so you can see how it slightly rolls off at the edge of the band.

fig3.png

So hopefully you can see that decimation has not widened the spectrum; it has narrowed it.

I have assumed quite a lot of prior knowledge (e.g. complex baseband signal representation, log/decibel plots) so please let me know if anything needs further explanation.
 
  • Like
Reactions: stenzer

    stenzer

    Points: 2
    Helpful Answer Positive Rating
Hi weetabixharry,

thank you for sharing the code and for your explanation. Unfortunatly my MATLAB studend license expired. So, I will try OCTAVE.

I will reply agein, wehn I have managed to install OCTAVE.

Thx & BR
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top