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.

316 SAMPLING AND ANALOG-TO-DIGITAL CONVERSION

xlabel ('time (sec . )');

% send the signal through a 16-level uniform quantizer

[s_out ,sq__out , sqh_out2 ,Delta, SQNR] =sampandquant (xsig, 4,td, ts) ;

% obtained the PCM signal which is

% - sampled, quantized, and zero-order hold signal sqh_out

% plot the original signal and the PCM signal in time domain

subplot (212 ) ;sfig2=plot (t,xsig, 'k' ,t, sqh_out2 (1:Lsig) , 'b');

set (sfig2 , 'Linewidth ' ,2) ;

title ('Signal {\it g} ({\it t}) and its 4 level PCM signal ')

xlabel ('time (sec . )');

Lfft=2 A ceil ( log2 (Lsig) +l) ;

Fmax=l/ (2*td) ;

Faxis=linspace (-Fmax , Fmax,Lfft} ;

SQHl=fftshift (fft ( sqh_outl ,Lfft) );

SQH2=fftshift (fft ( sqh_out2 ,Lfft) );

% Now use LPF to filter the two PCM signals

BW=lO ; %Bandwidth is no larger than lOHz .

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

Sl_recv=SQHl .*H_lpf;

% ideal filtering

s_recvl=real (ifft ( fftshift ( Sl_recv) )); % reconstructed f-domain

s_recvl= s_recvl (l:Lsig) ;

% reconstructed t-domain

S2_recv=SQH2 .*H_lpf;

% ideal filtering

s_recv2=real (ifft ( fftshift( S2_recv) ) ); % reconstructed f-domain

s_recv2=s_recv2 (1:Lsig) ;

% reconstructed t-domain

% Plot the filtered signals against the original signal

figure (2)

subplot (211) ;sfig3=plot (t,xsig, 'b-',t, s_recvl , 'b-. ');

legend ('original ','recovered ')

set (sfig3 , 'Linewidth ' ,2} ;

title ('Signal {\it g} ( {\it t} ) and filtered 16-level PCM signal ')

xlabel ( ' time (sec . ) ' ) ;

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

legend('original ','recovered ')

set (sfig4 , 'Linewidth ' ,2) ;

title ('Signal {\it g }({\it t} ) and filtered 4-level PCM signal ')

xlabel ( ' time (sec . ) ' ) ;

In the first example, we maintain the 50 Hz sampling frequency and utilize L = l 6

uniform quantization levels. The resulting PCM signal is shown in Fig. 6.42. This PCM

signal can be low-pass-filtered at the receiver and compared against the original message

signal, as shown in Fig. 6.43. The recovered signal is seen to be very close to the original

signal g(t).

To illustrate the effect of quantization, we next apply L = 4 PCM quantization levels. The

resulting PCM signal is again shown in Fig. 6.42. The corresponding signal recovery is given

in Fig. 6.43. It is very clear that smaller number of quantization levels (L = 4) leads to much

larger approximation error.

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

Saved successfully!

Ooh no, something went wrong!