sampling handout
TRANSCRIPT
-
7/29/2019 Sampling Handout
1/12
Sampling and Reconstruction of SignalsLesson 12, Part I, INF44480
Andreas Austeng
Department of Informatics, University of Oslo
April 2011
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr il 2011 1 / 82
Outline
Outline
1 Fourier transforms and the sampling theorem
The sampling theorem
Fourier transforms
Sampling and reconstruction of signals
2 Sampling of bandpass signals
Representation of bandpass signals
Sampling of bandpass signals
3 Multirate digital signal processing
Sampling rate conversion
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr il 2011 2 / 82
Fourier transforms and the sampling theorem The sampling theorem
The sampling theorem
Alternative I:
If the highest frequency contained in an analog signal xa(t) isFmax = B Hertz and the signal is sampled at a rateFs > 2Fmax 2B samples per second, then xa(t) can be exactlyrecovered from its sample values using the interpolation function
g(t) = sin2Bt2B
The sampling rate FN = 2B = 2Fmax is called the Nyquist rate.
Alternative II:
A bandlimited continuous-time signal, with highest frequency
(bandwidth) B Hertz, can be uniquely recovered from its samples
provided that the sampling rate Fs > 2B samples per second.
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr il 2011 4 / 82
Fourier transforms and the sampling theorem The sampling theorem
Relations among frequency variables
We have that: = T, f = F/Fs (or = /T, F = f Fs)
Continuous-time signals Discrete-time signals
= 2F = 2f
radianssec , Hz radianssample , cyclesample
12 f 12
< < /T /T
< F < Fs/2 Fs/2
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr il 2011 5 / 82
-
7/29/2019 Sampling Handout
2/12
-
7/29/2019 Sampling Handout
3/12
Fourier transforms and the sampling theorem Sampling and reconstruction of signals
Sampling of analog signals (3)
To determine a relationship between the spectra of analog and
digital signals we use that t = nT = nFs and f =FFs
:
x[n] xa(nT)(2)=
Xa(F)e2nF/FsdF
(4)=
12
12
X(f)e2fndf =1
Fs
Fs2
Fs2
X(F)e2nF/FsdF.
Due to the periodicity of e2nFs/F, we can write
dF as
k=
(k+1/2)Fs(k1/2)Fs
dF...
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 10 / 82
Fourier transforms and the sampling theorem Sampling and reconstruction of signals
Sampling of analog signals (4)We then have that
1
Fs
Fs2
Fs2
X(F)e2nF/FsdF =
Xa(F)e2nF/FsdF
=
k=
(k+1/2)Fs(k1/2)Fs
Xa(F)e2nF/FsdF
=
k=
Fs2
Fs2
Xa(F kFs)e2nF/FsdF
=
Fs2
Fs2
k=Xa(F kFs)
e2nF/FsdF
which gives
X(F) = Fs
k=Xa(F kFs) or X(f) = Fs
k=
Xa((f k)Fs) .
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 11 / 82
Fourier transforms and the sampling theorem Sampling and reconstruction of signals
Sampling of analog signals (5)
No aliasing if Fs > 2B.
If so; x(t) can be
reconstructed fromx[n].
If not; aliasing occur as
in (e).
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 12 / 82
Fourier transforms and the sampling theorem Sampling and reconstruction of signals
Reconstruction of analog signal
Given no aliasing, then
Xa(F) =
1
FsX(F), |F| Fs/2
0, |F| > Fs/2(5)
and analog signal can be reconstructed:
xa(t)(2)
=
Xa(F)e2FtdF(5)
=1
FsFs2
Fs2
X(F)e2FtdF
(4)=
1
Fs
Fs2
Fs2
n=
x[n]ej2Fn/Fs
ej2FtdF
=1
Fs
n=
x[n]
Fs2
Fs2
ej2F(tn/Fs)dF
=
n=xa(nT)
sin[(/T)(t nT)]
(/T)(t nT).
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 13 / 82
-
7/29/2019 Sampling Handout
4/12
Fourier transforms and the sampling theorem Sampling and reconstruction of signals
Reconstruction of analog signal (2)
Ideal interpolation formula: xa(t) =
n= xa(nT)sin[(/T)(tnT)](/T)(tnT)
.
Involves the function g(t) = sin(/T)t(/T)t appropriately shifted by nT,
n = 0,1,2, . . ., and multiplied or weighted by thecorresponding samples xa(nT) of the signal.
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 14 / 82
Fourier transforms and the sampling theorem Sampling and reconstruction of signals
Folding ...Time-freq. relationships ...
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 15 / 82
Fourier transforms and the sampling theorem Sampling and reconstruction of signals
Nonbandlimited signal (1)
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 16 / 82
Fourier transforms and the sampling theorem Sampling and reconstruction of signals
Nonbandlimited signal (2)
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 17 / 82
-
7/29/2019 Sampling Handout
5/12
Sampling of bandpass signals
A bandlimited signal
%%% E ksempel p? b?ndbegrenset s i gnal :
%% x( t ) = a( t ) * s i n ( 2 \ p i f _ c t ) ;
%% f_ c : c a r r i e rfrekvens
% a( t ) : l angsom vari erend e modul asj on
fs = 500; % S ampl i ngsfrekvens
Nsek = 2; % A n t a l l s e k un d e r
t = 0 : 1 / fs :( Nsek) ; % Ti d
f_c = 1 0 0 ; % C a r r i e r
an = 1 + 0 . 5 * sin (2 * pi * 5*t ) ; % Modul asj on
xn = an . * sin (2 * pi *f_c*t) ; % B andbegrenset s i gn al
% P l o t t a v x n
f i g u r e ( 1 ) ;p l o t (t ,xn , 'o ' ) ; g r i d ont i t l e ( ' Pl o t o f b a n d l i m i te d s i g n a l x n ') ; x l a b e l ( ' t im e [ s e c ] ' ) ;
fname = 'B pS i gnTi d ' ;
cmd = [ ' p r i n tdeps2c ' ,fname, ' ; ' ];
eval (cmd) ;% cmd = [ ' epstopdf ' , fname , ' . eps ' ] ;
% uni x (cmd) ;
% P l o t t a v s p e k tr u m t i l x n
f i g u r e ( 2 ) ;
Hs = spectrum.periodogram( 'Hamming ' ) ;
psd(Hs ,xn , 'Fs ' ,fs, 'NFFT ' ,1024, 'SpectrumType ' , ' twosided ' , 'CenterDC ' ,
true) ;axi s([fs/2 fs/2 100 0] )
fname = 'BpSignFrek ' ;
cmd = [ ' p r i n tdeps2c ' ,fname, ' ; ' ];
eval (cmd) ;%cmd = [ ' epstopdf ' , fname , ' . eps ' ] ;
%unix (cmd) ;
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 21.5
1
0.5
0
0.5
1
1.5Plot of bandlimited signalxn
time [sec]
25 0 20 0 15 0 10 0 50 0 5 0 1 00 1 50 2 00 2 50100
90
80
70
60
50
40
30
20
10
0
Frequency (Hz)
Power/frequency(dB/Hz)
Periodogram Power SpectralDensity Estimate
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 19 / 82
Sampling of bandpass signals
Example (Sampling of a complex bandlimited signal (1))
Given a complex bandpass analog
signal xa(t) with nonzero Fouriertransform over the frequency range
[1,2].What is the smallest sampling
frequency that can be used so that
xa(t) can be recovered from itssamples x[n]?
Xa()
1 2
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 20 / 82
Sampling of bandpass signals
Example (Sampling of a complex bandlimited signal (2))
Obvious choice, the Nyquist rate: 22.
But if xa(t) is modulated, i.e.ya(t) = xa(t)e
(2+1)t/2, then ya(t)
becomes a (complex) low-pass signal
with spectrum as seen below.
ya(t) may be recovered from samplestaken at the sampling rate
20 = 2 1.
Question to ask: Can xa(t) be uniquelyrecovered from its samples xa(nTs)provided that Ts
21
?
Ya()
0 0
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 21 / 82
Sampling of bandpass signals
Example (Sampling of a complex bandlimited signal (3))
If xa(t) is sampled with a sampling frequency s, the spectrum ofthe sampled signal is
Xs() =1
Ts
k=Xa( ks).
In order to avoid interference between shifted spectra, we must
have that
2 s 1 or s 2 1.
X()
1-3s 2-3s 1-2s 2-2s 1-s 2-s 1 2
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 22 / 82
-
7/29/2019 Sampling Handout
6/12
Sampling of bandpass signals
Example (Sampling of a complex bandlimited signal (4))
If s 2 1, then xa(t) may beuniquely reconstructed from xs(t)using a bandpass filter with a
frequency response as shown to the
right.If s = 2 1, the reconstructionfilter is a complex bandpass filter with
impulse response
ha(t) = Tssin(st/2)
te(2+1)t/2
Hr()
Ts
1 2
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 23 / 82
Sampling of bandpass signals Representation of bandpass signals
Representation of bandpass signals (1)
Any real-valued bandpass signal xa(t) can be represented by anequivalent lowpass signal xLP(t).
xa(t): Real-valued bandpass signal with frequency concentratedaround Fc.
If + is the signal containing the positive frequencies in xa(t), thenxa(t) can be represented by a low-frequency signal:
xLP(t) = e2Fct+(t) (complex envelope of xa(t))= xI(t) + xQ(t) (in-phase & quadrature components)
= A(t)e(t)epiFct (envelope & phase)
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 24 / 82
Sampling of bandpass signals Representation of bandpass signals
Representation of bandpass signals (2)
To develop a mathematical representation of xa(t); start with thesignal +(t) containing the positive frequencies in xa(t).
Then: +(F) = 2Va(F)Xa(F),where Va(F) is the Heaviside function and Xa(F) = F[xa(t)].
The analytic signal or the pre-envelope of xa(t) given as:
+(t) =+(F)e
j2Ft
dF = F1
[2Va(F)] F1
[Xa(F)]=(t) + jt
xa(t) = xa(t) +j
1t xa(t)
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 25 / 82
Sampling of bandpass signals Representation of bandpass signals
Representation of bandpass signals (3)
+(t) = xa(t) +jxa(t),
xa(t) =1t xa(t) =
1
xa()t d.
xa(t) viewed as output of the filter with impulse responsehQ(t) =
1t when excited by xa(t).
Such filter called Hilbert transformer and
F[hQ(t)] = HQ(F) =
j F > 00 F == 0j F < 0.
|HQ(F)| = 1 and (F) = /2, F > 0 and (F) = /2, F < 0,i.e. 90 phase shift.
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 26 / 82
-
7/29/2019 Sampling Handout
7/12
Sampling of bandpass signals Representation of bandpass signals
Representation of bandpass signals (4)
+(t) a bandpass signal; lowpass repr. XLP(F) = +(F + Fc) xLP(t) = +(t)e
j2Fct = [xa(t) +jxa(t)]ej2Fct
= xI(t) +jxQ(t).
This gives (from xa(t) +jxa(t) = [xI(t) +jxQ(t)]ej2Fct)
xa(t) = xI(t) cos2Fct xQ(t) sin2Fct and
x(t) = xI(t) sin2Fct + xQ(t) cos2Fct. Carrier components: cos 2Fct and sin2Fct. xI(t) and xQ(t): Low freq. amp. modulators. xI(t) and xQ(t): quadrature components.
Alternatively:xa(t) = Re{[xI(t) +jxQ(t)]e
j2Fct} = Re[xLP(t)ej2Fct].
xLP(t): Complex envelope of xa(t) and it is the equivalent lowpasssignal.
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 27 / 82
Sampling of bandpass signals Representation of bandpass signals
Representation of bandpass signals (5)
xI(t); Known as in-phase component
xQ(t); Known as quadrature component
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 28 / 82
Sampling of bandpass signals Representation of bandpass signals
Representation of bandpass signals (6)
Letting xLP(t) = A(t)ej(t),
A(t) =
x2I (t) + x2Q
(t) and (t) = tan1(xQ(t)/xI(t)),
then a third possible representation isxa(t) = Re[xLP(t)e
j2Fct] = A(t) cos[2Fct + (t)]. A(t): Envelope of xa(t). (t): Phase of x
a(t)
Fourier transform of xa(t):Xa(F) =
xa(t)e
j2Ftdt
=
{Re[xLP(t)e
j2Fct]}ej2Ftdt
= 12
[xLP(t)e
j2Fct + xLP(t)ej2Fct]ej2Ftdt
= 12
[XLP(F Fc) + X
LP(F Fc)].
Any bandpass signal xa(t) can be represented by an equivalentlowpass signal xLP(t).
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 29 / 82
Sampling of bandpass signals Sampling of bandpass signals
Sampling of bandpass signals (1)
Know: A signal with highest frequency B can uniquely be
represented by samples taken at the minimum (Nyquist) rate of
2B samples per second.
What if the signal is band limited; B1 F B2:
Either sample at sample frequency 2B2 or sample at 2 (B2 B1)/2.
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 30 / 82
-
7/29/2019 Sampling Handout
8/12
Sampling of bandpass signals Sampling of bandpass signals
Sampling of bandpass signals (2)Integer band positioning (1)
Sampling of a bandpass signal at rate Fs = 1/T produces asequence x[n] = xa(nT) with spectrum
Xa(F) =1T
k=Xa(F kFs) Positioning of shifted spectra controlled by Fs.
Remember; real signals have two spectral bands. Care must betaken!
Integer band positioning: Restrict the higher frequency of the band to be an integer multiple
of the bandwidth, i.e. FH = mB. m = FH/B; band position. No aliasing with Fs = 2B.
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 31 / 82
Sampling of bandpass signals Sampling of bandpass signals
Sampling of bandpass signals (3)Integer band positioning (2)
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 32 / 82
Sampling of bandpass signals Sampling of bandpass signals
Sampling of bandpass signals (4)Integer band positioning (3)
Signal can be reconstructed as xa(t) =
n= xa(nT)ga(t nT)
where ga(t) =sin BtBt cos2Fct
ga(t) is equal to the ideal interpolation function for lowpass
signals, modulated by the carrier frequency Fc.By properly choosing the center frequency Fc of Ga(F), we canreconstruct a continuous-time signal with spectral band centeredat Fc = (kB+ B/2), k = 0, 1, . . .. With k = 0 we obtain the baseband signal; down-conversion.
When the band position is an even integer, the baseband spectral
structure is inverted.
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 33 / 82
Sampling of bandpass signals Sampling of bandpass signals
Sampling of bandpass signals (5)Arbitrary band positioning (1)
To avoid aliasing for spectral bands with arbitrary positioning, thefollowing must be true (see figure)
1 2FH kFs2 (1 k)Fs 2FLP
We have to choose both k and Fs.
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 34 / 82
-
7/29/2019 Sampling Handout
9/12
Sampling of bandpass signals Sampling of bandpass signals
Sampling of bandpass signals (6)Arbitrary band positioning (2)
Include guard bands when choosing k and Fs to ensure sampling
frequency tolerances.
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 35 / 82
Sampling of bandpass signals Sampling of bandpass signals
Sampling of bandpass signals (7)Sampling using bandpass signal representation (1)
May sample +(t); the analytic signal (the pre-envelope of xa(t) atrate Fs = 2B independent of band location). This complex signal has one band (no symmetry)! Needs B complex samples or 2B real samples.
+(t) = x
a(t) +jx(t), x(t) = 1
t x
a(t) = 1
x()
td
Must sample xa(t) and its Hilbert transform x(t) and use complexbandpass interpolation (as example given before).
Solution: Shift the signal by Fc = (B1 + B2)/2 for instant bymultiplying with the two quadrature carriers + lowpass filter and
sample each stream at 2 (B2 B1)/2 i.e. represent the signalwith 2 (B2 B1) samples per second.
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 36 / 82
Sampling of bandpass signals Sampling of bandpass signals
Sampling of bandpass signals (8)Sampling using bandpass signal representation (2)
(uc(1) == xI(t) and us(t) == xQ(t))
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 37 / 82
Sampling of bandpass signals Sampling of bandpass signals
Sampling of bandpass signals (9)Sampling using bandpass signal representation (3)
If Fc + B/2 = kB, k pos. int., B = (B2 B1) and 2B = 1/T;
x(nT) = xI(nT) cos(2FcnT) xQ(nT) sin(2FcnT)
= xI(nT) cosn(2k 1)
2 xQ(nT) sin
n(2k 1)
2
For n = 2m i.e. even and T1 = 2T = 1/B,x(2mT) x(mT1) = xI(mT1) cos(m(2k 1)) = (1)
mxI(mT1). For n = 2m 1 i.e. odd and T1 = 2T = 1/B,
x(2mT T) x(mT1 T1/2) = (1)m+k+1xQ(mT1 T1/2).
Thus; Even number samples produces the lowpass signal component
xI(t) Odd number samples produces the lowpass signal component
xQ(t)
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 38 / 82
-
7/29/2019 Sampling Handout
10/12
Multirate digital signal processing Sampling rate conversion
Sampling rate conversion
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 40 / 82
Multirate digital signal processing Sampling rate conversion
Decimation by a factor D (1)
Assume signal x(n) with spectrum X(w) which is nonzero in the
frequency interval 0 |w| or |F| Fx/2.Choosing every Dth sample reduces the sampling rate by a factor
D, but aliasing occurs!
The bandwidth of x(n) must, therefore, be reduced toFmax = Fx/2D.
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 41 / 82
Multirate digital signal processing Sampling rate conversion
Decimation by a factor D (2)
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 42 / 82
Multirate digital signal processing Sampling rate conversion
Interpolation by a factor I (1)
To increase the sampling rate with a factor of I, interpolate I 1new samples between successive values of the signal.
One way; add I 1 zeros between every successive values ofx(n). Call the new sequence v(m):
v(m) = x(m/I), m= 0,I,2I, . . .0, otherwise
v(m) has z-transform V(z) =
m= v(m)zm = X(zI).
V(wy) is an I-fold periodic repetition of X(wx).
v(m) must be passed through a lowpass filter HI(wy) to create theup-sampled sequence
HI(wy) =
I, 0 |wy| /I0, otherwise
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 43 / 82
-
7/29/2019 Sampling Handout
11/12
Multirate digital signal processing Sampling rate conversion
Interpolation by a factor I (2)
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 44 / 82
Multirate digital signal processing Sampling rate conversion
Example (Up- and down-sampling)
A signal x[n] has Fourier transformation X() as shown in the figure below.
X()
0 /3/2
1
The signal is used as input to the systems I and II, which are defined in the
figure below:
I: x[n] 3 w1[n] H0(z) z1[n] 2 y1[n]
II: x[n] 2 w2[n] 3 z2[n] H0(z) y2[n]
M means downsampling by a factor M (keep every Mth sample) and
N means zero-interpolation by a factor N (insert N 1 zeros
between each sample). H0(z) is an ideal low-pass filter with a cut-offfrequency wc = /3 and gain equal to 2.For both systems, sketch the Fourier transformation of the signals
w1[n], w2[n], z1[n], z2[n], y1[n] og y2[n].
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 45 / 82
Multirate digital signal processing Sampling rate conversion
Example (Up- and down-sampling)
W1()
/60 /3 /2
11
Z1()
/60 /3 /2
2
Y1()
/60 /3 /2
1
W2()
/60 /3 /2
112
Z2()
/60 /3 /2
12
Y2()
/60 /3 /2
1
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 46 / 82
Multirate digital signal processing Sampling rate conversion
Conversion by a rational factor I/D (1)
Cascade an interpolator with a decimator.
Remember: Up-sample first, downsample second. Preserve the desired spectral characteristics The two filters can be combined
Possible with multistage implementations.
I =L
i=1 Ii D =
Ji=1 Di
Design filters for each stage to avoid aliasing.
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 47 / 82
-
7/29/2019 Sampling Handout
12/12
Multirate digital signal processing Sampling rate conversion
Conversion by a rational factor I/D (2)
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 48 / 82
Multirate digital signal processing Sampling rate conversion
Conversion by a rational factor I/D (3)
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 49 / 82
Multirate digital signal processing Sampling rate conversion
Subband Coding of Speech Signals
mpeg, jpeg ...
AA, INF4480 (Ifi/UiO) Sampling and reconstruction A pr i l 2011 50 / 82