dokumen.tips_85224768-digital-signal-p-ramesh-babu.pdf

HariniVemula 804 views 148 slides Apr 14, 2023
Slide 1
Slide 1 of 148
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87
Slide 88
88
Slide 89
89
Slide 90
90
Slide 91
91
Slide 92
92
Slide 93
93
Slide 94
94
Slide 95
95
Slide 96
96
Slide 97
97
Slide 98
98
Slide 99
99
Slide 100
100
Slide 101
101
Slide 102
102
Slide 103
103
Slide 104
104
Slide 105
105
Slide 106
106
Slide 107
107
Slide 108
108
Slide 109
109
Slide 110
110
Slide 111
111
Slide 112
112
Slide 113
113
Slide 114
114
Slide 115
115
Slide 116
116
Slide 117
117
Slide 118
118
Slide 119
119
Slide 120
120
Slide 121
121
Slide 122
122
Slide 123
123
Slide 124
124
Slide 125
125
Slide 126
126
Slide 127
127
Slide 128
128
Slide 129
129
Slide 130
130
Slide 131
131
Slide 132
132
Slide 133
133
Slide 134
134
Slide 135
135
Slide 136
136
Slide 137
137
Slide 138
138
Slide 139
139
Slide 140
140
Slide 141
141
Slide 142
142
Slide 143
143
Slide 144
144
Slide 145
145
Slide 146
146
Slide 147
147
Slide 148
148

About This Presentation

textbook


Slide Content

Scilab Textbook Companion for
Digital Signal Processing
by P. Ramesh Babu!

Created by

Mohammad Faisal Siddiqui

B.Tech (pursuing)
Electronics Engince
Jamia Milia Islamia
College Teacher
Dr. Sajad A. Loan, JM,
Cross-Checked by
Santosh Kumar, IITB

July 12, 2011

Fund by
its
codes written in it can be downloaded fom
section at ae ain

Textbook Companion Projet

e mea

Book Description

‘Title: Digital

gal Processing

Author: P. Ramesh Babs

itech Publications (INDIA) Pet, Ltd
Edition:

Year: 2010

ISBN: SISITLOSIT

Seitab numbering policy used in this document and the reli
above book.

Exa Example (Solved example)
Eqn Equati

AP Appendix to Example(Sclab Code that isan Appednix toa particular
Example ofthe above book)

n (Particular equation ofthe above book)

For example, Exa 3.51 moans solved example 351 of this book. See 2.3 means
‘ascilab code whose theory is explained in Section 2.3 of the book.

Contents

List of Seilab Codes 4

1 DISCRETE TIME SIGNALS AND LINEAR SYSTEMS 11

2 THE Z TRANSFORM. a
3 THE DISCRETE FOURIER TRANSFORM 50
THE FAST FOURIER TRANSFORM 7
5 INFINITE IMPULSE RESPONSE FILTERS vo
6 FINITE IMPULSE RESPONSE FILTERS 102
7 FINITE WORD LENGTH EFFECTS IN DIGITAL FIL.
TERS 139
$ MULTIRATE SIGNAL PROCESSING 1
9 STATISTICAL DIGITAL SIGNAL PROCESSING 143

11 DIGITAL SIGNAL PROCESSORS 146

List of Scilab Codes

Exa Lt Continous Time Plot and Diserete Tine Plot

Exa 12 Continuous Time Plot and Diserete Tine Plot

Exa La Evaluate the Summations

Exa 13.5 Evaluate the Summations

Exa Ln Check for Energy or Power Signals

Exa Lod Check for Energy or Power Signals

Exa 13.0. Determining Periodicity of Signal

Exa 15e Determining Periodicity of Signal
Determining Periodicity of Signal

Stability of the System

Convelution Sum of Two Sequences

lagnitude and Phase Response
Exa 137 Sketch Magnitude and Phase Response

Exa 1.38 Plot Magnitude and Phase Response

Exa 145 Filter to Eliminate High Frequeney Component
Exa 1.57 Diserete Convolution of Sequences

Exa 161 Fourier Transform

Exa 162 Fourier Transform

Exa L6La Frequency Response of LTT System,

Exa LGLe Frequency Response of TI System,

Exa2.1 2 Transform and ROC of Casal Sequence
Exa22 2 Transform and ROC of Anticansal Se
Esa 23 2 Transform ofthe Sequence

Ex 24 2 Transform and ROC of the Signal
Ex 25 2 Transform and ROC of the Signal

Ex 26 Stability of the System
Ex 27 2 Transform ofthe Signal

Exa 28a 2 Transform of the Signal

Exa 29 2 Transform ofthe Sequence

Exa2.10 2 Transform Computation

Exa 2.11 2 Transform ofthe Sequence

Exa 2.18.02 Transform of Discrete Time Signal.
xa 2.132 Transform of Discrete Time Signals .
Exa 2.13.02 Transform of Discrete Tine Signals
xa 2.13 2 Transform of Discrete Time Signals .
Exa216 Impulse Response of the System

Exa217 Pole Zero Plot of the Dilfewne Equation |

Exa 219 Frequeney Response ofthe System

Exa 220. Inverse 2 Transform Computation

Exa 222 Inverse Transforma Computation

Exa2.23 Canal Sequence Détermination

Exa 2H Impulse Response of the Syst

Exa 2.35. Pole Zero Plot of the System.

Exa 2.35, Unit Sample Response of the System +

Bxa238 Deter ut Response

Exa2.40 Input Sequence Computation

Exa 2.1.02 Transform of the Signal +

Bxa 2.41. 2 Transform ofthe Signal

Esa 241: x Transform of the Signal

Exa245 Pole Zero Pattern of the System

Exa 253 a 2 Transform ofthe Sequence

xa 2.58. 2 Transform ofthe Signal

Exa 253.04 Transform of the Signal

xa 2.53 4 2 Transform ofthe Signal

Exa2.51 2 Transform of Cosine Sigal

Exa2.58 Impulse Response of the Syst

Es31 DET amd DFT... .

Em 32 DFT ofthe Sequenco
$ Point DFT .

IDET of the given Sequence

Plot the Sequence

Remaining Samples

Ex 3.11 DFT Computation

ES

Exa 3.13 Cireubar Comolution
Exa 3.4 Circular Convolution
Exa 3.15 Determine Sequence ss >
Exa 3.16 Circubr Convolution
Exa 3.17 Cireubr Convolution

Exa 3.18 Output Response

Em 320. Output Response -
Exa 321

Exo322a N Point DFT Computation
Eu 3.23. N Point DFT Co

Exa 3.23. N Point DFT Computation
Ex 323.4 N Point DFT Computation
Exa 3.286 N Point DFT Computation
xa 3281 N Point DFT Com

Exa 324. DFT ofthe Sequenor :
Exa325 8 Point Cireular Convolution

Exa 327. Cireular Convolution Con
Exa330 Caleulte value of N
ExaS.32 Sketch Sequence .

Bm 336 Determine DET 00.000.
Exad.3 Shortest Sequence N Computation -
Exadd ‘Twiddle Factor Exponents Caleulation
Exa 46 DFT using DIT Algorthn

Exa 48 DET using DIF Algorithm
Ex 49 § Point DET of the Sequence
Exa 4.10 4 Point DFT of the Sequence
Bam it TDRT of ie Seen dng DIT Alai «
Exa 4.12 8 Point DFT of tho Sequence

Ex 4.13 8 Point DFT of

Exa 414 DET using DIT Algorithm.
Exad.l5 DET using DIF Algorithm >
Exa 4.16.08 Point DET using DIT FFT
Exa 116.08 Point DPT using DIT FF

Exa 4.17 IDFT wing DIF Algorithm.
Exa 4.18 IDFT wing DIT Algprithm +
Bxad.19 | FFT Computation ofthe Sequence

$
2
$
5
s
si
E]
s
$
86
86

6

Bx 4,20 § Peint DPT by Radix 2 DIT FFT
Exa421 DPT using DIT FFT Alprichm.

Exa 422 Compute X using DIT FFT

Exa 423 DFT using DIF FPT Algorithm

Exa 4.24 8 Point DET of the Sequence
Exa5.1 Order of the Fiker Determination
Exa5.2 Order of Low Pass Butterworth Filter
Exu54 Analog Butterworth Fier Des
Exa55 Analog Butterworth Filter Design
Ex 56 Order of Chebyshev Pier

Ex 57 Chebyshev Filter Design +

Exa 5.8 Order of Type 1 Low Pass Chebyshev Filler

Ex 59 Chebyshey Filter Design

xa 10 HPP Fer Dai with a Series

Eu 5.11 Impulse Invariant Method Filter Design

xa 5.12 Impulse Invarlant Method Filter Design

Exa5.13 Impulse Imariant Method Filter Design

Exa515 Impulse Invariant Method Filter Design

Exa 5.16 Bilincar Transformation Method Filter Design
Exa 517. HPF Design using Bilucar Transfon

Exa 5.18 Bilinear Transformation Method Filter Design
Exa 519 Single Pole LPF into BPF Conversion... -

Exa 529 Pole Zero HR Filter into Lattice Ladder Structure
Exa 6.1 Group Day an Phase Delay

Ba 6.5 LPF Magnitude Response

Exa 6.6 HPF Magnitude Response

Ex 6.7 — BPF Magnitnde Response

Exa 68 BRE Magnitude Response

Exa Ga HPF Magnitude Response using Hanning Window
Exa 69 HPF Magpitud Response sing Hamaning Window
Exa6.10 Hanning Window Filter Design

Exa G11 LPP Fier Design using Kaiser Window

Exa 612 BPF Filter Design using Kaiser Window

xa 6.18.4 Digital Direniator using Rectangular Window
Exa 6.13. Digital Diffreniator using Hamming Window

Exa 6.1La Hilbert Transformer using Rectangular Window
Exa 6.14 Hilbert Transformer using Blackman Window
Exa6.15 Filter Coefficients obtained by Sampling

Exa G16 Coeficents of Lincar phase FIR Fier
Exa 617 BPF Filter Design using Sampling Method

Exa 6.18. Frequency Sampling Method FIR LPF Filter

xa 6.18. Frequency Sampling Method FIR LPF Filter
Exa 6.19 Filter Coefficients Determination .

Exa620 Filter Coefficients using Hamming Window |

Exa 621. LPP Biter using Rectangular Window -

Exa 628 Filter Coefficients for Dimet Form Structure -
Exa6.29 Lattice Filter Coefficients Determination

Ex 72 Subtraction Computation

Exa 7.14 Variance of Output due to AD Conversion Process
Exa 89 Tan Compenent Decompesition

Exa8.10 Two Band Polyphase Decomposition

Exa 97a Frequeney Resolution Determination

Exa 97 Record Length Determination... <>

Exa 98a Smallot Record Length Computation

Exa 98b Quality Factor Computation

Exa 113 Program for Integer Multiplication

Exa 115. Function Value Caleuation

List of Figures

‘Continvons Tine Plot and Diserete Timo Plot
Continous Time Plot and Diserete Time Plot
Determining Periodicity of Signal

Determining Perodiciy of Signal

Determining Periodicity of Signal

Plot Magnitude and Phase Response

Sketch Magnitule and Phase Response

Plot Magnitude and Phase Response

Filter to Eliminate High Frequency Component
Frequency Response of LT System

Frequency Response of LT Syste

Pole Zero Plot of the Difference Equation
Frequency Response of the Syst

Impulse Response of the System
Pole Zero Plot of the Syste

Unit Sample Response of the System

Impulse Response of the System

DFT ofthe Sequence
Pot the Sequence:
She Sequence

LPF Magnitude Response
HPF Magnitude Response

PF Magnitude Response
BRF Magnitude Response

30

6.5 HPF Magnitude Response using Hanning Window
6.6 HPF Magnitude Response using Hamming Window
6.7 Hanning Window Flter Design»: ++ +

68 LPP Filter Design using Kaiser Window
6.9 BPE Filter Design using Kaiser Window E
6.10 Digital Direntator using Rectangular Window
6.11 Digital Difrentator u Window
6.12 Hilbert Transformer using Rectangular Window
6.13 Hilbert Transl ng Blackanan Window

6.14 Frequency Sampling Method FIR LPF Fier

6.15 Frequency Sampling Method FIR LPF Filter

6.16 Filter Cocffcints Determination

6.17 Filter Coofiients using Hamming Window

6.18 LPF Filter using Rectangular Window

10

Chapter 1

DISCRETE TIME SIGNALS
AND LINEAR SYSTEMS

lab code Exa 1.1 Continnous Time Plot and Diercto Time Plot

ample 1.1

3 clear all;

