# Multirate Signal Processing Lecture 7, Sampling

2y ago
106 Views
751.33 KB
27 Pages
Last View : 5m ago
Transcription

Multirate Signal ProcessingLecture 7,SamplingGerald Schuller, TU Ilmenau(Also see: Lecture ADSP, Slides 06)In discrete, digital signal we use the normalized frequency, T / f s : it is without a physical unit, since the unit Hertz in ω and f scancel. In the normalized frequency 2 represents thesampling frequency and π is the so called Nyquist frequency(the upper limit of our usable frequency range, defined ashalf the sampling frequency). Observe that we use the capital to signify that this is the normalized frequency. Thecapitalized version is commonly used to distinguish it fromthe continuous, non-normalized, version, if both are used.Otherwise, also the small is used in the literature, for thenormalized frequency, if that is all we need, if there is nodanger of confusion, as we did before.Its spectrum or frequency response is then X x n e j nn Because n is integer here, we get a 2π periodicity forX . This is the first important property for discrete timesignals.

Here we can see that in general we obtain a 2 periodicityin the frequency domain, because of the 2 periodicity ofthe exponential function e j ω .The above transform is called the Discrete Time Fouriertransform or DTFT (not the Discrete Fourier Transform, whichis for finite or periodic discrete time sequences. Here we stillhave an infinite “block length”).Also observe that for real valued signals, the spectrum of thenegative frequencies is the conjugate complex of the positivefrequencies,X ( Ω ) X * (Ω )where * denotes the conjugate complex operation, becausee j n e j n * .(we also have to use the fact that the conjugate complex of areal valued signal does not change it, to draw the conjugationout of the Fourier sum).This also means that for real valued signals we only need tolook at the frequency range between 0 and π , since the

negative frequencies are conjugate symmetric (and becauseof the 2pi periodicity the range between -pi and pi is sufficientto look at). This is also again what the Nyquist Theorem tellsus, that the frequencies between 0 and π (the Nyquistfrequency) are sufficient to completely describe a (realvalued) signal.Sampling a discrete time signalSo what happens if we further downsample an alreadydiscrete signal x(n), to reduce its sampling rate?Downsampling by N means we only keep every Nth sampleand discard every sample in between. Observe that thisresults in a normalized frequency which is a factor of Nhigher.This downsampling process can also be seen as firstmultiplying the signal with a sequence of unit pulses (a 1 ateach sample position), zeros in between, and later droppingthe zeros. This multiplication with the unit pulse train cannow be used to mathematically analyse this downsampling,looking at the resulting spectra, first still including the zeros.The frequency response now becomesX d x n e j nn mN m for all integers m.x mN e j mN

We can write down-sampling as amultiplication of the signal with a samplingfunction. In continuous time it was thesequence of Dirac impulses, here it is asequence of unit pulses at positions ofmultiples of N,Δ N ( n ) 1 , i f n m N0, e l s eThen the sampled signal, with the zeros stillin it, becomesdx ( n ) x ( n ) Δ N ( n)This signal is now an intermediate signal,which gets the zeros removed beforetransmission or storage, to reduce theneeded data rate. The decoder upsamples itby re-inserting the zeros to obtain theoriginal sampling rate.Observe that this is then also the signal thatwe obtain after this upsampling in thedecoder. Hence this signal looks interestingto us, because it appears in the encoder andalso in the decoder.What does its spectrum or frequencyresponse look like?()The derivation can be found in lecture ADSP,slides 06, sampling.It shows that sampling, still including thezeros, leads (in the frequency domain) tomultiple shifted versions of the signal

spectrum, the so-called aliasingcomponents,N 11 2 dX X k (eq.1)N k 0NSignal /NpifrequencyAliasing componentsObserve: The spectral components don'toverlap if their bandwidths is below 2 π / Nfor complex signals, or for a real low passsignal, it should be below π / N ! If we wantto reconstruct the original signal, hence weneed to make sure the aliasing componentsdon't overlap by suitable filtering at the highsampling rate, to prepare for the downsampling. Observe that the term „Aliasing“in the literature is sometime only used foroverlapping alias components, andsometimes more broadly, like we do here, tomean any additional shifted frequencycomponent.

