Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 7 Over-Sampling and Multi-Rate DSP Systems.

Similar presentations

Presentation on theme: "Chapter 7 Over-Sampling and Multi-Rate DSP Systems."— Presentation transcript:

1 Chapter 7 Over-Sampling and Multi-Rate DSP Systems

2 Objectives Describe the anti-aliasing problem and its solution with over-sampling. Demonstrate the details of digital anti-aliasing and anti-imaging. Demonstrate the processes of down-sampling (decimation) and up- sampling (interpolation) to change the effective sampling rate of a digital signal. Show that interpolation is accomplished by up-sampling and a gain-adjusted low-pass filter. Demonstrate the process of rational rate conversion by cascaded interpolation and decimation. Derive the relationship between sampling rate and the spectral density of random noise. Demonstrate the de-noising of signals with over-sampling. Describe the process of delta-sigma quantization and derive the transfer functions for a first-order noise-shaping quantizer. Demonstrate the process of delta-sigma quantization and the recovery of a quantized signal by low-pass filtering

3 The Anti-Aliasing Problem If a signal contains a band-width of interest, W, then the minimum sampling frequency is 2W (Nyquist requirement) However, to prevent aliasing, the signal must be analog pre-filtered to a band-width of f s /2 prior to sampling If the signal contains frequency components or noise beyond W, the analog low-pass filter (anti-aliasing filter) must be impractically sharp if sampling is done at 2W Solution: Multi-rate processing – Over-sample the signal at a rate considerably higher than 2W and band-width limit the signal with a sharp digital low-pass filter –Down-sample the signal digitally to an effective rate 2W after digital filtering –This allows the use of a simple analog anti-aliasing filter

4 Why Does Over-Sampling Help Anti-Aliasing? 1f s 0f s 2f s Over-sampled WW Nyquist-sampled WW Magnitude Responses of Required Anti- Aliasing Analog Filters

5 Aliasing Noise Example Suppose a communications speech signal has a bandwidth of interest of 4 kHz. The signal is bandwidth-limited by a 2 nd order Butterworth analog filter (fc = 4 kHz) prior to sampling. Compare the aliasing noise at 3 kHz for: –fs = 8 kHz (Nyquist sampling) –fs = 128 kHz (16x over-sampling)

