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.

6.9 MATLAB Exercises 317

Figure 6.42

Original signal

and the PCM

signals with

different numbers

of quantization

levels.

Signal g(t) and its 16-level PCM signal

0

-1

-2L_ ___j___ L__ _ ___j___ L__ _ ___j___ L___'s:::z:lL__ _ __j____ _J

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

Time, second

Signal g(t) and its 4-level PCM signal

0

-1

-2 ._ __ _.__ __ _,, ___ _.__ __ _._ ___ .,__ __ ---'---"""-----'------c'----'

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

Time, second

Delta Modulation

Instead of applying PCM, we illustrate the practical effect of step size selection in the design

of DM encoder. The basic function to implement DM is given in del tamod. m.

% (deltamod .m)

function s_DMout= deltamod (sig_in,Delta,td, ts)

% Usage

% s_DMout deltamod (xsig, Delta,td, ts) )

% Delta DM steps ize

% sig_in - input signal vector

% td original signal sampling period of sig_in

% ts new sampling period

% NOTE : td*fs must be a positive integer;

% Function outputs :

% s_DMout - DM sampled output

if (rem(ts/td, 1)==0)

nfac=round (ts/td) ;

p_zoh=ones (l,nfac) ;

s_down=downsample ( sig_in,nfac) ;

Num_i t=length ( s_down) ;

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

Saved successfully!

Ooh no, something went wrong!