06.06.2022 Views

B. P. Lathi, Zhi Ding - Modern Digital and Analog Communication Systems-Oxford University Press (2009)

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

312 SAMPLING AND ANALOG-TO-DIGITAL CONVERSION

set (sfiglc, 'Linewidth ' ,1); title ('Spectrum of {\it g }_T ({\ it t}) ');

% calculate the reconstructed signal from ideal sampling and

% ideal LPF

% Maximum LPF bandwidth equals to BW= floor ((Lfft/Nfactor) /2) ;

BW=l0; %Bandwidth is no larger than l0Hz .

H_lpf=zeros (l,Lfft) ;H_lpf (Lfft/2-BW:Lfft/2+BW-1)=1; %ideal LPF

S_recv=Nfactor*S_out . *H_lpf ;

% ideal filtering

s_recv=real (ifft ( fftshift (S_recv) ));

% reconstructed £-domain

s_recv=s_recv (l:Lsig) ;

% reconstructed t-domain

% plot the ideally reconstructed signal in time

% and frequency domain

figure (2)

subplot (211) ; sfig2a=plot (Faxis,abs ( S_recv) );

xlabel ('frequency (Hz) ');

axi s ([-150 150 0 300] );

title ('Spectrum of ideal filtering (reconstruction) ');

subplot (212 ) ; sfig2b=plot (t,xsig, 'k-.' ,t, s_recv(l:Lsig) , 'b');

legend ('original signal ','reconstructed signal ');

xlabel ('time (sec) ');

title ('original signal versus ideally reconstructed signal ');

set ( sfig2b, 'Linewidth ' , 2) ;

% non-ideal reconstruction

ZOH=ones (l,Nfactor) ;

s_ni=kron ( downsample (s_out ,Nfactor) ,ZOH ) ;

S_ni =fftshift (fft (s_ni ,Lfft) );

S_recv2 =S_ni .*H_lpf;

% ideal filtering

s_recv2=real (ifft ( fftshift (S_recv2 ))); % reconstructed £-domain

s_recv2 =s_recv2 (1:Lsig) ;

% reconstructed t-domain

% plot the ideally reconstructed signal in time

% and frequency domain

figure (3)

subplot (211) ; sfig3a=plot (t,xsig, 'b',t,s_ni (l:Lsig) , 'b');

xlabel ('time (sec) ');

title ('original signal versus flat-top reconstruction ');

subplot (212 ) ; sfig3b=plot (t,xsig, 'b' ,t, s_recv2 (1:Lsig) , 'b--');

legend ('original signal ','LPF reconstruction ');

xlabel ('time (sec) ');

set ( sfig3a, 'Linewidth ' , 2) ; set (sfig3b, 'Linewidth ' , 2) ;

title ('original and flat-top reconstruction after LPF');

To construct the original signal g (t) from the impulse sampling train gT (t), we applied an

ideal low-pass filter with bandwidth 10 Hz in the frequency domain. This corresponds to the

interpolation using the ideal sine function as shown in Sec. 6.1.1. The resulting spectrum, as

shown in Fig. 6.40, is nearly identical to the original message spectrum of g(t). Moreover, the

time domain signal waveforms are also compared in Fig. 6.40 and show near perfect match.

In our last exercise in sampling and reconstruction, given in the same program, we use

a simple rectangular pulse of width T s (sampling period) to reconstruct the original signal

from the samples (Fig. 6.41). A low-pass filter is applied on the rectangular reconstruction

and also shown in Fig. 6.41. It is clear from comparison to the original source signal that the

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!