6 Aliasing Noise Example % Use M-file ALIASNOISE=alias_effect_mag(filterorder,fc,fs,f1 >> alias_effect_mag(2,4000,8000,3000); figure, >> alias_effect_mag(2,4000,128e3,3000 );

7 Digital Anti-Aliasing and Anti-Imaging Simple Analog LP Filter High Rate Sampling (ADC) Digital LP Filter Down-sample to Nyquist Rate Up-sample to high rate Digital LP FilterDAC at High Rate Simple Analog LP Filter Anti-Aliasing Step Anti-Imaging Step Decimation Interpolation

8 Down-Sampling and Decimation Removal of samples is called down-sampling Down-sampling by a factor N reduces the effective sampling frequency by the same factor. That is, the new sampling frequency is f s /N To prevent aliasing, the down-sampled signal should be band-width limited to f s /2N by low- pass filtering prior to sample removal Low-pass filtering followed by down-sampling is called decimation

9 Down-Sampling a Sinusoid >> [ysin,tsin]=analog(100,1,30,8000); >> stem(ysin),title('100 Hz Sinusoid Sampled at 8 kHz') >> xlabel('Sample') >> dysin=downsample(ysin,4); >> figure,stem(dysin); >> title('100 Hz Sinusoid Sampled at 8 kHz, Down-Sampled by 4x') >> xlabel('Sample')

10 Down-Sampling a Sinusoid


12 Decimation With decimation, low-pass filtering precedes down-sampling to prevent aliasing. Example: Decimating a 100 & 1200 Hz signal by a factor of 4 with the MATLAB decimate command >> x=analog([100,1200],[1,1],1000,8000); >> xd4=downsample(x,4); % Effective sampling frequency is now 2000 Hz >> xdecim4=decimate(x,4); % The LP filter will have a cut-off of 0.8*(8000/8) = 800 Hz and will remove the 1200 Hz component >> subplot(3,1,1),dtft_demof(x,0,1500,2024,8000); >> title('Original Signal') >> subplot(3,1,2),dtft_demof(xd4,0,1500,2024,2000); >> title('Down-Sampled (Aliasing)') >> subplot(3,1,3),dtft_demof(xdecim4,0,1500,2024,2000); >> title('Decimated (No 1200 Hz Aliasing)')

13 Decimation Example

14 Up-Sampling and Interpolation The process of adding zero-valued samples between existing samples is called up- sampling Up-sampling by a factor N effectively increases the sampling frequency to Nf s Estimating the values between existing samples is called interpolation Interpolation is accomplished by low-pass filtering an up-sampled signal followed by an amplitude correction to restore the signal power.

15 Down-Sampling and Up-Sampling 100 Hz Hz Signal >> [x,ts]=analog([100,200],[1,1],20,2000); % Construct a short version of the signal >> xd4=downsample(x,4); >> xu4=upsample(xd4,4); >> subplot(3,1,1),stem(x),title('Original Signal') >> subplot(3,1,2),stem(xd4),title('Down-Sampled by 4') >> subplot(3,1,3),stem(xu4),title('Down-Sampled Signal Up-Sampled by 4x') >> xlabel('Sample')

16 Down-Sampling and Up-Sampling

17 Spectra of the Down-Sampled and Up-Sampled Signals

18 Interpolation Process The spectrum of the up-sampled signal gives the clue for the process –Low-pass filter the up-sampled signal to remove all frequency components beyond f s /2N, where f s = effective sampling frequency after up-sampling and N is the up-sampling factor. –Multiply the result by N to restore the correct the power of the up-sampled signal Typical filter order for the low-pass filter is 8N This process is implemented in the MATLAB interp command, using a special symmetric FIR filter to compensate for group delay

19 Recovery of a Down-Sampled Signal by Interpolation Filtering >> x=analog([100,200],[1,1],1000,2000); %Construct the signal >> xd4=downsample(x,4); >> xu4=upsample(xd4,4); >> n=0:32; % Begin the design of an order 8N filter LP filter >> fs=2000; >> N=4; >> cutoff=fs/(2*N); >> omega=2*pi*cutoff/fs; >> h=(omega/pi)*sinc(omega*(n-16)/pi).*hamming(33)'; % LP filter >> x_recovered=4*filter(h,1,xu4); % LP filter and multiply by N=4 >> subplot(3,1,1);stem(x(1:100)),title('Original Signal') >> subplot(3,1,2);stem(xu4(1:100)),title('Zero Insertion of Down- Sampled Signal') >> subplot(3,1,3);stem(x_recovered(1:100)),title('Recovered (LP Filtered) Signal')

20 Interpolation Recovery Results Note that the group delay of the LP filter is 16 in this example

21 Interpolation with interp >> x=analog([100,200],[1,1],1000,2000); %Construct the signal >> xd4=downsample(x,4); >> xu4=upsample(xd4,4); >> x_interp=interp(xd4,4); >> subplot(3,1,1),stem(x(1:100)),title('Original Signal') >> subplot(3,1,2),stem(xd4(1:25)),title('Down-Sampled Signal') >> subplot(3,1,3),stem(x_interp(1:100)),title('Recovered Signal Using "interp"')

22 Interp Results

23 Sampling Rate Conversion by Rational Factors The sampling frequency can be changed by rational factors L/M where L is the interpolation factor and M is the decimation factor. Rate changes (to higher or lower rates) is always done with interpolation (L) and decimation (M) in that order to prevent loss of frequency components of interest in the signal. Example: Changing a music signal from the CD rate (44.1 kHz) to the digital tape rate (48 kHz) is accomplished by interpolation by a factor of 160 followed by decimation by a factor of 147

24 Rate Conversion Example Convert a 100 Hz sinusoidal signal sampled at 1200 Hz to a signal sampled at 1000 Hz L/M=1000/1200 = 5/6 >> x=analog(100,1,40,1200); >> xL=interp(x,5); % The interp command carries out interpolation >> xLM=decimate(xL,6); % decimate carries out decimation >> subplot(2,1,1),stem(x),title(' Signal, fs = 1.2 kHz') >> subplot(2,1,2),stem(xLM),title('Rate Conversion 1.2 kHz to 1 kHz') >> axis([0,50,-1,1])

25 Rate Conversion Example Results Note in both cases the signal is about 40 ms long.

26 Over-Sampling and Random Noise Gaussian noise power is uniformly distributed in the frequency domain As a consequence, noise power density is reduced by a factor of 2 (3 dB) for each doubling of the sampling frequency.

27 Power Density in the Frequency Domain

28 Calculating Mean Noise Power Density for Different Sampling Frequencies >> [zero_sig,tt]=analog(1,0,1000,50000); %Construct a psuedo-analog zero signal >> analog_noise=zero_sig+randn(size(zero_sig)); % Construct a psuedo-analog noise signal >> n1000=sample(tt,analog_noise,1000); % Sample the noise signal at 1 kHz, 2 kHz, and 4 kHz >> n2000=sample(tt,analog_noise,2000); >> n4000=sample(tt,analog_noise,4000); >> [N1,f1]=dtft_demof(n1000,0,500,512,1000); % Compute the DTFT for each digital noise signal >> [N2,f2]=dtft_demof(n2000,0,1000,512,2000); >> [N4,f4]=dtft_demof(n4000,0,2000,512,4000); >> pd1=(abs(N1)).^2/(length(n1000)*1000); % Compute the spectral power density >> pd2=(abs(N2)).^2/(length(n2000)*2000); >> pd4=(abs(N4)).^2/(length(n4000)*4000); >> mean(pd1) % Compute the mean value of the spectral power density >> mean(pd2) >> mean(pd4) ans = e-004 ans = e-004 ans = e-004 Notice than the average power density is reduced by a factor of 2 for each doubling of the sampling frequency

29 De-Noising a Signal by Over-Sampling and Low-Pass Filtering Over-sample a signal at a rate many times higher than the band-width of interest W Over-sampling reduces the noise power in W by 3 dB for each doubling of the sampling frequency Low-pass filter with a cut-off frequency near W. This eliminates the noise power at frequencies beyond W.

30 De-Noising Example >> [asig,tt]=analog(100,1,40,40000); >> asign=asig+randn(size(asig)); >> [d8,t8]=sample(tt,asig,8000); >> [d8n,t8]=sample(tt,asign,8000); >> n=0:100; >> omega=2*pi*125/8000; >> hw=(omega/pi)*sinc(omega*(n-50)/pi).*blackman(101)'; >> d8nf=filter(hw,1,d8n); >> subplot(3,1,1),plot(t8,d8),title('Clean Signal') >> subplot(3,1,2),plot(t8,d8n),title('Noisy Signal') >> subplot(3,1,3),plot(t8,d8nf),title('Filtered Noisy Signal') >> subplot(2,1,1),fft_plot(d8n,8000);title('Noisy Signal Spectrum') >> subplot(2,1,2),fft_plot(d8nf,8000);title('Filtered Noisy Signal Spectrum')

31 De-Noising Example Results

32 Noise Power Uniformly Distributed Noise Power Eliminated by LP Filter

33 Delta-Sigma (ΔΣ) Quantization The processing speed of a DSP system could be measured by bits/sec in which case the speed is Nf s, where N is the number of quantization bits (ADC) and f s is the sampling frequency. For a given system speed, the maximum f s requires quantization with one bit, which appears impossible because quantization with two levels implies impractically high quantization noise. ΔΣ Quantization can do just that: quantize with 1 bit and still control the quantization noise.

34 Delta-Sigma Quantizer Functional Diagram

35 Delta-Sigma Quantizer Discrete-Time Model Output = input x delay + noise x high-pass filter (e.g, Noise-shaping one-bit quantization)

36 Delta-Sigma Quantization of a Sinusoid >> [x,ts]=analog(100,2,500,10000); >> stem(ts(1:100),x(1:100)) >> title('High-Rate Sampled 100 Hz Sinusoid') >> xlabel('milliseconds') >> [x,ts]=analog(100,2,500,10000); >> stem(ts(1:100),x(1:100)) >> title('High-Rate Sampled 100 Hz Sinusoid') >> xlabel('milliseconds') >> y=deltasigma(x); % This is the delta-sigma quantizer algorithm >> figure,stem(y(1:100)); >> hold >> plot(x(1:100),'k') >> title('Delta-Sigma Quantizer Output for 100 Hz Sinusoid') >> xlabel('Output Sample') >> hold off

37 Delta-Sigma Quantization of a Sinusoid

38 8-bit Running Average of the Delta-Sigma Quantized Sine

39 Delta-Sigma Quantization of a Sinusoid – Quantization Noise Shaping Low-pass filtering would eliminate the quantization noise

40 Low-Pass Filtering Δ-Σ Sinusoid >> n=0:500; >> omega=2*pi*200/10000; >> h=(omega/pi)*sinc(omega*(n-250)/pi); >> hb200=h.*blackman(501)'; >> [x,ts]=analog(100,2,500,10000); >> y=deltasigma(x); % This is the delta-sigma quantizer algorithm >> y_lpf=filter(hb200,1,y); >> fft_plot(y_lpf,10000); >> title('Spectrum of Low-Pass Filtered Delta-Sigma Quantizer Output') >> figure,plot(ts(1:500),y_lpf(1:500)) >> title('Time-Domain of the Filtered Quantizer Output') >> xlabel('Milliseconds')

41 Low-Pass Filtering Δ-Σ Sinusoids Filter group delay

42 Processing a Δ-Σ Signal Delta-Sigma Quantizer Serial-to-N-bit Parallel Converter Low-Pass Filter Decimation to Nyquist Rate Binary stream (f s ) N-bit numbers (f s /N) Recovered Signal Continue Processing

43 Processing a Δ-Σ Signal The high-rate sampling frequency of the Δ-Σ quantizer is f s. Over N samples, the bit-stream of the Δ-Σ quantizer output is the average signal value. Serial-to-N-bit parallel conversion creates N-bit numbers equal to the average value. The effective sampling frequency is f s /N. The N-bit numbers carry the quantization noise which is eliminated by digital LP filtering. The filtered signal represents the recovered signal. After filtering the signal can be decimated to the Nyquist rate for further processing.

44 Processing a Δ-Σ Signal MATLAB Simulation % Create and Delta-Sigma Quantize a Signal with 100, 200, and 300 Hz Components >> x=analog([100,200,300],[1,1,1],1000,24000); % Sampled signal >> y=deltasigma(x); % Delta-sigma quantization of the signal % % Simulate the 8-Bit Serial to Parallel Conversion of the Quantizer Stream >> y8bits=decimate_and_average(y,8); % M-file to block process the signal y in blocks of 8 % % Low-Pass Filter the 8-Bit Signal with Cutoff of 350 Hz >> n=0:100; % Start low-pass filter design >> fs=24000/8; % The signal has been effectively decimated by a factor of 8 >> omega=2*pi*350/fs; >> h=(omega/pi)*sinc(omega*(n-50)/pi).*hamming(101)'; % Windowed LP filter >> yfilt=filter(h,1,y8bits); % Low-pass filter the 8-bit re-quantized signal % % Decimate the filtered signal to the Nyquist Rate >> ydec=decimate(yfilt,4); % Decimate the filtered signal by a factor of 4 (fs = 750 Hz)

45 Processing a Δ-Σ Signal MATLAB Simulation Signals (10 ms period) >> t24=0:1000/24000:10; >> stem(t24(1:240),y(1:240)) >> hold %Current plot held >> plot(t24(1:240),x(1:240),'k') >> legend('Quanitzer output and sampled signal') >> hold off >> t3k=0:(1/3):10; >> stem(t3k(1:30),y8bits(1:30)) >> hold %Current plot held >> plot(t24(1:240),x(1:240),'k') >> legend('8-bit samples and sampled signal') >> hold off

46 Processing a Δ-Σ Signal MATLAB Simulation Signals (10 ms period) >> stem(t3k(1:30),yfilt(81:110)) >> hold %Current plot held >> plot(t24(1:240),x(245:484),'k') >> legend('LP filtered 8-bit samples and sampled signal') >> hold off >> tf=downsample(t3k(1:30),4); >> yfiltf=downsample(yfilt(81:110),4); >> stem(tf,yfiltf) >> hold %Current plot held >> plot(t24(1:240),x(245:484),'k') >> legend('Decimated final signal and sampled signal') >> hold off

47 Processing a Δ-Σ Signal MATLAB Simulation Sampled Signal Spectrum >> dtft_demof(x,0,1500,4000,24000); % Begin generating signal spectra >> legend('Spectrum of the sampled signal')

48 Processing a Δ-Σ Signal MATLAB Simulation Quantizer and 8-Bit Signal Spectra (Showing Quantization Noise) >> figure,dtft_demof(y,0,1500,4000,24000); >> legend('Spectrum of the delta-sigma quantizer output') >> figure, dtft_demof(y8bits,0,1500,4000,3000); >> legend('Spectrum of the 8-bit serial-to-parallel signal')

49 Processing a Δ-Σ Signal MATLAB Simulation 8-Bit Signal LP Filtered and Decimated (Quantization Noise Minimized) >> figure, dtft_demof(yfilt,0,1500,4000,3000); >> legend('Spectrum of the low-pass filtered 8-bit signal (recovered signal)') >> figure,dtft_demof(ydec,0,1500,4000,750); >> legend('Final signal decimated by 4 (fs = 750 Hz)')

50 Reduction in Noise due to Over-sampling and Noise Shaping

51 Summary The spectral content of a digital signal is replicated at integer multiples of the sampling frequency. Oversampling (sampling well beyond the Nyquist rate) spreads the frequency content over a wider frequency range. The requirements on the analog anti-aliasing filter can be relaxed by oversampling followed by digital low-pass filtering. The extra samples in an oversampled and bandwidth-limited signal can be removed by downsampling or decimation, thereby reducing the effective sampling frequency. A signal can be restored to a higher sampling frequency by the processes of upsampling and interpolation. Since Gaussian noise is uniformly distributed in the frequency domain, the combination of oversampling and filtering can effectively de-noise a signal in a bandwidth of interest. Oversampling can be maximized by delta-sigma quantization, which is quantization with one bit. Delta-sigma quantizers have the property of noise-shaping, which allows the elimination of quantization noise by low-pass filtering.

Download ppt "Chapter 7 Over-Sampling and Multi-Rate DSP Systems."

Similar presentations

Ads by Google