u ylaber (x(t):
12 tstle (CONTINUOUS TIME PLOT");
13 n=0:0.2:25

|

Figure 1.1: Continuous Time Plot and Diserete Time Plot

2

lal

Figure 1.2: Continous Time Plot and Diserete Timo Plot

10 plov2da(n,x2);
17 xtaber('n');

18 ylabel('x(n) "D3

19. tite (DISCRETE TIME PLOT") ;

Seilab code Exa 1.2 Continuous Time Plot and Discrete Time Plot

1 //Example 1.2

2 //Skeveh th
ao)
signal with a sampl

continuous time signal x=
d also its diserete time eq
8 period T = 0,2800

1

clear all;
ele à

close ;
1=0:0.01:2;
xinein (Tee) +otn (106€);
subplor(1,2,1);

plot (e,x1);

xabel t's
Na ox
tát1e('CONTINUOUS TIME PLOT");
n=0:0.2:2;
x2=sin(Ten) sein (10en) ;
‘subplot (12,2);
plot2d3(m,12);
Radeln);
plaber (x(n) "95
title ( DISCRETE 1

Seilab code Exa 1.3.0 Evaluate the Summations

//Example 1.3 (a)
MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
//Calculate Following Summations

clear all;

cle
close ;
syne ni

X= syngum (sin(2en),n ,2, 2)
//Display the result in command window
@iep ("The Value of summation comes out to be

>

Seilab code Exa 1.3.b Evaluate the Summations

u

Example 1.3

()

MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
//Calewlate Following Summations

clear all;
ce à

close +

syns ni
X= ayacun Cie
/ Display the

en), 0, 0):
result in command window

dep (%,” The Value of summation comes out to bei”);

Seilab code Exa 1.4.1 Check for Energy or Power Signals

//Example 1.4

(a)

//MAXINA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM

// Find Energy
clear all;
cle

close ;
ayne nt
0/3)";

E= syacun (x7

2.0.0, tint)

/[Display the result in command window
top CE," Energy");

p= (1/91)

ssyasum (172,2 ,0, Wi

Palinit(p,N,%inf);
disp (P,"Power:")

I The Energy

is Finite and Power is 0

given signal is an Energy Signal

Power of Given Signals

Therefore the

Seilab code Exa 1.4.4 Chock for Energy or Power Signals

Example 1.4

(a)

//MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM

//Find Energy an
clear all;

ae

close ;

ayas nM;

xehe-(2en) à

E= syncun (x°2,n ‚0, tint)

/[Display the result in command window

top CE," Energy :") à

p=(1/(22N+ 0) Jesynsum (72.0 40, Mi
Pelinie(p,N,%inf);

isp (P,"Power:");

//The Energy andPower is infinite, Therefore

Power of Given Signals

given signal is an neither Energy Signal nor

Power Signal

Seilab code Exa 1.5.2 Determining Poriodiity of Signal

//Example 1.5 (a)

//To Determine Whether Given Signal is Periodic or

not
clear all;

ele à

close ;

+=0:0.01:2;
zimexp(hisöckpier);

subplot (1,2,1)5,

plot (t,x);

xabel ("1")

haber ('x(t)");

tát1e ('CONTINUOUS TIME PLOT");
n=0:0.2:2;

: | | | | | |
yy

Figure 14: Determining Periodicity of Signal

x2=0xp (Ui +64 pan) à
subplot (1,2,2) 5

plot2d3(nyx2);

xlabel('n');

ylabel( x(n) "95

eiete( DISCRETE TIME PLOT");

//Hence Given Signal is Periodic with Nel

Scilab code Exa 1.5.6 Determining Poriodicity of Signal
//Example 1.5 (e)

15

ir

lo Determine Whether Given Signal is Periodic
clear all;

ae

close ;
1=0:0.01:10;
xi=cos (2eKpiet/3);
subplot (142,195,
ploë(e,x1)

xabel ("1");
haber Cx(1)"):
titre ( CONTINUOUS
2=0:0.2:10;
x2=cos (2+psen/3);

subplot(1,2,2)5

plot243(n,x2) à

xabel (n°)

ylabel ('x(n) ‘);

este (DISCRETE TIME PLOT);

//Mence Given Signal is Periodic with N

IME PLOT");

Seilab code Exa 1.5.d Determining Periodicity of Signal

//Bxample 1.5 (4)

//To Determine Whether Given
clear ally

de à

close;

1=0:0.01:50,
xiscos(Ipist/3)+cos (Brkpiet/a);
‘subplot (12,1);

plot (t,x1);

igual is Periodic

10 nadercı);
m yla Ox(t) 0;

12 title (CONTINUOUS TIME PLOT”);
13 n°0:0.2:50
1 x2=cos (Hpsen/3)+cos (Sekpsen/4) 5

15 subplot (1,2,2);,

16 plov2d3(nyx2);

17 xlaber(n');

18 ylabel('x(n) "D3

19 title ("DISCRÈTE TIME PLOT);

20 //Hence Given Signal is Periodic with

Seilab code Exa 1.11 Stability of the System

1 //Bxample 1.11
2 //MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
3 // Testing Stability of Given System

1 clear all;

5 cle à
6 cle:
7
s

syns ni
x 17290
9 X= aynsun (x,n ,0, Kine );
10 //Display the result in command window
1 asap (X,"Summation is :")
12 diep( Hence Summation < infinity. Given System is
Stable");

Scilab code Exa 1.12 Convolution Sum of Two Sequences

//Example 1.12
//Progeam to Compute convolution of given sequences
/ix(n)=I8 21 21, Kin)

clear all;
ele à

close ;

ve 212);
belt 21 2);
Y=convol (x,8)
Hay:

//Program to Compute convolution of given seq
fix(a)alt 21 1], K)alı 1 1 1):

clear all;

ae

co.
ret 21 0:
bel a ll;
y=convoi (x, à
rep (round (y);

Seilab code Exa 1.18 Cross Corrlation of Two Sequences

//Example 1.18

//Program to Compute Cross-correlation of given

Jpx(n)ald 2 1 1], Alt 1 2 1]
clear all;

ae

close ;
xe 24 1);
bell 12 1);
hist. 21 1d;

1

Figure 1.6: Plot Magnitude and Phase Response

yeconvol (x,h1);
aiepCround(y));

Seilab code Exa 1.19 Determination of Input Sequence

//Example 1.19

//%o find input x(n)

Ju ()= 2 1]
clear all

ele à
co.

2-2

nz" 6450(2" (8) +10° (2" (4) ) 4118 (2° (233480 (2° (2)) 440 (2

“aes

y(n)

(15101844)

bes-6r2e27(5)+102" (4);

x =bdiv(a,b,5)
aiop (x, "x(n):

>

Seilab code Exa 1.32.a Plot Magnitude and Phase Response

//Example 1.32
//Program to Plot Magnitude and Phase Responce
clear all;

cle

close i

weeps 10.01: Hp;
He1+2ecos (w)2ecoe (240);
//caluculation of Phase and Magnitude of H
(phase_H ‚n]=phasonag(h) ;

Hasabs(W) ;

argcaO;

‘subplot (2,1,1);

a.y_location= origin";

ploe2a(w/Xps, ta) 5

xlabel(' Frequency in Radians')

label ("abs (Him) +

‘title ( MAGNITUDE RESPONSE
subplot (2,1,2)à

asgeaQ;

aux Locations origin”;
a.y_location= origin";
plot24(a/(2e1p1) ,phase_W);
xlabel (Frequency in Radians');
yb Cm);
title (PHASE RESPONSI

di

Seilab code Exa 1.37 Sketch Magnitude and Phase Response

a

Figure 1.7: Sketch Magnitude and Phase Response

//Example 1.37
//Program to Plot Magnitude and Phase Responce
1500) =1/2(x(m)+x(1—2)]

clear all;

w=0:0.01:4p4
ME du
//ealuenla: Magnitude of H
(phase

Ha=abe
a=gca0;
subplot (2,1,1);
a.y_location=" origin";
plot2d(w/%p4 Mn) ;
xlabo1(' Frequeney
ylabel(" abs (Hm)")
‘title (MAGNITUDE RESPONSE");
‘subplot (2,1,2);,

ages Os

ax locations" origin";

aly location=" origin”;
plot2d(w/(2*%pa) , pha

in Radians")

Figure 1.8: Plot Magnitude and Phase Response

21 xlabel(’ Frequency in Radians');
2 ylaber(’<(H));
25 title CPHASE RESPONSE");

Scilab codo Exa 1.88 Plot Magnitude and Phase Response

1 //Bxample 1.38
2 //Program to Plot Magnitude and Phase Responce
3 //0.5delta(n)+delta(n—1)+0.5delta (n-2)

1 clear all;

ps :0.02: p35

S Ha. 5toxp (Hi +H) +0. 5eoxp(-Miew)
9 /fealenlation of Phase and Magnitude of H
10 {phase H ,a]*phasenag (H

11 Hasabs(H

12 asgeaQ;
13 subplor (2,1,1);

1 a.y locations" origin”;
15 plot24(a/%p1,Mm);

16 xlabel('Frequeney in Radians’)
17 yladelC abs (Hm);

15 tst20 CMAGNITUDE RESPONSE") ;

19 subplor(2,1,2);

20 asgeaQ;

21 4.x Locatson=" origin";

22 aly locations" origin”;

23 plov2a(w/(2*%ps) ,phase_H);

21 xLabed( Frequency in Radians”);
25 ylabei Om):

26 title (PHASE RESPONSE’)

Seilab code Exa 1.45 Filter to Eliminate High Frequency Component

1 //Bxample 1.45
211

3 clear all;

à cle à

5 clos

5 t=0:0.01:10;

7 nade cos (Set) +cos (300%)

S zie2ecos (Set,
9 b=[0.05 0.081;
10 anti 0.01;

11 y=filter (b,x);
12 subplot(2,1,1)à

13 plot(e, 2)

M xlabel Time in See");
15 ylabel (Amplitude);
16 subplot (2,1,2);

17 plot(e.y)i

18 subplor(2,1,2);
19 ploe(esxt,'! 9
20 title (x:SIGNAL WITHOUT NOISE y:SIGNAL WITH NOISE")

xabe (Time in See");
ylabel(’ Amplitude)

Seilab code Exa 1.57.4 Diserete Convolution of Sequences

1 //Example (a)

2 //Program to Compute discrete convolution of given
ISE 2-1 1], h(n)=[1 0 1 1)

clear all;

5 ele

6 clos
Tat 2-110;

S het 0 1 1);
9 ynconvoi Gem;
10 dep (round (y);

Seilab code Exa 1.61 Fourier Transform

//Example 1.61
//MAXINA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
Fourier transform of (3)'n u(n)

clear all;

5 cle

6 clos

7 syse ni

8 x =(3) a

9 X= oynsun (x,n 0, Lint )

10 //Display the result in command window

Figure 1.10: Frequency Response of LT System

disp (X, The Fourier Transform does not exit as x(n)
is not absolutely summable and approaches
infinity i-e.")

Seilab code Exa 1.62 Fourier Transform

//Example 1.62
MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
//Fourier transform of (0.8) "|| a(n)

clear all;

de à

close ;

ayne vn

(hiewen) an ‚1, hint Jesyasum
((0.8)"neHe(-Hiewen) 00, Kant )
//Display_the i and window

Sep (X, "The Transform comes out to be

30

Seilab code Exa 1.64.8 Frequency Response of LT System

//Example 1.64 (a)

J/Program to Caleulate Plot Magn
Responce

clear all;

de

close ;

w=0:0.01:4pi

H=1/(1-0.59 he" (Heu);

[Jealucuiation of Phase and Magnitude of H

(phase _H 8] =phacenag (i);

Hmnabech);

angeaQ:

subplot (2.1.1);

a.y-Locarione origin";

plot2d (w/ pi ta);

xlabel (Frequency in Radians')

ylaben C abs (im) 95

title MAGNITUDE RESPONSE:

subplot (2.1.2);

angeaQ:

a x locations" origin";

a.y locations" origin":

plot2d(w/ QeKps) ‚phane.M);

xlabel C Frequency in Radi

na C <(H) 95

Eile (PHASE RESPONSE") ;

Seilab code Exa 1.64.¢ Froqueney Response of LTI System

a

3555558

gestl uses
$

Figure 1.11: Frequency Response of LTI System

//Example 1.64 (c)
2 //Program to Calculate Plot Magnitude and Phase
Responce
3 clear all;
1 cie ;
5 close;
5 w=0:0.01:4p4;
7 Me1/CI-0.98hieheic-hiew));
$ //caluculation of Phase and Magnitude of H
> (phase. ‚n]=phasenag(h) ;
Haeabs(W) à
asgeaO;
‘subplot (2,1,1);
ay location=" origin";
ploe2aw/ pi Ne);
xlabel Frequency in Radians")
ylabel(" abs (Hm)")
‘title (MAGNITUDE RESPONSE");
subplot (2,1,2);,
asgcaQ;
Aux locations origin";
a.y_locarion=" origin";
ploe2d(w/(2+Xpi) ,phase_H) ;
xlabel('Proquency in Radians');
ylaber(”<(H)")
Late (PHASE RESPONS

à

Chapter 2
THE Z TRANSFORM

Scilab code Exa 2.1 2 Transform and ROC of Cansal Sequenos

//Example 2.1
//Z- transform of [1 0 3 1 2]
clear ally

ele à

close ;

function [2a] =2tranetex (sequence ,n)
zepoly(0,'z",'r')

sequences (1/2)"n?
function
xis(1 0 3 -1 2)
Lengel
//Display the result in command windo
drop (22,"7-tran

Scilab code Exa 2.2 z Transform and ROC of Anticansal Sequence

a

J/Example 2.2
Yt transform of |
clear all;
ae
close ;
function (2a) «2transfer (sequence ,n)
z=poly(0,'2",'r')
zarsoquences(1/2)"n"

function.
xis(-3 -2 -1 0 1);
na (Length (k1)-1) 70
2aratraneter(xi,n);
//Display the result in command window
sap (22,7 Z-transform of sequence is
asepCROC is the entire plane except 2 = Kin’);

2101

Seilab code Exa 2.3 2 Transform of the Sequence

//Example 2.3

//% transtorm of |? -1 3 21023 1]

clear all;

le à

close ;

function (2a) =ztransfer (sequence ,n)

zepoly(0,’2","r")

zancequonces(1/2) "a?

endfunction

xi=l2 1821028 -11;

nadia;

z2rztranster(xi,n)

//Display the result in command window

top (22,"Z-transform of sequence is

asepCROC is the entire plane except 2
Saint Ys

0 and 2

Seilab code Exa 2.4 2 Tra

form and ROC of the Signal

//Example 2.4
JIMAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
1/2 transform of a'n u(n)

clear ally

5 cle

8 close ;
Tyan
Ke aynsun (xe(2-(-n)) 2
10 //Display the result in co
11 asp (X,"Z-transform of an u(n) with is");
12 asepCROC is the Region mod(z) > a’)

Seilab code Exa 2.5 2 Transform and ROC ofthe Signal

//Example 2.5
JIMAXIMA SCILAB TOOLBOX REQUI
112 transform of -b’n u(-n-1)
clear ally

ele à

close ;

syme bn
x eva

Xe synsun (x+(27(-n)),0 ,0, Sint):

10 //Display the result in command window

11 dep (X,"Z-transform of b’n u(n) with is");
12 dispCROC is the Region mod(z) < D)

FOR THIS: PROGRAM

Seilab code Exa 2.6 Stability ofthe System,

//Example 2.6
MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
112 transform of 2n u(n)

Ke aynsun (xe(2-(-n)),n ,0, Yint );
//Display the result in co

Stop (X,"Z-transform of 2
asspCROC is the Region

Seilab code Exa 2.7 2 Transform of the Signal

//Example 2.7
[MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
//% transtorm of (3(3"n)-4(2)"m] un)

clear all;

ele à

loi

syne n 2:
xi =(3) "a;

Xie ayneun (38 xt (27
x2 =) (a)

X2= aymeun (de x2 (end) ‚0, Mint Di
Xen:

/fDisplay the result in command wi
top (X,"Z-transform of [3(3°n)-4(2)'n] u(n) is

dm ,0, Rint);

>

Seilab code Exa 2.8.2 2 Transform of the Sign

sr

//Example 2.8 (a)
/MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
12 transform of cos (Worn)

che;

syme Yon 2;
xinexp(aqrt (-1) +Worn:
Kirsynsun(xie(z"-n) ,n,0,4int);
x2eoxp(~sqrt (1) Hom);
X2=eynsun(x2+(2"=0),12,0,1480);
x= (11442) /2

COTE

Y

Seilab code Exa 2.9 2 Transform of the Sequence

//Example 2.9
//MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
//% transform of (1/3)°n w(n-1)

clear all;

ele à

co.

syne n 2:
x "an;

Xe (1/2) saynous (xe(2"(-n)),2 ‚0, Mint)
//Display the result in command window

sap (8,"Z-transform of (1/3) n u(n-1) is 2°95

Seilab code Exa 2.10 2 Transform Computation

//Example 2.10
//MAXINA SCILAB TOOLBOX REQUI
//% transform of r°n.cos (Worn)
cle:

syme + Won 2;

FOR THIS

PROGRAM

x1e(7n) rex (ogee (AD Horn);
Kirsynsun(xie(z"-n) ,n,0, hat);
x2=(r"n) toxp (~sqre (C1) sean) ;
K2seymeun (x2+(2"-a) ,n,0, 4398);
Ke(X1+42)/25

arepa, X(2)= 7):

Seilab code Exa 2.11 2 Transform of the Sequence

//Example 2.11
//MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM:
12 transform of nan u(n)

clear all;

ae

close ;

ayne anzı

x =(a) “ni

X= synsun (x+(2"(-n)),n ‚0, Sint )
You ditt G2);

//Display the result in co
top (1,"Z-transform of n.a'n

and window
ie)

Seilab code Exa 2.13.0 2 Transform of Discrete Time Signals

Example 2.13 (a)
//MAXINA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
[te transform of (-1/5)'n un) +5(1/2) (n)u(=n=1)
clear all;

cle à
lei

ayne n 2:
x 1/5)"
Kis eyasun (xi #(27(-n)),a 0, Kine di

30

10 #2 #(1/2)7 0)
11 X2= aynsun (Se x2 *(27(-m)),m ‚0, Lint);
= am;

13 //Display the result in command window

1 asap (X,"Ztransform of [3(8°n)-42)'n] win) is
15 asspCROC is the Region 1/5 < mod(z) < 2°)

Seilab code Exa 2.18.b 2 Transform of Disercte Time

1 //Example 2.13 (b)
2 //MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
5 //2 transform
1 cles
5 syns n 2 ki

Kirsyasun(x1+2"(-n) ,n,0,0);
8 x21;
D xgesynoum(x2+2"(-n) 941,19;
10 x31;
11 Xeeyneun(x3+2"(-n) ‚n,2,2)
12 X=0.5*X1+X2-1/3+X35
18 dsp);

Scilab code Exa 2.1340 2 Transform of Discreto Time Signals

1 //Example 2.13 (e)

2 //MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
3 //2- transform of u(n-2)

1 clear ally

5 cle:
6 clos

40

1
u

Xe (1/(2°D)reynsun (xe(27(-n)) un 0, Kant);
//Display the result in command window
dep (8,"Z-transform of u(n-2) in”);

Seilab code Exa 2.13.4 2 Transform of Disercte Th

//Bxample 2.13 (4)

//MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM

[te transform of (040.5
clear all;

(1/8) nun)

ayne n 2:
xt (1/32
X11= oynun (xis(2"(-a)),a ,0, Mint)
XL + diff (211,2);

x2 0/8) “(wi

X2= symoum (0.5¢ x2 +(2"(-m))in 40, Mint D:
X= er;

/[Display the result in command window

sep (8,"Z-transform of (n+0.5)((1/3) n)u(n)

Scilab code Exa 2.16 Impulse Response of the System

//Bxample 2.16
//To find input h
Ham 2-4 1), ball]
clear all;

cle à

close ;

olas
an2"3+24(27(2))~44 (2) 415
be2°3;

a

Figure 21: Pole

0 Plot ofthe Diference Equation

10 h widiv(a,d,4);
1 disp s"h(n)

Scilab code Exa 2.17 Pole Zero Plot ofthe Difference Equation
1 //Bxample 2.17
2 //To draw the pole-zero plot

3 clear all;

1 cle à

5 close

5 zeke

7 HAe((2)*(2-1))/((2-0.25) #(2-0.8))
$ xs0eC window "¿105

9 plzrcm2);

Figure 22: Frequency Response ofthe System

Seilab code Exa 2.19 Frequency Response ofthe System

//Example 2.19
//Program to Plot Magnitude and Phase Responce
clear all;
cle
close ;

4pi:0.01: ps;
He1/(1-0.8* (cos (w)~hivein(w)))
//caluculation of Phase and Magnitude of I
{phase jal=phasenag (HD 5
Has abe CH
argca0;
subplot (2,141);
a-y-location=" origin";
ploe2d(w/tp$ Ma)
xlabel('Freqiency in Radians');
y1abei (abs (Mm) )
tstlo CMAGNITUDE RESPONSE");
subplor(2,1,2);
argca0;
a.x location=" origin";
aly locations" origin”:
plot2d(w/(2+%pi) ,phase_H)
xlabel(' Frequency in Radians”)
nave om:
tstlo (PHASE RESPONSE);

Seilab code Exa 2.20. Inverse 2 Transform Computation

//Example 2.10 (a)
//To find input hi
/[S(2)=(4-40.2) /((2+0.5) (2-1)

a

close ;
ala;

a=(240.5)#(2-1)5
beze0.2;

h wtdiv(d,a.4);
disp (a,"h(n

Seilab code Exa 2.22 Inverse Transform Computation

//Example 2.22
//To find input x(n)

IK) 204" (—2) +202" (1) 41)
clear all

ele

close;

zi:

ad

ve 2;

à s2aiv(b,a,6);

disp "First six values of h(n

Seilab code Exa 2.23 Causal Sequence Deter

//Exumple 2.23
//To Find input x(n)
11X(2)=1f(1—22" (=1))(1=2"(=1)) °2
clear all;

ae

loi
ole:

8 a=(2-2)4(2-1)-2;

barca;
Rn mldiv(d,0,6)5

Figure 2.3: Impulse Response of the System

stop Ch," First six values of h(n

Scilab code Exa 2.34 Impulso Response ofthe System

//Example 2.34

//To plot the impulse responce of the system
alyically and using scilab

clear all;

cle

co:

n=0:1:60;

46

xe[1,20r08(1,50)1;

be(t 2);

ati 3 24);

yana1y=6/5%4."n=1/8+(=1)."95//Analytical Solution

ynatefilter(b,a,x);

‘subplot (3,1,1);

plot243(n,x)à

xtabei (n°);

Nave (x(n) ‘9:

titre INPUT SEQUENCE (IMPULSE FUNCTION) *);

subplot (3,1,2);

plot243(n,yanaly);

xabel (n°);

vas C'y(n) Di

tátle COUIPUT SPQUENCE yanaly");

subplot (8,1,3);

plet243(n,yaat) ;

Kabeln);

yhaber (y(n) 1):

‘title C OUTPUT SPQUENCE ymat ;

//As the Analtical Plot matches the Seilab Plot
hence it is the Responce of the system

Seilab code Exa 2.36. Polo Zero Plot ofthe System

/ [Example 2.35 (a)

//To draw the pole=zero plot
clear all;

ale à

co:

zeke

Mize (2)/(2°2-2-1);
oot C window "¿15

a

Figure 24: Pole Zero Plt ofthe System

as

ELLO UA

EGELEE subie

Figure 2.5: Unit Sample Response of the System

nern);

Scilab code Exa 2.35.b Unit Sa

le Response ofthe System

//Example 2.35 (0)

7/0 plot the responce of the system anal
using seilab

clear all;

ele

as

n=0:1:20;

ally and

49

2
18
15
16
15
1

a
2
ES
a
»
25
E

xeones (1, length (n)) ;
b=Lo 1);
art il:

yans1y=0.447+(1.618)."n=0.447+(-0.618).“0;//

Analytical Solution
Iynat,zt]etilterb, a,
subplot (3,141);
plor2da(nyx);

xabel (n°);

yrabel ('x(n) ");

Di

‘atte CINPUT SEQUENCE (STEP FUNCTION) *);

‘subplor (31,2);

plot2d3(ayyanaly) ;

mlabel('n');

ylaber (y(n) 1):

este (OUTPUT SEQUENCE

‘subplor (3,1,3);

plot243(n, nat 21)

xlabe On);

ylabel('y(n) 1):

tát1e COUIPUT SPQUENCE

//As the Analtieal Plot
h

ee it is the Responee

yamaly ds

yate
matehes the

Seilab Plot

of the system

Seilab code Exa 2.38 Determine Output Response

//Example 2.38
//To plot the responce
using seilab

clear all;

ele à

co:

n=0:1:20;

of the system

analyically

E intl

a

bef 1 1]

a=lı -0.7 0.121;

yanaly=38.89+(0.4) .-n-26.53+(0.3)."n-12.36¢4.76en;//
Analytical Solution

1 yaatetilter(b,a,x)

12 subplot (3.1.1);

13 plov2a3(m,x)5

1 xtabel('n');

15 ylabel('x(n) 5

16 tstle CCINPUT SEQUENCE (RAMP FUNCTION) *) ;

17 subplor(3,1,2);

18 plot243(n;yanaly)

19 xtaper(n');

ay ylaberl'yin) 93

21_tât2e COUTPUT SPQUENCE yanaly

2 subplot (3,1,3);

2% plor2as(n,ynat);

21 ab Cn);

2 ylaben('y(n)");

26 title OUTPUT SEQUENCE ymat") :

a //As the Analtical Plot matches the Seilab Plot

hence it is the Responce of the system

Seilab code Exa 2.40 Input Sequence Computation

1 //Bxampte 2.40

2 fre tind input x(n)

3 //K(0)=1 232, y(m)=I1 8 7 10 10 7

dés an

5 de

6 close 5

Fate

$ ora TA 4106 (2 (99) 400 (2 (2)) 470
EE

1
u

be2"6e2027 (5) 43427 (122° 9);
x sldiv(a,b,4);
disp Cx,"

di

Scilab code Exa 241: Transform of the Signal

//Example 2.41 (a)
//MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
[/% transform of n.(-1)'n u(n)

clear all;

syns a n 2;
xD a
X= ayneun (x+(2-(on)) 2,0, Mint )
Ys diff (2);

/[Display the result in co
sep (1,"Z-transform of na

ind. window
nun) iss)

Seilab code Exa 2.41.b 2 Transform of the Signal

//Example 2.41 (b)
/MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM

112 transform of n°2 uln)
clear all;

cle

close i

X= aynsun (xe(27(on)),n ,0, Mint )
Y= airs(aitt (x,2),2);

//Display the result in command window
dep (Y,"Z-transform of n°2 un) is

5

Figure 2.7: Pole Zero Patter of the Systen

Scilab codo Exa 2.41.¢ 2 Transfo

the Signal

[Example 2.41 (e)

//MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS. PROGRAM
1[ transform of (-1)'n. cos (%epi/3+n)

‘le:

syne n 2:

Wontps/3;

xisexp(agrt (-1) «ios:

Kie(-1) “nesyneum(xi+(2"-n),n,0, 4m)

x2=exp(-eqrt (-1) *¥orn) à
X2= (1) “nesyngum(x2*(2"=n),n,0,4inf) à
xD,

aiep (x, X(2)

Scilab code Exa 2.45 Pole Zero Pattern ofthe System

1 //Bxample 2.45

2 //To draw the pole=zero plot

3 clear all;

1 cle

5 close;

Gants

7 W1Ze((2) (2419) /(2°2-240.5)

8 xset (window ',1);

9 pizr (2);
Scilab code Exa 2.63.2 2 Transform of the Sequence

1 //Example 2.53 (a)

2 //Z- transform of [8125 70 1]

3 clear all;

1 cle

5 close ;

5 function(za)=ztraneter (sequence ,n)

T zepoly(0,'2","r")

8 zarsoquencer(1/2)"n?

9 endfunction

10 x1=(3 125701);

Mo ne-3:35

12 2z-2tranter(xi,n);

13 //Display the result in command window

11 diep (22,"Z-transform of sequence is
Seilab code Exa 2.53.b 2 Transform of the Signal

1 //Example 2.53 (b)

2 //MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM

//% traustorm of delta(n)
ae;

syne n 2:
Keeyneun(x+2"(-n),2,0,0);
ap X=

Seilab code Exa 2.53.0 z Transform of the Signal

Example 2.53 (e)
//MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
112 veansform of delta(n)

cle
syne nz ki

ae;

Kosymaun(xe2° (-n),n,k,2) à

isp, X(2)=);

Scilab code Exa 2.53.4 z Transform of the Signal

//Bxample 2.53 (4)

//MAXINA SCILAB TOOLBOX REQUIR
//% transform of delta(n)
eles

syne n 2 ke;

Kesymaun(x»2" (-n),n,-k, 1);
asp Xx)

Seilab code Exa 2.54 2 Transform of Cosine Signal

Figure 28: Impulse Response of the System,

1 //Bxample 2.54
2 //MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
3 //% transform of cos(Worn)

4 cle;

5 ayme Mo ma;

6 ximexp(sqrt (-1) horn);

7 Xinaymeun(k1e (220) 2,0, %inf);

8 x2=expl=oqre (-1) horn);

9 x2esyneum(x2+(2"-n),2,0,4inf);

10 1912) /25

1 atopcx, "XL

Scilab code Exa 2.58 Impulso Response of the System

//Example 2.58

//To plot the responce of the system analyically
using seilab

clear all;

de à

close ;

n=0:1:20;

xe(1 zeros(1,20)];

S belt -0.5);

u
a
1.
mn
15
15
4
15
1
EN
a
2
2
E]
»
2
>

anti -1 3/16);

yanaly=0.5+(0.78)."n+0.6+(0.28).-n;// Analytical
Solutio

yaatefitter(b,a,x);

Subplor(8,1,1)

plot2d3(a,x)

Kabeln);

yAabeic'x(n) 0:

title (INPUT SEQUENCE (IMPULSE FUNCTION) *) ;

‘subplot (3,1,2);

plot2da(nyyanaly);

xabel (n°);

ylabel C'y(n) 1):

title COUIPUT SEQUENCE analy");

subplot (31,3);

plot2d3(n,yaat);

xabel (nt)

ylabel C'y(n) Di

title COUTPUT SEQUENCE ymat ");

//As the Analtical Plot matches the Seilab Plot
hence it is the Responce of the system

Chapter 3

THE DISCRETE FOURIER
TRANSFORM

Scilab code Exa 3.1 DPT and IDPT

1 //Example 3.1

2 //Program to Compute the DFT of a Sequence x(n
1.1.0.0

3 //and IDFT of a Sequence Y[Kk]=[1,0,1,0]

1 clear all;

Taxe (1,1,0,0);
Computation
ok ett Gy Ds
Y= (2,0,1,0;
11 //IDPT’ Computation,
By site, Ds
13 //Display séquence X[k] and y[n] in command window

50

Figure 3.1: DPT of the Sequence

Seilab code Exa 3.2 DFT ofthe Sequence

1 //Example 3.2

2 //Program to Compute the DFT of a Seq)
and 0 otherwise

3 //for Nat and N=8. Plot Magnitude and phase plots of

1 clear al;
5 cle

6 clos

7 /IN

8 xi = (1,1,1,03;

9 //DET Computati

10 XL = tte Gat, -1)
"

2

3

Monte G2,
15 //Display se
16 dis," XI [=D à

drop (42, "X2[K]=")5
{Plots for N
ni=0:1:85
subplot(2,2,0 à

a ga Où
a.y-lecation =" origin
ale location = origin
phot2d3(nt, abs (x1) ,2);
polyisa.children(1)-children (1);
polyt.thickness=2;

xeseleC Nad", KO] XI,
‘subplot (2,2,2);,

a = ga Où
a.y.location =" origin
a x location =" origin

plot243(m1,atan(imag(X1) ¿1021 (X1)),5) 5
polyi=a.children(i)-children (1);
poly!.thickness=2;

seseleC Nat", "k' A

//Plats for NS

2=0:1:73

subplot (2,2,8);

age O

a.y-lecation =" origin

ale location =" origin

piot2d3(n2,abe(X2),2);

polyiva.children(1).children (1);

poly!.thickness=2

xtitleC NaS", "k',"|X2(k)

‘subplot (2,2,4);

a ga O

S a.y location =" origin";
a x location =" origin"

plot2d3(n2,atan(inag(x2) ,rea1 (X2)),8);

polyiea.childven(1)-children (1);

poly!.thickness=2;

xestleC NaS", KO, <X2(k) 3

6

Scilab code Exa 3.3 8 Point DFT

//Bxample 3.3

7/Program to. Compute the S point DFI
sn [1.1 1011 ,0,0)

clear ait;

cle

21,1,1,1,1,0,0)
IDET Comp
Resta. di
/ Display seque

ÉTIENNE

of the Seq

Seilab code Exa 3.4 IDFT of the given Sequence

//Example 3.4

//Program to Compute the IDFT of the
1=15.0.1-5.0.1,0,145,0]

clear ally

ele
close ;
jog (-1);

X = (5,0,1-3,0,1,0,1+3,0)
//DFT’ Computation
ket,

// Display se
Siop@a,x[nl=");

Figure 3.2: Plot the Sequence

Seilab code Exa 3.7 Plot the Sequence

//Example 3.7
//Program to Compute cireular convolution of

following sequences

Jfx{u}= (1,2 241,0)
//¥{k]= exp(—j #4 piek/5) X[k]
clear all;

cle

close ;

x11,2,2,1,01;
ri;
k=0:1:4;
Jesart (1);
pi=22/7;

1
1
15
16
17
1
a
a
2
2
»
2
E

Heoxp(-Jeo4epsek/8);
Yet. ox;

DET Computation
yor:

//Display sequence y [nm]
aiepCrouna(y),"y[n]=");
//Plots

ale location =" origin
plot243(n,round(y),5);
Polyl=a.children(1).children (1);

poly1. thickness=2;

xtitle(’Plot of sequence yla]? {n] à

Scilab code Exa 3.9 Remaining Samples

//Example 3.9
//Program to remaining sai
SO)

X(5)

clear al
ae;

close i

sqrt (1);

zat;

X(O+z)=12,K(142)=-1)43,K (242) =3+) 44 .X(S42)=1-345,%

CORRE TESTER CESR TER TC)
a

tor a=9:1:14 do X(a)=conj(X(16=a)), end;

//Display the complete sequence X(K] in command
window

aiep Ch, "XIKI=")

6

Seilab code Exa 3.11 DFT Computati

//Example 3.11
//Program to Compute the $-point DFT of the
following sequences

J/xt{n]=[1 00,0011 41]
Y/x2{n}=[0 0.1 11 1,00)
clear all;

ae;

close i

xi*[1,0,0,0,0
22 (0,0,1,1,1

Motte Gt,

x2 «tte (m

//Display seques
window

sep (41, "X1[k]

drop C2," X2 1H]

=D;
es XI[Kk) and X2(K)

à
DE

Seilab code Exa 3.13 Circular Convolution

//Example 3.13

//Progeam to Compute circular convolution of
following sequences

Hr (n)=[1,~1,~2,3,—1]

Hraln]= [12,31

clear ally

KL;
x20(1,2,31;

1

u
2
1
15
16
1s
1
E
a
ES
»
25

{Loop for zero pad
the two

ni=Longth (x1);

R2=Lengen (#2);

nBen2-n1;

Af (n3>=0) then

x1=[x1,20r09(1,89));

else

x2=[x2,20r09(1,=09)1;

end

//DET Computatio

Ketten;

aa:

ler

DET Computation

yea D:

[Display sequence yln] in com

KERZE

ng the smaller sequence out

of

Scilab code Exa 3.14 Circular Convolution

//Bxample 3.14
//Program to Compute circular convolution of
following sequences

Liane (1 2,2 1]
Vs2tml= 10203011
clear all

cle

close ;
x1=(1,2,2,1)
x20(1,2,3,1];
//DET" Comps

X=

x2=ti 2,
ler

15
16

//DFT Computation
yd;

/fDisplay sequence yln]
COSAS

//Bxample 3.15
//Program to Compute x3{n] where X3[k]=X1 [ke]. X2(k]
JPxAln}= [1.2.3 4]

Helen 1,22]

clear all

dei

close :

x1911,2,3,4;

x2=(1,1,2,23;
//DET’ Computation
Xert):

FINDET Computation
RT

// Display sequence x3[n] in command window
aio (x3, "x3

Seilab code Exa 3.16 Circular Convolution

//Example 3.16

//Program to Compute circular convolution of
following sequences

I/st{n}=[1 12 1)

Lente [1 2.3.4]

clear all;

or

ae
close ;
xis(1,4,2,15
x2=[1,2,3,4);
DET" Computation
xr:
Raz:
x3en1.+12;
/ADET Com
x3eff¢(x3,1)
//Display sequence x3[n] in command window
hep (x3, "x3 [ul=")

Seilab code Exa 3.17 Circular Convolution

//Example 3.17
//Program to Compute y(n] where Y[k]=X1[K].X2(k]

J/x\{n]=[01,2 3,4]
//s2|n]=[0 11.0 (0,0)
clear all;

ele à

close ;

x1=10,1,2,3,4);

9 x2=[0,1,0,0,0);

¡DET Con
Kirsten:
e]

rs

TIDET Computation
yarouna(##e(¥, 4)

//Display sequence y{n] in cor
rta:

Seilab code Exa 3.18 Output Response

1 //Bxample 3.18
2 //Program to Compute output responce of following
sequences

WA
TION
5 7/(1) Lin

6 //(2) Cie

7 //(3)Cir

8 clear all;
var;

0

13 //(1) Linear Convolution Comp

11 ylinear=convol (x,8)

15 //Display Linear Convoluted Sequence y[n] in command
window

15 diep(yli

17 //(2)Cir

15 //Now zero padding in
of x[n] and hin] equal

19 ht=(h,zeros(1,1))

20 //Now Performing Circular Convolution by DFT method

m Ketten);

2 Heste(ni,-0;

23 Yok. oH;

21 yeircularesfe(¥,1);

2 //Display Cireular Convoluted Sequence y[n] in
command. window

26 disp (yeircular,” yeireular[n]=");

2 //(8) Cireular Convolution Computation with zero
Padding

2 x2=lx,zoros (1,2)

20 h2=(h)zeros(1,3)]

30 //Now Performing Circular Convolution by DFT method

K2efe(x2,-1);

mike length

60

2
ES
a

36

H2=£4e(n2,-1);
Y2=x2. «nz;
yearcularp:

222,03

//Display Cirenlar Convoluted Sequence with zero

Padding y[n] in command window
aiep (yetzeularp ," yeireularp [n

Seilab code Exa 3.20 Output Response

//Example 3.20

Program to Compute Linear Convolution of following

//x{n]=[3,—1,0,1,8,2,0,1,2,1]
OMR)

clear all;

ele à

close i
2=(8,-1,0,1,8,2,0,1,2,1];
CURE

// Linear’ Convolution Computation
yeconvol (hd;

//Display Sequence y[n] in con
ap lao;

Seilab code Exa 3.21 Linear Convolution

//Example 3.21
Program

Ixtnlel12,-1,2,8,-2,-3,-1,1,1
OA]

clear all;

ae;

mo

to Compute Linear Convoluti

=

13

close ;
x=[1,2,-1,2,8,
h=ta 2d;

// Linear Convolution Computation
yeconvol (x,);

//Display Sequence y[m] in com
arepa)

Si RN

Scilab code Exa 3.23.1 N Point DPT Computation

//Example 3.23 (a)

/MAXINA SCILAB TOOLBOX REQUI
LIN point DFT of delta (n)
cles
syne n kN;
Kesynoun(xeoxp(-Iieepienek/#) .2,0,0);
Spk X);

FOR THI

PROGRAM

Scilab code Exa 3.23.b N Point DFT Computation

//Example 3.23 (b)
//MAXIMA SCILAB TOOLBOX REQUI
LIN point DET of delta (n-no)
syne nk Nm
ae;
Koayneun (xeoxp(-Ltr2elpsenek/W) ‚n,-n0,-n0);
Spk "=;

FOR THIS PROGRAM

Seilab code Exa 3.28.¢ N Point DPT Computation

//Example 8.23 (e)

//MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
YIN point DFT of avn

cle

asus (x+oxp(-2is2ekpiense/i) ‚n,0,1-1)
Spk =);

Seilab code Exa 3.23.d N Point DFT Computation

//Example 3.23 (4)
//MAXINA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM

YIN point DFT of x(n)=1, O<=n<=N/2=1
le;

ayne nk Wy

xt
Keayasun(xuoxp(-Hir2efpisnsk/M) ,2,0, (1/2)-1)5

@iep 0K, 'X(K)

di

Seilab codo Exa 3.23. N Point DET Computation

//Example 3.23 (e)

MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
LIN point DET of x(n)=exp(%i+2+ Hpiekoen/N)

ele:

syns n kN ko;

xeoxp (i e2epiekorn/M) ;

Xeaynsum(xeoxp (-hie2e%piemek/M) ,2,0, (1/2)=1)
asp GX Xx);

Seilab code Exa 3.23.f N Point DET Computation

J [Example 3.23 (1)
//MAXINA SCILAB TOOLBOX REQUIR
FIN point DFT of x(n)=1, for n
ie;

syne nk m;
xet;//x(2n)=1,for all n
Keayasun(xsoxp(-Airdshpisnek/M) ‚n,0,0/2-1)
op, (0)

ED FOR T

IS PROGRAM
even and 0, for n=odd

Scilab code Exa 3.24 DFT of the Sequence

//Example 3.2

7/Program to Compute the DET of the Sequence
J=(-1)", for

clear all;

ae;

as:

wma;

most;

Ca:

//DET Computation

Ks ttt Gi
//Display Sequence X[k] in com
ahop Ch, "XIX

lab code Exa 3.25 8 Point Circular Convolution

1 //Bxample 3.25

Cireular

Program to Compute the 8 po

Convolution of the Sequences
J/st{n}=[1 1 A 1,0,0,0 0
J/x2[n|=sin (3+ pisn/8)

close ;
xi=(1,1,1,1,0,0,0,01;
n=0:1!7;

Par22/1;

x2e0in (Sepien/s

//DET Comput ati
Kiette (ll);

ENTREE

//Cireular Convolution using DFT
TRS

DET Computation

ys tft (1)

//Display sequence y{n]
CESADO

Scilab code Exa 3.26 Linear Convolution using DPT

//Example 3.26
//Program to Compute the Linear Convolution of the
following Sequences

//Convolution Computation,

E

ys convoi (x,h);
// Display sc
ESTSAO!

Scilab code Exa 3.27.0 Cire

1 Convolution Computation

J [Example 3.27 (a)

//Program to Compute the Convolution of the
following Sequences

DORE

1/20)

close ;
PUB]
22 (2,-1,2
[Convolution Computation
Kiste (x1,-1);
ENTREE
ere
yen nn
//Display Sequence y[n] in con
ap yla;

Seilab code Exa 3.27.b Circular Convolution Co

//Bxample 3.27 (0)
//Program to Compute the Convolution of the
follow

clear all;
ae;

close ;
xis (1,1,-1,71,00;
x2=[1,0,-1,0,1];
//Convolution Computation
Xert nd:

K2eftt (x2)
Yen. #42,
ys te Di
//Displa:
asp

Seilab code Exa 3.30 Calewlate value of N

//Example 3.30
//Program to Caleulate N from given data

//t=0.5s0c
clear all;

cle

close ;

fm=5000 //tlz

aseso //He

10.5 //see

Mi=2+tm/8%;

N=2;

while MeeML, MaNe2,0nd

//Displaying the value of N in command window
Asp OU Ne");

Seilab code Exa 3.32 Sketch Sequence

16

AL UL

Figure 3.3: Sketch Sequence

//Program to plot the result of the given sequence

Sk 1H (2,210.21)

Vs Inl=xlm/2] for 'nzeven 0 for msodd

clear all;

dei

as

1=[1,2,2,1,0,2,1,215

eet Dy

y"[x(1),0,x(2) ,0,2(9),0,X(4) ,0,X(5),0,x(6) ,0,x(7) 0,
x(8) ‚00;

ya, Di

// Display seques

asp Y

//Plotiing the se

keo:t:18:

ae gea O

a.y-location =" orig:

alx location

plot243(k,Y,2

© YIK] and in command window

nee YIKk]

(1) children (1);
poly!.thickness=2;
xtitieC Plot of RJ YO)

Ed

Seilab code Exa 3.36 Determine IDFT

//Example 3.36
//Program to Compute the IDFT of the follow

clear all;

cle

‘lo!

Jesqrt (1);

X=[12,-1.54J02.598,-1.5+)+0.866,0,-1.5-J+0.866,-1.5-
392.598);

//ADET Computation

ke tte 1,1)

//Display Sequence x[n] i

aiep (round (2) ,"x|

"
5
16

Chapter 4

THE FAST FOURIER
TRANSFORM

Seilab code Exa 4.3 Shortest Sequence N Computation

// Example

//Program to calculate shortest sequence N such that
algorithm B runs //faster than A

clear ally

ele à

close ;

[Given
ation of Twiddle factor exponents for each

see
Nez";

Aras

BaSeNs 108200);

1£ AB then break;

ond;

SEQUENCE N =");

E

Seilab code Exa 4.4 Twiddle Factor Exponents Calculation

1 //Example 4.4

2 //Program to caleulate Twiddle factor ex
each stage

clear ally

ele à

onents for

//Caleulation of Twiddle factor exponents for each
stage
8 for mets
D dsep(a, Stage: m=");
10 dispC'k =");
1 for t=0: (2 (m-1)-1)

2 keen /2
1 dispos
Mend

15 end

Seilab code Exa 4.6 I

sing Dr

Agorithm

1 //Example 4.6

2 //Program to find the DET of a Sequence x[n
1,2,3,4,4,3,2.1]

5 //using DIT Algorithm

1 clear all;

5 cle

6 close ;

Tx = (,2,8,4,4,8,2,1):

8 //FFT Computation

Kee Gy 0;
asep(t, Ka) =:

Scilab code Exa 4.8 DFT using DIF Algorithm

//Example 4.8

// Program to find the DFT of a Sequence x[n
J=[1,2,3,4,4,3,2,1]

{using DIF Algorithm

clear all;

cle

close ;

x = [1,2,3,4,4,3,2,1);

J/FET Computation

Lette Gy “1;

ETS OPEN

Scilab code Exa 4.9 § Point DPT of the Sequence

//Example 4.9
//Program to find the 8.

point DFT of a Sequence x[n

Algorithm

close ;
Pearce eerie te)
LEFT Computation
Kette, Di
aiepcK, Ka) = Di

Seilab code Exa 4.10 4 Po

1 //Bxample 4.10,

2 //Program to Compute the
0.1.2.3]

5 //using DIT-DIF Algori

1 clear all;

5 cle

5 close ;

Tx = (0,1,2,3);

8 //FET Comp

oka at,

10 disp(X, X)

Seilab code Exa 4.11 IDET of the Sequence using DIT Algorithm

1 //Example 4.11

2 //Program to Compute the IDFT of a Se
DIT Algorithm

3 IKK] = [7,-0.7
1707 ,j ,-0.207430.707]

clear ally

ae;

loi

Jreart (-1);

X = (7, -0.707-§+0.707,~j ,0.707-$+0.707 ,1,0.7074)

0.707, j,-0.707+520.707);

//Inverse FFT Compntation

kee 1)

aiep (x, x(n) =)

ee using

10.707 + 0


7
s

Seilab code Exa 4.12 $ Point DET of the Sequence

2

//Example 4.12
//Program to Compute the S-point DFT of a Sea
//x(n}=[0.5,0.5,0.5,0.5,0,0,0,0) using radix-:
‘Algorit

clear all;
cle

co:
x=[0,5,0.5,0.5,0-5,0,0,0,01;
//FFT Comp

Kette,
asap, Xx)

DIT

Scilab code Exa 4.13 $ Point DPT of the Sequence

//Example 4.13

//Program to Compute the 8-point DFT of a Sequence

//x(n}=[0.5.0.5,0.5,0.5,0,0,0,0) using radix-2 DIF
Algorit

clear all;

cle

co:

x=[0.5,0.5,0.5,0-5,0,0,0,01;
//FFT Computatio

Rete (x, Di

isp, Ka) = Di

Seilab code Exa 4.14 DFT using DIT Algorithm

//Example 4.14

//Program to Compute the d-point DFT of a Sequence
en

//vsing DIT Algorithm

clear all;

ae
close ;
2-1 1-1:

LIFE Computatio
Kette. Di
disp, X(2) =)

Seilab code Exa 4.15 DFT us

//Example 4.15
Program to Compute the
1.0.0.1]

//using DIF Algorithm
clear all;

ae

loi
x=11,0,0,175
LIFE Comp
Kette Gi
dispck, X(2) = )

HF Algoritha

¡point DFT of a Sequence x

Seilab code Exa 4.16.a 8 Point DET using DIT FFT

//Example 4.16 (a)
//Program to Evaluate and Compare
the given Sequence

TEN
1 clear all;
cle à
clei

xi=(1,1,1,1,0,1,1,105
LIFFT Computatio
Kis gee Ga, “ts

si

the S-point DFT of

need using DIT-FPT Algorithm

akep Cut, XI) = N)

Scilab code Exa 4.16. $ Point DPT using

//Bxample 4.16 (0)

//Program to Evaluate and Compare the S-point DFT of
the given Sequence

//x2|n]=1, Oc=nc=6 using DIT-FFT Algorithm

clear all;

cle

close ;

x2=(1,1,1,1,1,1,1,015

{/FET” Computatio

Kette G2, =D:

dep GR, KR) =")

Seilab code Exa 4.17 IDPT using DIP Algorit

//Example 4.17

//Program to find the IDPT of the Segui
Algori

//XIKI= 14
414)

clear all;

de:

close;

jregrt (0);

X= [4,1-J+2.414,0,1-J90.414,0,1+J+0.414,0,14J
22.414);

//Wmverse EFT Computation

rete, Di;

apta) = Ni

ce using DIF

52414 0,1 = j0 414 0,14 50.414 0 14 52

Seilab code Exa 4.18 IDET using DIT Algorithin

//Example 4.18

//Program to find the
(10,2452 ,-2,-2-j2]

//using DIT Algorithm

clear al;

ele à

close ;

jon;

X = [10,-29492,-2,-2-4425
/Inverse FFT Computation

ket (1, 1);

aispGe, sa) = Di

DET of e

Sequence X[k

Scilab code Exa 4.19 PET Computation of the Sequence

//Bxample 4.19

//Program to Compute the FFT of given Sequence x(n

[10 00,00 0,0).
clear all;

ce à

co:

x = [1,0,0,0,0,0,0,0);
LIFFT Computatio
Kea Gy +;
aiop(, X(2) = N:

Seilab code Exa 4.20 $ Point DPT by Radix 2 DIT FF

//Example 4.20

//Program to Compute the S-point DFT of given
Sequence

//x(u)=(2.2.2.2.1,1,11) using DIT, radix-2FFT
Algoritm

clear all

de ;

close ;

x = (2,2,2,2,1,1,1,10;

LIFE Computatio

Ke tte Ge Di;

disp, X(2) = Ds

Scilab code Exa 4.21 DFT using DIT PET Alkorithm

//Example 4.21
//Program to Compute the DFT of given Sequence
Yisiul=[1,-1,-1y-1 bt L=1] using DIT-FFT Algorithn

clear ally
ale à

close ;

x= teil,
LIFE Computatio
Kette. Di;
disp, X(2) = 0;

Seilab code Exa 4.22 Compute X using DIT FPT

/[Example 4
//Program to Compute the DFT of given Sequence
Lx using DIT-FFT Algorithm
clear all;

s

LIFET Comp
Ket Gy -
CES OERE

Seilab code Exa 4.23 DFT using DIF FFT Algorit

//Example 4.23
//Program to Compute the DFT of given Sequence
Y/x[n}=cos(epi /2), and N=4 using DIF-FFT Algorithm
clear all;

ele à

close ;

Nea;

pin22/7;

naO 1:81;

x =cos(nspi/2);
LIFET Computati
Keer Gy +;
CR OERN

Seilab code Exa 4.24 8 Point DET of the Sequence

//Example 4.24
//Program to Compute the S=point DFT of given

4.5.6.7] using DIP, radix-2,PFT

Aigorithi
clear all;

close

x = [0,1,2,3,4,5,6,7)

J/PET Computation

Kette,
aiep ct, X(2)

“D5
2

Chapter 5

INFINITE IMPULSE
RESPONSE FILTERS

Scilab code Exa 5.1 Order ofthe Filter Determination

51
t the order of the filter

10 Welog(oart ((10”(0.1ea8)-1)/(10" (0. 1%3p)-1)))/108(08/

op)
11 disptcei1(n), "Order of the filter

de Exa 5.2 Order of Low Pass Butterworth Filter

ample 3.2

2 //ToF

Filter
3 clear all;
1 cie

out the order of a Low Pass Butterworth

2840: //db
8 £p=S005 //Hz
9 £9*1000; //Hz
10 op=2ehpietp;
M1 os=2ehpiess;
12 Welog (ogre ((10" CO. t¥a8)=1)/(107 (0.1:
op):
13 aisp(coi (m, "Order of

p)-1))) /legvos/

filter, N=");

Scilab code Exa 5.4 Analog Butterworth Filter Design

1 //Example 5.4

2 //To Design an Analog Butterworth Filter

3 clear all;

1 cie

5 close ;

6 apuz;//al

7 as10; //db

8 0p=20; //rad/ sec

9 0830; //rad/ se

10 WeLog (ogre ((10" (0. 1¥a8)-1)/(107 (0.1:
op)

11 asep(coi2 OW), "Order of the filter, N=");

12 eue

13 HSe1/((27240. 765374001) +(9°2+1.84774941)) ;// Transfer
Function for

11 oc=op/(10" (0. teap)=1)" (4/(2#c01200)) 5

15 HStshorner (HS,8/0€);

16 asap(H81, Normalized Transfer Function, H(s) =")

p)-1))) /logos/

a

Seilab code Exa 5.5 Analog Butterworth Filter Design

J [Example 5.5

//To Design an Analog Butterworth Filter

clear all;

cle

close ;

ps0. 24hps;

08=0.4ehpa;

210.9;

140.2;

epeilon=egre (1/(e172)-1)

lambda=sqre (1/(11°2)-1);

Ne1og (lambda /epsiton) /10g (08/op) x

isp (coil (MN), "Order of the filter, N=")

see;

HS1/ ((2"2+0.76537+a+1)+(o"2+1.8477+e+1)) ;// Transfer
Function for

oc=op/eposlon” (1/c0s1 (Hd);

HStshorner (H8,s/0c);

sep (HS1, ‘Normalized Transfer Function, H(s) =")

Seilab code Exa 5.6 Order of Chebyshe Filter

//Example 5.6

//To Find out the order of the Filter using
Chebyshev Approximation

clear all;

cle à

clos

ape

semi: //ab
£p=1000;//Hz
18-2000: //Ma
opr2chpietp:
Sema pates

Neacosh(eqrt ((10°(0.1+a8)~1)/ (107 (0. 1+ap}-1)))/acoeh

(os/op) à
sapCeosi m, "Order of the filter, N=");

Seilab code Exa 5.7 Chebyshev Filter Design

//Bxample 5.7

//To Design an analog Chebyshey Filter with Given

Specifications
clear all;

ele à

‘lo!

082:
opel:

Jab
as=16;//db

ete1/aqre (2);

140.15

epsilon=sgrt (1/(612)-1);

Lanbda=sqrt (1/(11°2)-1);

Neacosh (1ambda/epeiton)/acosh(os/op) ;
aiep(coil (1), Order of the filter, N=");

Seilab code Exa 5.8 Order of Type 1 Low Pass Chebyshev

//Example 5.8

//To Find out the order of the poles of the Type 1

Lowpass Chebyshev Filter

%

clear all;

ele à

close ;

ape; //aB.

ased0;//AB

‘op=1000+%ps

08=2000%%p3;

N=acosh(sqrt ((10"(0. 1+a8)=1)/ (107 (0. teap)=1)))/acosh
(os/op);

aseptcesl (M); Order of the filter, N

di

Seilab code Exa 5.9 Chebyahev Filter Design

//Example 5.9

//To Design a Chebyshev Filter with Given
Specifications

clear all;

cle

close ;

ap=2.5;//db

26-30; //db

0p"20;//rad/ sec

0860: //rad/ sec

Neacosh(eqrt ((10"(0.1+a8)-19/(10-(0.1+ap)-1)))/acosk
(os/op);

aiep (coil), ‘Order of the filter, N=")

Scilab code Exa 5.10 HPF Filter Design with given Specifications

//Bxample 5.10
//To Design a HLP.F. with giv
clear all;

le:

specifications

oi

close ;

aps; //db

ase15; //db

9p*8005 //rad/ sec

081000: //rad/ sec

NeLog (sqrt ((10° (0. 18
op)

sep (eos), "Order of the filter, N=");

u

HS=1/C(8+1)e(8°2+8%1));//Trausfer Function for

06"1000/ /rad/ sec

HSt*horner (H8,0c/8);

aiep(HSt, ‘Normalized Transfer Fun

-1)/(10—(0.19ap)=1)))/108(08/

ion, H(s)

Seilab code Exa 5.11 Impulse Invariant Method Filter Design

//Example 5.11

//To Design the Filter using Impulse Invaricı
Method

clear all;

ele à

close ;

sete;

Tat

HS=(2)/(272+38+2);

eltseptss (HS);

iop(elta, "Factorized HS =");

//The poles comes out to be at -2 and |

pis-2;

past

aoe

HZ=(2/ (1-0 (p28T) +2" (-1)))-(2/ (1H

iopcnz, HZ ="):

A)

Scilab code Exa 5.12 Impulse Invariant Method Filter Design

//Example 5.12

//MAXINA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM

//To Design the Filter using Impulse Invarient
Method

clear all;

HSe1/(s"2esqrt (2991);
pprilaplace Hs) ;

syne n 2:

tet;

X= syaeun (ppe(2"(-n)),n ,0, Mint);
aiop(K, "Factorized US =");

Seilab code Exa 5.13 Impulse Invariant Method Filter Design

//Example 5.13

[MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM

)/To Design the 3rd Order Butterworth Filter using
Impulse Invarient Method

clear all;

cle

co:

este

HS#1/ (Cai) «(a"24841)) 5

pprilaplace(Hs) ;//Inverse Laplace

ayne n 2:

tt

X= ayneun (ppe(2"(-n)) un ‚0, Mint)

[2 Transform

%

sept, H(2)= 7):

Invariant Method Filter Design

//Example 5.15
//To Design the Filter using Impulse Invarient

Method
clear all;
cle

co:
seks;

120.2;

HS=10/(8"2+7°8+10)

eltenpfes (HS);

diep(elte, "Factorized HS =");

//The poles comes out to be at -5 and
Pins;

p2=-2;

zeke;

BZ=Te(t-3.33/ (1-40 (pleT) #2" (1) ))+(3.39/ (1-e" (p2eT

SN)
asspQiz, "HZ =):

Seilab code Exa 5.16 Bilinear Transformation Method Filter Design

//Example 9.16

Vite Find out Bilinear Transformation of HS=2/((s+1)

+(8+2))
clear ally
cle à

co:

shi

les

$ Hse2/(Ce4t)#(992));
9 Tat;

10 H2=hornor (HS, (2/7)*(2-1)/(241)) 5
1 asep (2, le) =");

Seilab code Exa 5.17 HPF Design using Bilinear Transform

//Example 9.17

2 //To Design an H.P.F, monotonic in passband using
Bilinear Transform

3 clear all

1 ce ;

5 close ;
6 ape3; //db
7 asei0; //db
$ £p=1000; //Ha
D £e=3505//1lz
10 £*5000;
u Test;
12 wp=2ehpseep:
13 var2eipiets:
11 0p=2/Tetan (upeT/2);
15 092/Tetan(we*T/2);
16 Nelog(agrt ((10° (0. 1¥a8)-1)/(10" (0. 1¥ap)-1))) /1oglop/
08):
17 asep(coit CH), "Order of the filter, N=");
%
19 HS=1/(8+1)//Transfer Function for N
2 oe=op//rad/ avc
21 HSt=horner (HS, 0¢/8)
2 diap(HSi, ‘Normalized Transfer Function, M(s)
2 2=h2;
21 WZ=horner (HS, (2/1) +(2-1)/(2+19)5
25 diap(HZ, H(z) =");

Seilab code Exa 5.18 Bilinear Transformation Method Fier Design

//Example 5.1
out Bilinear Transformation of H(s)
) /(s"240.692+s-+0.504)

clear all;
cle

close ;
ake

zehe
HS=(#"2+4 .625)/(e-240..692+8+0..508);
Te
Hz=horner (HS, (2/T)*(2-1)/(2#1))
aisp nz, M2) ="):

Scilab code Exa 5.19 $

ingle Pole LPF into BPF Conversion

//Bxample 5.19
//T Convert a single Pole LPF into BPP
clear all;

ele à

alas
HZ=(0.8* (1+2"(-1)))/(1-0.30202"(-2))5
Tat;

susSepi/4;

wastps/as

upsps/6;

kevan(up/2)/tan((wu-v1)/2) ;

a=cos ((wut¥l) /2)/coe ((wu-¥1) /2) 5

%

15 tranete-((((R=1)/ (eet) 4 (2° (-2))) =((2rark/ (eed) #2
(2199) #1) / 2" ea (14) «2 EDIL
+):

16 W2tehorner (H2,transf) ;

17 aiop@nzı, H(z) of B.P.F

Seilab code Exa 5.29 Polo Zero IR Filter into Lattice Ladder Structure

//Exumple 5.29

2 //Program to convert given IIR pole=zero Filter into
Lattice Ladder Structure.

3 clear all;

1 cle

5 close ;

5 ve; J [tor Adjust

7 a(3ev,oeuet

$ 2(3+U,1+1)=13/245
D a(3+U,2+4)=8/8;
10 2(39U,3+U)=1/3;
11 a(2eu,oeu)=1; //a(m,0)=1
12 2(29U,3+0)=1/95
3 ke;
1 a(an1+U, K+) =(a(aeU, RoW) ~a (m+, 240) ea (m+U,m=k+0))
‘ae aU) va (a+U,m+0)) à

16 a Ca 140, AU) (a (m0, keV) ~a (me, 240) ea (m+U,m=k+0))
7 (ina (atl a+) oa (a+, me)

22, ke;

18 a(Bm1+U, ke) = (aCe, RU) ~a (m+, 2+) ea (m9U,m=k+0))
7 (ina (wel +) oa (me, 98)

opt LATTICE COEFFICIENTS")

aiop(a(t+U, 140) °K);

sep (aC2+U, 240) K2 1)

aiep(a(3+U, 340) DR

bo=1;

as
2
EN
EN
E
s
En
5

€22b2-636a (340, 140)
elebl~(e2ea(2+u, 140) +e 348 (340,240)
cO=bO-(clra(1+U,1+U)+c2r2(29U, 240) +632 (340, 340) );
4sepC LADDER COEFFICIENTS);

2

aiep(eo,
displet,
dsspte2,
areptes,

0
el

=

oi

Chapter 6

FINITE IMPULSE
RESPONSE FILTERS

Scilab code Exa 6.1 Group Delay and Phase Delay

1 //Example 6.1

2 //MAXIMA SCILAB TOOLBOX REQUIRED FOR THIS PROGRAM
3 //Program to Caleulate Group Delay and Phase Delay
IO) 3x (11-2)

5 clear all;

A N
1

u 88,025 //Group Delay
"2 / [Phase Delay

13 dsop(ga, GROUP DELAY =");
11 asep(pd, ‘PHASE DELAY =")

102

Figure 6.1: LPF Magnitude Response

103

Seilab code Exa 6.5 LPF Magnitude Respon

1 //Example 6.5

2 //Program to Plot Magnitude Responce of ideal L.P.F
with we=0.5e pi

3 /JN=11

1 clear all;

5 cle

6 cos

T Nett;

sun;

for ne-6+U:1:540

Af n226

ha(n)=0.85

else

han) Coin (pie (n-U)/2))/ Gps e (m0)

end

end

Chen ‚tr Ju frnag (hd ,256) ;

hema = 20% logio (ham)./ max (han);

8 figure

plot (2efr , has

an ge Où

alabel ('Frequeney w+pi);

ylabel (Magnitude in dB’);

title (Frequency Response of FIR LPF with N

xerid (2);

BD:

Seilab code Exa 6.6 HPF Magnitude Response
1 //Example 6.6

2 //Program to Plot Magnitude Responce of ideal H.P.P.
with we=0.25¢ pi

104

Figure 62: HPF Magnitude Response

105

sen

clear all;

de à

cos

Nett;

uns;

for ne-6+U:1:5+0

sf ne=6

ha(n)=0.8;

else

ha (n)=(oin (pie (n-U))=8in (pax (n-U) /4))/ (pi (0-00) à
4

end
(nem ‚tr Je frnag (hd ,256) ;

han4B = 20e logio (hen)./ sax Chem);
figure

plot (2efr , ham
as gca Où

xLabel C' Frequency wep)
ylabel (Magnitude in dB");

title (Frequency Response of FIR HPP with N
xerid (2);

8)

Scilab code Exa 6.7 BPF Magnitude Response

//Example 6.7

//Program to Plot Magnitude Responce of ideal B.P.F
‘with

wet=0.25epi and we

YJN=1L

clear all;

de à

clo!

Figure 6.3: BPF Magnitude Response

107

sat;

9 Us6;

10 for ne-5+0: 12540

if neo.

12 ha(n)=0.5;

13 else

11 hd(n)=(oin Ckpärde (a-U) /4) “ein (pie (n-U)/4))/ Cp (n=
wd:

15 end

16 end

17 Chem ‚tr Je frnag (hd ,256) ;

15 hem_dB = 20+ logio (hen)./ sax (hem);

19 figure

20 plot (2efr , has

21 a0 ges Où

2 xLabel (Frequency wept")

25 ylabel (Magnitude in dB")

24 title (Frequency Response of FIR BPF with À

2 xgrid (Di

8)

Seilab code Exa 6.8 BRF Magnitude Response

1 //Example 6.8

2 //Program to Plot Magnitude Responce of ideal B.R.P
with

5 /Jwel=0.83epi and we2=0.67e pi

1 /JN=11

5 clear all;

6 cle à

7 clos

Swen;

9 U=6;

10 for ne-5+Us 12540

108

Figure 6: BRP Magnitude Response

109

2
18
1

11 nese

ha(n)=0.5;

else

han) =Coin (pie (a-W)) ¢0in (Apio (a-U)/3)=040 (pie 2e (n=
ID) (hpi UY);

4

end
(hem ‚tr Je frmag (hd 256) ;

hzn_dB = 20e logio (hen)./ sax (han );
figure

plot (2efr , has
a= ge OF
xlabel ('Frequency w+pi')
ylabel (Magnitude in dB");

title (Frequency Response of FIR BRF with N
xerid (Di;

8)

11)

Seilab code Exa 6.9.a HPF

¿std Response using Hanning Window

//Example 6.90
Jj Program to Plot Magnitude Responce of ideal H.P.F.
//using Hanning Window

//wel=0.25+ pi

n=

clear all;

ae

co:
Nett;

uns;
h_hann=uindou (°
for ne-6+U:1:5+0
st nese
ha(n)=0.78;

no

Figure 6.5: HPF Magnitude Response using Hanning Window

m

15 else

16 hd(n)=(oin (Xpax(n-U))~2in (pi (n-U)/4))/ (pie (a-U)) ;

17 ond

15 h(a) *h_nann (a) sha (a);

19 ona

20 (ham ‚ir Je frag (h 256)

21 hzm_dß = 20% logio (h2m)./ sax (hzm);

2 figure

25 plot (2efr , has

2 as gea Où

25 label (Frequency wep);

26 ylabel (Magnitude in dB");

2 title (Frequency Response of FIR MRF with N:
using Hanning Window);

2 xgrid (2);

8)

Scilab code Exa 6.9.b HPF Magni
dow

‚de Response using Ham

//Example 6.90
//Progeam to Plot Magnitude Responce of ideal HLP.F
// using, Hamming Window

J] wet=0.25s pi

nen

clear all;

ae

elo
Nett:

Us;

B_hammeuindou hm’)
for ne-5+U:1:5+0

Af n==6

hd(n) 0.78;

Figure 6.6: HPF Magnitude Response using Hamming Window

us

15 else

16 hd(n)=(oin (Xpax(n-U))~2in (pi (n-U)/4))/ (pie (a-U)) ;

17 ond

15 h(a) *b nase (n) ehd (a);

19 ona

20 (ham ‚ir Je frag (h 256)

21 hzm_dß = 20% logio (h2m)./ sax (hzm);

2 figure

25 plot (2efr , has

2 as gea Où

25 label (Frequency wep);

26 ylabel (Magnitude in dB");

2 title (Frequency Response of FIR HRF with N:
using Hamming Window");

28 grid (2);

8)

Seilab code Exa 6.10 Hanning Window Filter Design

//Example 6.10

2 //Program to Plot Magnitude Responce of given L.P.F
with specifications

JIN=T.=pi /4

//Using Hanning N

clear all;

ele à

close ;

wer;

alpha-:

ven;

h_hann=vindos('h

for ne0+U:1:6+0

Af nena

ha(n)=0.28;

na

Figure 6.7: Hanning Window Filter Design

us

15 else
16 hd(n)=(oin (Kpix (n-U-alpha)/4))/Chpir(n-U-alpha));
17 ond

15 hin)ehä(ndeh.hann(a);

19 ona

20 (ham ‚ir Je frag (h 256)

21 hzm_dß = 20% logio (h2m)./ sax (hzm);

2 figure

25 plot (2efr , has
2 as gea Où

25 label (Frequency wep);
26 ylabel (Magnitude in dB");

2 title (Frequency Response of given LPF with Naz");
28 xgrid (Di

8)

Seilab code Exa 6.11 LP

ter Design using Kaiser Window

1 //Bxample 6.11
2 //Program to Plot Magnitude Responce of given L.P.F
with specifications
20rad/sce, ws=30rad/sco, ws!

¡O0rad / see

5 //Using Kaiser Window
6 clear all;
Tee;
$ close ;

9 uaf=100//rad/ sec

10 #820; //rad/ sec

11 up=205 //rad/ sec

12 as=44.0//4B

13 ap=0.1//4B

11 Bovey

15 we=0.5e(verup)

16

Figure 68: LPF Filter Design using Kaiser Window

ur

16 weisuer2chpi/uet;
deltai=10"(-0.08+a8) ;

deitaz=(10" (0.05+a8)~1)/(10"(0.08+a8)+1);

doltansin(deltat,delta2);

‘alphas=-20+10g10(delta)

‘alpha =0.5842+ (alphas-21) *0.4+0.07886+(alphas-21)

D=(alphas -7.95)/14.36;

Niewet*D/B+1;

Mecea GH

Usceal (1/2);

win lewsndow (kr M, alpha);

for nefloor (H/2)+U: 1: floor (W/2)4U

Af me=ceiL(M/2);

ha(n)=0.8;

else

han) Coin (pie (n-U)/2))/ Gps e (m0)

end

h(n) =ha(m) sun 1 (mn) à

en

(ham ‚ir Je trag (h 256)

hzm_dB = 20e logio (h2m)./ mar (hzn );

figure
plot (2efr , handB )
as gca Où
alabel ('Frequeney api)
ylabel (Magnitude in dB");
title (Frequency Response of given LPF using Kaiser
Window‘)
m xgrid (2);
11 diep(h,” Filter Coefficients ¿h(n)=");

us

Figure 6.9: BPF Filter Design using Kaiser Window

no

//Example 6.12
//Program to Plot Magnitude Responce of given B.P.F
h specifications
pi rad/sec, wp2=60pi rad/sec
rad/sce , ws2=80pi rad/see

5 548

6

7 //Using Kaiser Window

$ clear all;

9 cle à

10 close ;
w81-200+%p4;//rad/ sec
wei=20«%p1;//rad/ sec

ve200001p4,/ rad cc

pa =40=xpA //rad/ see

15 wp2=60*4pi;//rad/sec
se db

Sos ln

Brain (api sv82-vp2);

neue

sezeyp29/2;

veisveiezeps/eets:

rea

Sicario: (20,0840);

dalra2.(40 (0. 08ra2) 1) / (40 (0.088) #1);

deta rada Castas dette) à

Sipbase=20¢L0g10(delta)

Spa to. 942% (alphas-21)0.4°0.07880+(alphas-21)

D=talphan-7.95) /14. 96,

Hors

ERA

RAN

tin Lavandou", abpha) ;

Tor avctloce aD EU 1:4 00r(4/2)+0

A

3 no

% else

37 Rata) *(ein (0. 76Xp4e(n-U))=28n (0. Sep m-U)))/ Aptel

m

Figure 6.10: Digital Diferetiator using Rectangular Window

mw;
ond
n(n)*na(n) ruin 16m);
ond
Chen ‚tr Je frnag (h ,256)
hzm_db = 20e 10g10 (hzm)./
figure
y: (ete , hen a8 )
ges Où
xlabel ('Frequeney w+pi);
ylabol (Magnitude in dB");
title (Frequency Response of given LPF using Kaiser
Window")
xgrid (2):

m

Seilab code Exa 6.13. Digital Diferentintor using Rectangular Window

1 //Example 6,130
2 //Program to Plot Magnitude Responce of ideal
differentiator with specifications

J/N=8w=pi

Viwsing Rectangular window

clear all;

ae;

‘lo!

Nes;

alpha=7/2;

on

hRectevindow( re "ND;

for ne0+U: 1: 740

Rd(m)= (sin (pix (n-U-alpha))) /(ipis (n-U-alpha)* (n-U-
alpha);

1 h(a)*ha(n) eh Rect (n);

15 ond

Chan ‚tr Je frmag (h ,256)

hzm.dB = 20e logio (h2m)./ max (hem);

figure
plot (2efr , handB )

a= gca Où

label ('Frequeney wepi')

ylabel (Magnitude in dB");
title ('Frequency Response of given ideal

differentiator using Rectangular Window, N=8");
21 agria (2)

Figure 6.11: Digital Diffeentiator using Hamming Window

13

Seilab code Exa 6.13.b Digital Diffrentator sing Ha

ing Window

1 //Example 6.130
2 //Program to Plot Magnitude Responce of ideal
differentiator with specifications

3 //N=85

1 //using Mi
5 clear all;
6 cle à

co:

1/2;

[[hero Adju
11 h.hammevindos Chm’ m);
12 for neOeU:1:740

13. haln)=-(sinCkpi(n-V-alpha)))/Ckpir (n-U-alpha) + (n-U-

‘alpha));

1 hCn)ehd(n)eh.hann(n);

15 ond

16 (hem „tr Je frnag (A ,256)

17 hzm.dB = 20% logio (hzm)./ max (hem);

18 figure

19 plot (2etr , hen_d8)

20 as ge Où

21 x1abel (Frequency wepi)

22 ylabel (Magnitude in dB");

25 title (Frequency Response of given ideal
differentiator using Hamming Window, N

21 xgrid (2)

Seilab code Exa 6.14. Hilbert Transformer using Rect

1 //Example 6.140

En

Figure 6.12: Hilbert Transformer using Rectangular Window

//Program to Plot Magnitude Responce of ideal
Hilbert Transformer
Jfusing Rectangular Window

At nes6
a(n) =0;

else

han) = (1 cos (Apis (n-U)))/ (pas CU)
end

hCn)=ha(n) *h Rect (n)

end
[nem ‚tele frnag (6,256) ;

125

3 vesses

Figure 6.13: Hilbert Transformer using Blsckman Window

figure

plot (2efr ham);

a = ga Où

label (Frequency wepi’);

yhabel CH(exp (ja) 5

title (Frequency Response of Hilbert Transformer
with Nel using Rectangular Window’);

xerid (Di;

Scilab codo Exa 6.14.b Hilbert Transformer using Blackman Window

// Example 6.14b

Program to Plot Magnitude Responce of ideal
Hilbert Transformer

126

3 //using Blackman W

4 nal

5 clear all;

6

7 4

9 U=6;

10 for ne-5+U: 12540

11 h_balckmann(m) = 0.42+0.6rc08 (2+%pi+(n-U)/(N-1))
+0.08%c02 (4+pis(a=0)/ (1-1);

12 it nee

13 hd(n)*0;

M else

15 hd(n)=(1-coe (pie (n-U)))/ (apse (n-U)) 5

16 ona

17 hin)ehä(n)eh.balcknann(n);

18 end

10 (hm ,fr]= trag (8,256) ;

20 figure

21 plot (ete hem)

m a= ga Où

25 xLabel (Frequency pi);

24 ylabel CH(exp (jae) ) 3

2% title (Frequency Response of Hilbert Transformer
with N=11 using Blackman Window")

26 xgrid (Di

Seilab code Exa 6.15

ter Coeficiente obtained by Sampling

//Example 6.15
2 //Program to determine filter coefficients obtained

clear all
5 cc;

co:

wer;

vet; /[hero Adjust

for n=09U:1:N-19U

(nde (1+2ecoe (2e Apis (n-U=3)/7))/8
4

dish

Filter Coefficients h(n)

Scilab code Exa 6.16 Cocfcients of Linear phase FIR Filter

//Bxample 6.16

Program to determi
by sampling

SS

clear all;

de:

as

weis;

ve; [ero Adjust

for ne0:1:0-1

R(RaU)= (1222008 (Zukpie (Ten) AND 428000 (44p E+ (7-00 /10
+29cos (Grhpie(7=n)/8))/;

à

CET

filter coefficients obtained

Filter Coefficients ‚h(n

Scilab code Exa 6.17 BPF Filter Design using Sampling Method

//Example 6.17
{Program to design bandpass filter with following
specifications

J/N=7, fe 1=1000Hz, fe2=30001l2, P=S000Hz
clear all;
ee à

ES

Figure 6.14: Frequency Sampling Method FIR LPF Filter

close
ver;

wu; [ero Ad
for avoscwel
RGmeU) 2e (cos (2ehp (Ben) /1D cos Cops sm) 10):
e]

disp(h,” Filter Coefficients ,h(n)=");

Scilab code Exa 6.18.0 Frequency Sampling Method PIR LPP Filter
//Example 6.180

129

//Program to design L.P.F. filter with following
specifications

/[N=15, we=pi/4

clear all;

ce à

co:

weis;

Uat;

A)

Alma (1+ cos (2+%pie (1-0) /10) /M

end

(hem ‚ir Je frag ( 256) ;

hzu_dB = 20e logio (h2m)./ sax (hzn );

figure;

plot (2efr , handB di

an gea Où

xlabel ('Frequeney wepi')

ylabel (Magnitude in dB");

title (Frequency Response of FIR LPF with N

xgrid (2)

Scila code Exa 6.18.b Frequency Sampling Method FIR LPF Filter

//Example 6.18b

// Program to design L.P.F. filter with following
specifications

J[N=15, we=pi/4

clear all;

ale à

co.

weis;

Uat;

for n=0sU:1:N198

10

Figure 6.15: Frequency Sampling Method FIR LPF Filter
Binde (tee (2ehpie Ten) /M) +c08 (Ae IPs (7a) DIM:

Chen ‚tr Ju frnag Ch ,286) ;
hzm_aB = 20e logio (h2m)./
fsgur

plot (fr , hem.ap );
as gca Où

xLabel ('Frequeney wepi');

ylabel (Magnitude in dB");

title (Frequency Response of FIR LPF with N=11)
xerid (2)

Scilab code Exa 6.19 Filter Coefficients Determination

ist

Figure 6.16: Filter Cooficions Determination

//Example 6.19
2 //Program to Plot Magnitude Responce of given L.P.F
with specifications

3 /[N=18,w=pi/6

1 clear all;

5 ele

6 clos

7 alpha=6;

su

D for neo+U: 14240
sf meer

ha(n)=0.167;

else

ha(n)=Csin (Kir (n-U-apha) /6))/ (hpi (n-U-aipha)) ;
4

en
(ham ‚tr Je frnag (nd 256) ;
hzm.4B = 20e logio (h2m)./ max (ham);
figure

plot (2efr , hans
a= gca Où

label ('Frequeney wept")
ylabel (Magnitude in dB";
title ('Frequency Response of given LPF with N
xgrid (2)

aiep(hd,” Filter Coefficients ,h(

8)

Scilab code Exa 6.20 Filter Cocficients using Hamming Window

1 //Bxample 6.20

2 //Program to Plot Magnitude Responce of given L.P.F
with specifications

3 /IN=13,9=pi/6

1

Figure 6.17: Filter Coeficiente using Hamming Window

// Using Ham
clear all
de à
close ;
Ne13;
alphas
on
h_hamm=vindos Clin? M);

Lor meOeU: 114260

Af aes?

ha(n)=0..1675

else

Ra(m)= (ain (pis (n-U-a1pha)/6))/ CHpi+ (n-U-alpha)) ;
end

h(a) ehd(n) hha
en

(ham ‚tr Je trag ( ,256)

hzm_dB = 20e logio (h2m)./ max (ham);
figure

plot (2efr , hans
a= gca Où

label ('Frequeney wept")
ylabel (Magnitude in dB";
title ('Frequency Response of given LPF with N
xgrid (2)

Aiep(h,” Filter Coefficie
sep Ch," Filter Coefficio

ing Window

(a);

8)

ts h(n
ts hl

>:
>

Seilab code Exa 6.21 LPF Fier using Rectangular Window

//Example 6.2
//Program to Plot Magnitude Responce of given L.P.F
with specifications

Figure 6.18: LPF Filter using Rectangular Window

0008, F-50002:

Usa

14 hd(n)=Coin(2eKpss (m-U)/8)/ Cp (a-U)):
15 end

16 h(n) wha (aden Rect (n) à

17 ond

18 (hem ‚tr J= frnag (h ,256)
19 hzmzdb = 20° logio (ham) ./
m figure

21 plot (2efr , hen_d8 )

as gea Où
xlabel ('Frequeney wepi')
ylabel (Magnitude in dB");

tâtle (Frequency Response of FIR LPF with N=7%);
xgrid (2:

aiep(h," Filter Coefficients ‚hn)=");

Seilab code Exa 6.28 Filter Coeficients for Direct Form Structure

1 //Bxample 6.28
2 //Program to calculate FIR Filter coefficients for
the direct form struct

3 //ki=1/2
1 clear all;
5 cle ;

6 clos

7 U;

8 kim1/25

D K291/3;

10 x3e1/;
11 aC3+0,0+0)=1;,
12 aCa+U 240) =R15
13 a (240, 2+0)2k2;
1 a(3eU,3+0)=43;
2 ke;
15 aCe, eo) "a6
Ser;
IS alm#U,K-V)=a(m-1HU,ktU)taCmtU,a+W)eala-1U,n-ktW);
10 m3, k92;
m ane, ke) a
m iap(a(3+U,0+0)
2 disp(a(3+U,1+0)
2 dsep(a (3+, 240) ,°a(3.2) 05
24 diap(a(S+U, 340), a (823) 05

AA ReU) +a (me ae) va (arte

140, IU) +a (ne m+) va Ca 140 m0) ;

Scilab code Exa 6.29 Lattice Filter Coefiients Determination

1 //Example 6.29

2 //Program to caleulate given FIR Filter 's Lattice
form coefficients

3 clear all;

1 cle

5 close ;

6 ust J[kero Adjust

7 a(340,040)215

S 93+, 140)=2/5;

D a(3+U,240)=3/4;

10 2(3:0,3+0)=1/3;

1m aC20,0+U)e1; //a(m.0)=1

12 aC2+0,3+0)=1/3;,

CESR

1 Cm LAU, AU) (a (ae, XV) (m+, 240) 2a (m9U,m-k+0))
71-228, +0) eam

15 m3 ke

16 a Cm 140,40) (a (meU, k+U)-a (meu
/(4-a(aeU m0) va (neun);

17 m2 ke;

18 a(@-L+U, AU) (2 (290, KU) a (mel atl) oa (med
/(i-a(a+U, +0) sa (a+, 940);

19 dsepCaCr+U, 140)";

20 dsep(a (240,240), K2 1);

ERNST ENTER

ss

Chapter 7

FINITE WORD LENGTH
EFFECTS IN DIGITAL
FILTERS

Scilab code Exa 7.2 Subtraction Computation

10 diep(e,"=",b,'~",a, PART 1°);
1 //(a) 0.5 from 0:25

12 amoo;

18 diapla, '=",a,-",b, PART 2°)

10

Scilab code Exa 7.14 Variance of Outp

//Example 7.14

ue to AD Conversion Process

//To Compare the Varience of Output due to A/D

Conversion process
IC) =0.89 (n-1)+x(n)
clear all;

ae

close;
a8; //Bits
z=100; //Ra

Qu2er/(2%m); //Quantization Step Size

Ve=(9°2/12
Vo=Ves(1/(1-0.8"2)) à
sap (Q, QUANTIZATIO
asepcr

aiep (Wo, "VARIANCE

OF ouIPUT

STEP SIZE =
VARIANCE OF ERROR SIGNAL

>

10

Chapter 8

MULTIRATE SIGNAL
PROCESSING

Scilab code Exa 8.9 Two Component Decomposition

1 //Example 8.9

2 //MAXIMA SCILAB TOOLBOX RE

5 //Develop a two component d
transfer function

RED FOR THIS PROGRAM

-omposition for the

4 //and determine PO(z) and PL(2)
5 clear all;

6 cle

7 close;

11 h2n-a*(2en)

B ssum(h2ne2"(-n),m,0,%inf) ;
1 (ant);
11 PissynsunCh2niez“ (-n) ‚n,0,4inf);

15 diap(ro, "PO(Z) =");
16 disp@r1, PI(Z) = 9;

mi

Seilab code Exa 8.10 Two Band Polyphase Decomposition

//Example 8.10

//Develop a two band polyphase decomposition for
transfer function

/¥(1)=2°24242/2°240.8240.6

clear all;

ce à

clos

aha

Wzs (2"20202)/(2"200.84260.6);

Hza=hornor (H2,~2);

PO=0.5* (HZ+HZ2) ;

P120:8+ HZ-HZa) ;

asap(P1/2, "+" ‚PO, (2)

the

Chapter 9

STATISTICAL DIGITAL
SIGNAL PROCESSING

Seilab codo Exa 9.7.a Frequency Resolution Determination

1 //Example 9.7 (a)

2 //Program To Determine Frequency Resolution of
Bartlett,

//Welch(50% Overlap) and Blackman=

3 y Methods
1 clear all;

s /Quality Factor
3 N=1000; //Samples
10. //FREQUENOY RESOLUTION CALCULATION

12 rb=0.89*(2ekpisK/M);
13 yet. 280(2e%pi94Q) /(166N) ;
11 rbt=0.64+(2ehpie26Q)/ (Sel
15 //Display the result in o à window
16 &ap(rd," Resolution of Bartlett Method”);

17 dsoptxw;" Resolution of Weleh(50% overlap) Method”);
18 diap(rdt,” Resolution of Blackmann—Tukey Method”)

18

a
18
15

16

Seilab code Exa 9.7.b Record Length Determination

Example 9.7 (0)

// Program To Determine Record Length
//Weleh(50% Overlap) and Blackman
clear all;

ele;

close;
//Data
a=10; //Q

of Bartlett ,
ukey Methods

Factor

RECORD LENGTH CALCULATION

1-4/0;

1e=16+1/(9+0) ;

101 =3+1/ (269);

//Display the result in command window

ásop(1b," Record Length of Bartlett Method");

assp(1v;" Record Length of Welch(50% overlap) Met
3;

asep(1bt,"Record Length of Blackmann—Tukey Method”)

Scilab code Exa 9.8.1 Small Record Length Computation

J [Example 9.8 (a)

//Program To Determine Smallest Record Length of
Bartlett Method

clear all;

cle

close;

//Data

1r=0.01; //Prequeney Resolution

14

1
mn

W=2400; //Samples
RECORD LENGTH CALCULATION

1b=0.89/£r;

//Display the result in command window

sep Cb, "Record Length of Bartlett Method”);

Seilab code Exa 9.8.b Quality Factor Computation

//Bxample 9.8 (0)

//Program To Dete
Method

clear all;

cle

close;

//Data

1r=0.01; //Frequeney Resolution

N=24005 //Samples

1020.89/

QUALITY FACTOR CALC

aen/ib;

//Display the result in command window

ásepCa,” Quality Factor of Bartlett Method”);

ne Quality Factor of Bartlett

LATION

Chapter 11

DIGITAL SIGNAL
PROCESSORS

Seilab code Exa 11.3 Program for Integer Multiplication

gram 11.3

J/Program To Calenlate the value of the function

Ie

clear all;

ac;

close;

//Input Data

Aesnpur (Enter Integer Number A=
put ("Enter Integer Number B =

// Multiplication Computation
vues;
//Display the result in command window

@isp(¥,"Y = AB= N);

Seilab code Exa 11.5 Function Value Calculation

16

J/Program 11.5
// Program To Calenlate the value of the function
AeXL+B6X2HCOXS.

/
clear all;
5 cle;
6 close;
7 //Data
8 Ant;
9 8-2;
10 03;

14 //Compute the fu
16 YoheKi+Bex2400K3;

16 //Display the result in cos
17 abep(r,"¥
Tags