Next is another example, also including thenegative frequencies that now show upabove normalized frequency 1 (1 being theNyquist frequency here), and showing 2 sinesignals at different strength at normalizedfrequencies 0.4 and 0.35. This can also beseen as a narrow band signal, resulting e.g.from a passband filter.After sampling by a factor of N 4, stillincluding the zeros, we get the followingspectrum:

Spectral CopiesoriginalPos. FrequenciesoriginalNeg. FrequenciesThe picture shows that the spectrum stillcontains the original spectrum, plus thespectral copies at frequency shifts ofk 2 π / N from the originals.Observe: Since we have a real valued signal(the sinusoids), the spectrum of negativeand positive frequencies are symmetricaround frequency zero. This then leads tothe mirrored appearance between theneighbouring spectral images or aliasingcomponents.

BTW, Nyquist tells us to sample in such away, that the shifted spectra of our signal donot overlap. Otherwise, if they overlap, wecannot separate those parts of the spectrumanymore, and we loose information, whichwe cannot reconstruct.In conclusion: Sampling a signal by a factorof N, with keeping the zeros between thesample points, leads to N-1 aliasingcomponents.Example:Make a sine wave which at 44100 Hzsampling rate has a frequency of 400 Hz at 1second duration. Hence we need 44100samples, and 400 periods of our sinusoid inthis second. Hence we can write our signalin Python as:ipython --pylabfs 44100f 400.0s sin(2*pi*f*arange(0,1,1.0/fs))To listen to it, we use our sound library„sound.py“, which you can find on ourMoodle Webpage:from sound import soundsound((2**15)*s,fs)

Now plot the first 1000 samples:plot(s[0:1000])Next plot the first 100 samples:plot(s[0:100])

Now we can multiply this sine tone signalwith a unit pulse train, with N 8.We generate the unit impulse train,unit zeros(44100)unit[0::8] nit(n)')

Listen to it, with scaling to the value rangefor 16 bit/sample:from sound import soundsound(unit*2.0**15,44100)The multiplication with the unit impulsetrain:sdu s*unit(This multiplication is also called „frequencymixing“).Now plot the result, the first 100 samples:plot(sdu[0:100])

