06.06.2022 Views

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

314 SAMPLING AND ANALOG-TO-DIGITAL CONVERSION

Figure 6.4 1

Reconstructed

signal spectrum

and waveform

from applying

the simple

rectangular

reconstruction

pulse (Fig. 6.6)

followed by LPF

without

equalization.

0

-1

Original signal versus flat-top reconstruction

0.1 0.2

0.3 0.4 0.5

Time, second

0.6 0.7

0.8 0.9

Original and flat-top reconstruction after LPF

2,----"-"T"----,---...c,-----,-----,----.----.----"-"T"----,-----;1

--- Original signal

LPF reconstruction

0

-I

'I

'I

V

-2 '----'-----.L----'------'-----'-----'-----'-""""-=-'----.L----'

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

Time, second

q_l evel=sig_nmax+Delta/2 :Delta:sig__pmax-Delta/2 ; % de fine Q-levels

L_sig=length (sig_in) ; % find signal length

sigp= (sig_in-sig_nmax) /Delta+l/2; % convert into 1/2 to L+l/2 range

qindex=round (sigp) ; % round to 1, 2, ... L levels

qindex=min ( qindex,L) ; % eleminate L+l as a rare possibility

q_out=q_level (qindex) ; % use index vector to generate output

SQNR=20*log10 (norm(sig_in)/norm (sig_in-q_out )); %actual SQNR value

end

The function sampandquant .m executes both sampling and uniform quantization

simultaneously. The sampling period ts is needed, along with the number L of quantization

levels, to generate the sampled output s_ou t, the sampled and quantized output sq_ou t,

and the signal after sampling, quantizing, and zero-order-hold sqh_out.

% (sampandquant .m)

function [s_out ,sq_out, sqh_out,Delta, SQNR] = sampandquant (sig_in, L, td, ts)

% Usage

% [s_out , sq_out,sqh_out ,Delta, SQNR] =sampandquant (sig_in,L, td, fs)

% L number of uni form quantization levels

% sig_in - input signal vector

% td original signal sampling period of sig_in

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

Saved successfully!

Ooh no, something went wrong!