This is our signal still with the zeros in it.Now take a look at the magnitude spectrum(in dB) of the original signal s:from scipy.signal import freqzw,H freqz(s)plot(w, 20*log10(abs(H) ude Frequency Response')

The plot shows the magnitude of thefrequency spectrum of our signal. Observethat the frequency axis (horizontal) is anormalized frequency, normalized to theNyquist frequency as π , in our case 22050Hz. Hence our sinusoid should appear as apeak at normalized frequency400.0/22050*pi 0.05699, which we indeedsee.Now we can compare this to our signal withthe zeros, sdu:w,H freqz(sdu)plot(w, 20*log10(abs(H) 1e-3))

legend(('Original Sinusoid','SampledSinusid'))Here we can see the original line of our 400Hz tone, and now also the 7 new aliasingcomponents. Observe that always 2 aliasingcomponents are close together. This isbecause the original 400 Hz tone also has aspectral peak at the negative frequencies, at-400 Hz, or at normalized frequency 0.05699.Now also listen to the signal with the zeros:sound(2**15*sdu,44100);

Here you can hear that it sounds quitedifferent from the original, because of thestrong aliasing components!Python real time audio example: Thisexample takes the microphone input andsamples it, without removing the zeros, andplays it back the the speaker in real time.It constructs a unit pulse train, with a 1 atevery N'th sample, using the modulusfunction „%“,s (np.arange(0,CHUNK)%N) 0Start it with:python pyrecplay samplingblock.pyRemoving the zerosThe final step of downsampling is now toomit the zeros between the samples, toobtain the lower sampling rate. Let's call thesignal without the zerosy(m),where the time index m denotes the lowersampling rate (as opposed to n, whichdenotes the higher sampling rate).In our Python example this is:sd sdu[0:44100:8]plot(sd[0:(100/8)])

We can now take a look at the spectrum withw,H freqz(sd)plot(w, 20*log10(abs(H) ude Frequency Response')

Observe that the sine signal now appear atnormalized frequency of 0.455, a factor of8 higher than before, with the zeros in it,because we reduced the sampling rateby 8. This is because we now have a newNyquist frequency of 22050/8 now, henceour normalized frequency becomes400 3.14/22050 8 0.455 . This meansremoving the zeros scales or stretches ourfrequency axis.

Observe that here we only have 100/8 12samples left.How are the frequency responses or spectraof y m and x d n connected? We cansimply take the Fourier transforms of them,dX x d n e j nn still with the zeros in it. Hence most of thesum contains only zeros. Now we only needto let the sum run over the non-zeros entries(only every Nth entry), by replacing n bymN, and we getX d x d n e j n ,n mNfor all integer m, now without the zeros. Nowwe can make the connection to the Fouriertransform of y(m), by making the indexsubstitution m for n in the sum,dX y m e j N m Y N m This is now our result. It shows that thedownsampled version (with the removal ofthe zeros), has the same frequencyresponse, but the frequency variable isscaled by the factor N. For instance, thenormalized frequency / N beforedownsampling becomes after removingthe zeros! It shows that a small part of thespectrum before downsampling becomes thefull usable spectrum after downsampling.

Observe that we don't loose any frequenciesthis way, because by looking at eq. (1) wesee that we obtain multiple copies of thespectrum in steps of 2 / N , and hence thespectrum already has a periodicity of 2 / N. This means that the spectrum between / N and / N for instance (we could takeany period of length 2 / N ) contains aunique and full part of the spectrum,because the rest is just a periodiccontinuation.This can be seen in following pictures,Figure 1: The magnitude spectrum of asignal. The 2 boxes symbolize the passbandof an ideal bandpass, here a high pass.

Figure: The signal spectrum after passingthrough the high pass.Figure: Signal spectrum after multiplicationwith the unit pulse train, for N 2, hencesetting every second value to zero (the zerosstill in the sequence). Observe the we shiftand add the signal by multiples of 2 / 2 ,and in effect we obtain „mirrored“ images ofthe high frequencies to the low frequencies(since we assume a real valued signal).Observe that the mirrored spectra and the

original spectrum don't overlap, whichmakes reconstruction easy.Figure: Signal spectrum after downsampling(removing the zeros) by N (2 in thisexample). Observe the stretching of thespectrum by a factor of 2.UpsamplingWhat is still missing in our system is theupsampling, as the opposite operation ofdownsampling, for the case where we wouldlike to increase our sampling rate. One ofthe first (wrong!) approaches to upsamplingthat often comes to mind if we want to doupsampling by a factor of N, is to simplyrepeat every sample N-1 times. But this isequivalent to first inserting N-1 zeros aftereach sample, and then filter the resulting

sequence by a low pass filter with animpulse response of N ones. This is a veryspecial case, and we would like to have amore general case. Hence we assume thatwe upsample by always first inserting N-1zeros after each sample, and then havesome interpolation filter for it. Again we takethe signal at the lower sampling rate asy m with index m for the lower sampling rate,and the signal at the higher sampling rate,with the zeros in it, asx d n with index n for the higher sampling rate.Here we can see that this is simply thereverse operation of the final step ofremoving the zeros for the downsampling.Hence we can take our result fromdownsampling and apply it here:X d Y N orX d (Ω/ N ) Y (Ω)We are now just coming from y(m), going tothe now upsampled signal x d n .For instance if we had the frequency before upsampling, it becomes / 2 for theupsampled signal, if we have N 2. In thisway we now get an „extended“ frequencyrange.

Since we now have again the signalincluding the zeros, x d n , we again havethe periodic spectrum, as before, as weprogress through the same steps backwardsnow. We can also see that the result ofupsampling is periodic in frequency, becausethe signal was 2 periodic beforeupsampling anyway, and after upsamplingthe frequency scale replaces 2 N by 2 .ReconstructionObserve that if the aliasing componentsdon't overlap, we can perfectlyreconstruct the signal by using a suitablefilter. We can make sure that they don'toverlap by filtering the signal at the highersampling rate, before they can overlap. Ifthey already overlap at the lower samplingrate, it would be too late to separate thedifferent components, the signal wouldalready be „destroyed“.

We can perfectly reconstruct the high passsignal in our example if we use ideal filters,using upsampling and ideal high passfiltering.In this way we have for the analysis andsynthesis the following pictureObserve that we violate the conventionalNyquist criterium, because our high passpasses the high frequencies. But then thesampling mirrors those frequencies to thelower range, such that we can apply thetraditional Nyquist sampling theorem. Thismethod is also known as bandpass Nyquist.This is an important principle for filter banksand wavelets. It says that we can perfectlyreconstruct a bandpass signal in a filterbank, if we sample with twice the rate as thebandwidth of our bandpass signal(assuming ideal filters).

In genereal this is true for complex filters.For real valued filters observe that thissimple assumption only works if we havebandpass filters which start at frequencies / N k (integer multiples of / N ) .Otherwise we could have overlap to thealiased components!For proof and details see ADSP, lecture 06,sampling.Summary: if our band boarders are allignedwith multiples of / N then we candonwsample by N, otherwise we are on thesave side by using N/2 as downsamplingrate for real valued signals. For complexsignals we can always downsample by N,regardles of the exact placement of thebandpass filter.Compare with the standard Nyquist case:here we have a lowpass signal which wedownsample and reconstruct:

Python ExampleThis program can be controlled bykeyboard, and features sampling by afactor of N 8 (with keeping the zeros),which can be turned on and off, and a lowpass filter before and after sampling tosupress the alias components, which can beturned on and off.It shows the magnitude of the resulting DFTspectrum after reconstruction (after the lastlow pass filter) in a so-called waterfallspectogram:-The magnitude of the DFT is displayed ascolor (yellow is high, blue is low),-horizontal axis is frequency (0 to Nyquistfrequency)-vertical axis is time (up is past).Start it with

python pyrecspecwaterfallsampling.pyObserve: When we turn on sampling, weclearly hear the aliasing artifacts, and wealso see them as spectral copies in thewaterfall spectrogram.When we turn on the low pass filter, mostof the aliasing artifacts are not audibleanymore, and we also don't see most ofthem anymore in the waterfallspectrogramm, but it also sounds moremuffled.

Multirate Signal Processing Lecture 7, Sampling Gerald Schuller, TU Ilmenau (Also see: Lecture ADSP, Slides 06) In discrete, digital signal we use the normalized frequency, T / f s : it is without a

Related Documents:

multirate signal processing 1.applications 2.the up-sampler 3.the down-sampler 4.rate-changing 5.interpolation 6.half-band filters 7.nyquist filters 8.the noble identities 9.polyphase decomposition 10.efficient implementation 11.polynomials and multirate filtering 12.interpolation of polynomials i. selesnick el 713 lecture notes 1

Introduction of Chemical Reaction Engineering Introduction about Chemical Engineering 0:31:15 0:31:09. Lecture 14 Lecture 15 Lecture 16 Lecture 17 Lecture 18 Lecture 19 Lecture 20 Lecture 21 Lecture 22 Lecture 23 Lecture 24 Lecture 25 Lecture 26 Lecture 27 Lecture 28 Lecture

Lecture 07: Multirate Digital Signal Processing John Chiverton School of Information Technology Mae Fah Luang University 1st Semester 2009/ 2552. Lecture Contents Introduction Decimation Interpolation Non-Integer Sample Rate Conv

WAVELETS AND MULTIRATE DIGITAL SIGNAL PROCESSING Lecture 7: Frequency domain behaviour of Haar ﬁlter banks Prof.V. M. Gadre, EE, IIT Bombay 1 Introduction So far we have looked at the structure of the Haar Analysis and synthesis ﬁlter bank. In this lecture, the frequency domain beha

Chapter 11: Multirate Digital Signal Processing Discrete-Time Signals and Systems Reference: Sections 11.1-11.3 of John G. Proakis and Dimitris G. Manolakis, Digital Signal Processing: Principles, Algorithms, and Applications, 4th edition, 2007. Dr. Deepa Kundur (University of Toronto)M

Advanced Digital Signal Processing . techniques for processing detecting, estimating and exploiting signals (communications, electronics, and sensors). – Multirate signal processing, estimation theory, adaptive signal processing . 1965. ISBM: 07-048448-1. ECE 3800 7. ECE 3800 8 Id

most of the digital signal processing concepts have benn well developed for a long time, digital signal processing is still a relatively new methodology. Many digital signal processing concepts were derived from the analog signal processing ﬁeld, so you will ﬁnd a lot o f similarities between the digital and analog signal processing.

Unit 5: American Revolution . 2 A m e r i c a n R e v o l u t i o n Political and Economic Relationships between Great Britain and the Colonies England became Great Britain in the early 1700s, and it was throughout this century that the British colonies in America grew and prospered. The growth of the colonies made it more and more difficult for Great Britain to remain in control. King .