Anda di halaman 1dari 59

Digital Signal Processing Lab Manual -- 06ECL57

V semester

DEPARTMENT OF TELECOMMUNICATION ENGINEERING


DR.AMBEDKAR INSTITUTE OF TECHNOLOGY
BANGALORE 560056

DIGITAL SIGNAL PROCESSING


LAB MANUAL
06ECL57
V Semester

Lab In charge:
PRAVEEN K B
Lecturer, DEPT Of TCE

NAME OF THE STUDENT

USN NUMBER

BATCH

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Syllabus
Part A
LIST OF EXPERIMENTS USING MATLAB
1.

Verification of Sampling theorem.

2.

Impulse response of a given system

3.

Linear convolution of two given sequences.

4.

Circular convolution of two given sequences

5.

Autocorrelation of a given sequence and verification of its properties.

6.

Cross correlation of given sequences and verification of its properties.

7.

Solving a given difference equation.

8.

Computation of N point DFT of a given sequence and to plot magnitude and


phase spectrum.

9.

Linear convolution of two sequences using DFT and IDFT.

10.

Circular convolution of two given sequences using DFT and IDFT

11.

Design and implementation of FIR filter to meet given specifications.

12.

Design and implementation of IIR filter to meet given specifications.

Part B
B. LIST OF EXPERIMENTS USING DSP PROCESSOR
1.

Linear convolution of two given sequences.

2.

Circular convolution of two given sequences.

3.

Computation of N- Point DFT of a given sequence

4.

Realization of an FIR filter (any type) to meet given specifications .The


input can be a signal from function generator / speech signal.

5.

Audio applications such as to plot time and frequency (Spectrum) display of


Microphone output plus a cosine using DSP. Read a wav file and match with
their respective spectrograms

6.

Noise: Add noise above 3kHz and then remove; Interference suppression
using 400 Hz tone.

7.

Impulse response of first order and second order system

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Table of Contents

SL.
No.

List of Experiments :

Page
No.

Staff
signature

Part A(Cycle-1)
1
2
3
4
5
6
7
8
9
10
11
12

Verification of Sampling theorem.


Impulse response of a given system
Linear convolution of two given sequences.
Circular convolution of two given sequences
Autocorrelation of a given sequence and verification of its properties.
Cross correlation of given sequences and verification of its properties.
Solving a given difference equation.
Computation of N point DFT of a given sequence and to plot magnitude
and phase spectrum.
Linear convolution of two sequences using DFT and IDFT.
Circular convolution of two given sequences using DFT and IDFT
Design and implementation of FIR filter to meet given specifications
Design and implementation of IIR filter to meet given specifications.

09
12
14
17
19
21
24
27
32
32
35
39

Part B(Cycle-2)
CCS Introduction
1
2
3
4
5

Linear convolution of two given sequences.


Circular convolution of two given sequences.
Computation of N- Point DFT of a given sequence
Impulse response of first order and second order system
Realization of an FIR filter (any type) to meet given specifications .The input

43
44
45
46
47
49

can be a signal from function generator / speech signal.


6

Noise: Add noise above 3kHz and then remove; Interference suppression

51

using 400 Hz tone.

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Introduction to MATLAB
The name MATLAB stands for MATrix LABoratory. MATLAB is a highperformance language for technical computing. It integrates computation,
visualization, and programming environment. It has powerful built-in routines
that enable a very wide variety of computations. It also has easy to use
graphics commands that make the visualization of results immediately
available. Matlab is especially designed for matrix computations: solving
systems of linear equations, computing eigenvalues and eigenvectors,
factoring matrices, and so forth. In addition, it has a variety of graphical
capabilities, and can be extended through programs written in its own
programming language. Many such programs come with the system; a
number of these extend Matlab's capabilities to nonlinear problems, such as
the solution of initial value problems for ordinary differential equations.
Typical uses:
1. Math and computation
2. Algorithm development
3. Data acquisition
4. Modeling, simulation, and prototyping
5. Data analysis, exploration and visualization
6. Scientific and engineering graphics
7. Application development

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

MATLAB Software flow diagram

How to Program?
S1:

Click the Icon on the Desktop

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


Ideal Window

S2:

V semester

Create a New folder, name it and set it as


current directory

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


S3: Create New .m file for writing a Matlab code

V semester

S4: Enter the code in editor and save it with appropriate name.

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

S5: Run the code in Command window by typing the name of the code.

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Part A

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


EXPERIMENT No 1

V semester

Verification of Sampling theorem.

Aim: To verify Sampling theorem for a signal of given frequency.


Theory:
Sampling is a process of converting a continuous time signal (analog signal) x(t) into a
discrete time signal x[n], which is represented as a sequence of numbers. (A/D converter)

Converting back x[n] into analog (resulting in x (t ) ) is the process of reconstruction. (D/A
converter)
Techniques for reconstruction-(i) ZOH (zero order hold) interpolation results in a staircase
waveform, is implemented by MATLAB plotting function stairs(n,x), (ii) FOH (first order
hold) where the adjacent samples are joined by straight lines is implemented by MATLAB
plotting function plot(n,x),(iii) spline interpolation, etc.

For x (t ) to be exactly the same as x(t), sampling theorem in the generation of x(n) from
x(t) is used. The sampling frequency fs determines the spacing between samples.
Aliasing-A high frequency signal is converted to a lower frequency, results due to under sampling.
Though it is undesirable in ADCs, it finds practical applications in stroboscope and sampling
oscilloscopes.
Algorithm:
1. Input the desired frequency fd (for which sampling theorem is to be verified).
2. Generate an analog signal xt of frequency fd for comparison.
3. Generate oversampled, nyquist & under sampled discrete time signals.
4. Plot the waveforms and hence prove sampling theorem.
MATLAB Program:
tfinal=0.05;
t=0:0.00005:tfinal;
fd=input('Enter analog freuency');
%define analog signal for comparison
xt=sin(2*pi*fd*t);
%simulate condition for undersampling i.e., fs1<2*fd
fs1=1.3*fd;
%define the time vector
n1=0:1/fs1:tfinal;
%Generate the undersampled signal
xn=sin(2*pi*n1*fd);
%plot the analog & sampled signals
subplot(3,1,1);
plot(t,xt,'b',n1,xn,'r*-');
title('undersampling plot');
%condition for Nyquist plot
fs2=2*fd;
n2=0:1/fs2:tfinal;
xn=sin(2*pi*fd*n2);
subplot(3,1,2);
plot(t,xt,'b',n2,xn,'r*-');
title('Nyquist plot');
Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


%condition for oversampling
fs3=5*fd;
n3=0:1/fs3:tfinal;
xn=sin(2*pi*fd*n3);
subplot(3,1,3);
plot(t,xt,'b',n3,xn,'r*-');
title('Oversampling plot');
xlabel('time');
ylabel('amplitude');
legend('analog','discrete')

V semester

Result:
Enter analog frequency 200
The plots are shown in Fig.1.1

Fig.1.1 Plots of a sampled sine wave of 200Hz


Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


V semester
Sampling at the Nyquist rate results in samples sin(n) which are identically zero, i.e., we are
sampling at the zero crossing points and hence the signal component is completely missed. This
can be avoided by adding a small phase shift to the sinusoid. The above problem is not seen in
cosine waveforms (except cos(90n)). A simple remedy is to sample the analog signal at a rate
higher than the Nyquist rate. The Fig1.2 shows the result due to a cosine signal
(x1=cos(2*pi*fd*n1);

Fig.1.2 Plots of a sampled cosine wave of 200Hz

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 2: Impulse response of a given system


Aim: To find the impulse response h(n) of the given LTI system whose response y(n)
to an input x(n) is given.
Theory:

Fig.2.1 A LTI system

A discrete time LTI system (also called digital filters) as shown in Fig.2.1 is represented by
o A linear constant coefficient difference equation, for example,
y[ n] a1 y[ n 1] a 2 y[ n 2] b0 x[ n] b1 x[ n 1] b2 x[ n 2];

o A system function H(z) (obtained by applying Z transform to the difference


Y ( z ) b0 b1 z 1 b2 z 2

equation). H ( z )
X ( z ) 1 a1 z 1 a 2 z 2
o A frequency response function obtained by applying DTFT on the impulse response
h[n] (or by replacing z with ej in H(z)) to get
Y (e j ) b0 b1e j b2 e 2 j
H ( e j )

X (e j ) 1 a1e j a 2 e 2 j
Given the difference equation or H(z), the impulse response of the LTI system is found
using filter or impz MATLAB functions. This is elaborated in experiment no.7 - Solving
a given difference equation. If the difference equation contains past samples of output, i.e.,
y[n-1], y[n-2], etc , then its impulse response is of infinite duration (IIR). For such systems
the impulse response is computed for a large value of n, say n=100 (to approximate n=).
Given only the input sequence x[n] and the output sequence y[n], we can find the impulse
function h[n] by using the inverse operation deconv. (The conv operation convolves 2
sequences x[n] and h[n] to obtain the output y[n]. for convolution operation refer
experiment no 3: Linear convolution of two given sequences). If both y[n] and x[n] are
finite then the impulse response is finite (FIR).
The deconvolution operation is valid only if the LTI system is invertible.

Algorithm for Problem1:


1. Input the two sequences as x and y.
2. Use deconv to get impulse response h.
3. Plot the sequences.
4. Verify using conv(x,h) to get y back.

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

MATLAB Programs:
y= input('The output sequence y(n) of the system=');
x=input('the input sequence of the system=');
h=deconv(y,x);
disp('the impulse response of the system is=');
disp(h);
%graphical display part
N=length(h);
n=0:1:N-1;
stem(n,h);
xlabel('Time index n');
ylabel('Amplitude');
title('impulse response of a system')
%Verification
yv=conv(x,h);
disp('the verified output sequence is');
disp(yv)
Fig. 2.1 Impulse Response (Program 1)

Result:
The output sequence y(n) of the system=[1 2 1 1 0
the input sequence of the system=[1 1 1 1]
the impulse response of the system is= 1 1 -1
the verified output sequence is 1 2 1 1 0 -1
The plots are shown in Fig.2.1

Dept. of TCE, Dr.AIT

-1]

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 3: Linear convolution of two given sequences.


Aim: To obtain convolution of two finite duration sequences.
Theory:
The output y[n] of a LTI (linear time invariant) system can be obtained by convolving the
input x[n] with the systems impulse response h[n].

x[k ]h[n k ] x[n k ]h[k ]

The convolution sum is y[n] x[n] h[ n]

x[n] and h[n] can be both finite or infinite duration sequences.


Even if one (or both) of the sequences is infinite (say, h[n] 0.9 n u[n] ), we can
analytically evaluate the convolution formula to get a functional form (closed form
solution) of y[n].
If both the sequences are of finite duration, then we can use the MATLAB function conv
to evaluate the convolution sum to obtain the output y[n]. Convolution is implemented as
polynomial multiplication (refer MATLAB help).
The length of y[n] = xlength + hlength -1.
The conv function assumes that the two sequences begin at n=0 and is invoked by
y=conv(x,h).
Even if one of the sequences begin at other values of n, say n=-3,or n=2; then we need to
provide a beginning and end point to y[n] which are ybegin=xbegin+hbegin and
yend=xend+hend respectively.

Algorithm:
1. Input the two sequences as x1, x2
2. Convolve both to get output y.
3. Plot the sequences.
MATLAB Program:
Level 1 Program (both sequences are right sided)
%main part of computation
x1=input('Enter first sequence')
x2=input('Enter second sequence')
y=conv(x1,x2);
disp('linear con of x1 & x2 is y=');
disp(y);
%graphical display part
subplot (2,1,1);
stem(y);
xlabel('time index n');
ylabel('amplitude ');
title('convolution output');
subplot(2,2,3);
stem(x1);
xlabel('time index n');
ylabel('amplitude ');
title('plot of x1');
subplot(2,2,4);
Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


stem(x2);
xlabel('time index n');
ylabel('amplitude ');
title('plot of x2');

V semester

Result
Enter first sequence [1 2 3 4]**
x1 = 1 2 3 4
Enter second sequence[ 2 3 2 4]
x2 = 2 3 2 4
linear con of x1 & x2 is y=
2 7 14 25 26 20 16
**-Entered by user.

Fig.3.1Shows the plot For right sided sequences (Without time information)

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Level 2 Program (Two sided sequences)


%main part of computation
x1=[1 2 3 2 1 3 4] %first sequence
n1=-3:3 %time vector of first seq
x2=[ 2 -3 4 -1 0 1] %second seq
n2=-1:4 %time vector of second seq
%add first elements of time vector
ybegin=n1(1)+n2(1);
%add last elements of time vector
yend=n1(length(x1))+n2(length(x2));
ny=[ybegin:yend];
y=conv(x1,x2)
;
disp('linear con of x1 & x2 is y=');
disp(y);
%graphical display with time info
subplot (2,1,1);
stem(ny,y);
xlabel('time index n');
ylabel('amplitude ');
title('convolution output');
subplot(2,2,3);
stem(n1,x1);
xlabel('time index n');
ylabel('amplitude ');
title('plot of x1');
subplot(2,2,4);
stem(n2,x2);
xlabel('time index n');
ylabel('amplitude ');
title('plot of x2');

Fig.3.2 For two sided sequences (With time information)


Result
x1 =1 2 3 2 1 3 4
n1 =-3 -2 -1 0 1 2 3
x2 =2 -3 4 -1 0 1
n2 =-1 0 1 2 3 4
linear con of x1 & x2 is y = 2 1 4 2 6 9 3 2 15 -3 3 4

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 4: Circular convolution of two given sequences.


Aim: To obtain circular convolution of two finite duration sequences.
Theory:
As seen in the last experiment, the output y[n] of a LTI (linear time invariant) system can
be obtained by convolving the input x[n] with the systems impulse response h[n].
The above linear convolution is generally applied to aperiodic sequences. Whereas the
Circular Convolution is used to study the interaction of two signals that are periodic.

The linear convolution sum is y[n] x[n] h[ n]

x[k ]h[n k ]

x[n k ]h[k ]

. To compute this equation, the linear convolution involves the following operations:
o Folding- fold h[k] to get h[-k] ( for y[0])
o Multiplication vk[n] = x[k] h[n-k] (both sequences are multiplied sample by
sample)
o Addition- Sum all the samples of the sequence vk[n] to obtain y[n]
o Shifting the sequence h[-k] to get h[n-k] for the next n.

The circular convolution sum is y[n] x[n] N h[n]

x[k ]h[

nk

] where the

where the index n k N implies circular shifting operation and k N implies folding
the sequence circularly.
Steps for circular convolution are the same as the usual convolution, except all index
calculations are done "mod N" = "on the wheel".
o Plot f [m] and h [m] as shown in Fig. 4.1. (use f(m) instead of x(k))
o Multiply the two sequences
o Add to get y[m]
o "Spin" h[m] n times Anti Clock Wise (counter-clockwise) to get h[n-m].
x[n] and h[n] can be both finite or infinite duration sequences. If infinite sequences, they
should be periodic, and the N is chosen to be at least equal to the period. If they are finite
sequences N is chosen as >= to max(xlength, hlength). Whereas in linear convolution N>=
xlength+hlength-1.
Say x[ n] {2,3, 1,1} and N = 5, then the x[-1] and x[-2] samples are plotted at x[N-1] =
x[-4] and x[N-2] =x[-3] places. Now x[n] is entered as x[n] {1,1,0,2,3} .

Fig. 4.1 Plotting of f(m) and h(-m) for circular convolution

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Algorithm:
1. Input the two sequences as x and h.
2. Circularly convolve both to get output y.
3. Plot the sequences.
MATLAB Program:
%Circular Convolution Program
x=[1 2 3 4];
h= [1 2 3 4];
N=max(length(x1),length(x2));
%compute the output
for n=0:N-1
y(n+1)=0;
for k=0:N-1
i=mod((n-k),N); %calculation of x index
if i<0
i=i+N;
end %end of if
y(n+1)=y(n+1)+h(k+1)*x(i+1);
end
%end of inner for loop
end
%end of outer for loop
disp('circular convolution of x1 &x2 is y=');
disp(y);
%plot
n1=0:N-1;
stem(n1,y);
title('Circular convolution output y(n)');
Result:
circular convolution of x1 &x2 is
y= 26 28 26 20
The plot is as shown in Fig. 4.1

Fig. 4.1 Circular convolution output

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 5: Autocorrelation of a given sequence and verification of its


properties.
Aim: To obtain autocorrelation of the given sequence and verify its properties.
Theory:
Correlation is mathematical technique which indicates whether 2 signals are related and in a
precise quantitative way how much they are related. A measure of similarity between a pair of
energy signals x[n] and y[n] is given by the cross correlation sequence rxy[l] defined by
rxy [l ]

x[n] y[n l ]; l 0,1,2,... .

The parameter l called lag indicates the time shift between the pair.

Autocorrelation sequence of x[n] is given by rxx [l ]

x[n]x[n l ]; l 0,1,2,...

Some of the properties of autocorrelation are enumerated below


o The autocorrelation sequence is an even function i.e., rxx [l ] rxx [l ]
o At zero lag, i.e., at l=0, the sample value of the autocorrelation sequence has its maximum
value (equal to the total energy of the signal x) i.e., rxx [l ] rxx [0] x

[ n] .

This is verified in Fig. 5.1, where the autocorrelation of the rectangular pulse (square) has a
maximum value at l=0. All other samples are of lower value. Also the maximum value = 11 =
energy of the pulse [12+12+12..].
o A time shift of a signal does not change its autocorrelation sequence. For example, let
y[n]=x[n-k]; then ryy[l] = rxx[l] i.e., the autocorrelation of x[n] and y[n] are the same regardless
of the value of the time shift k. This can be verified with a sine and cosine sequences of same
amplitude and frequency will have identical autocorrelation functions.
o For power signals the autocorrelation sequence is given by
k
1
rxx [l ] lim
x[ n] x[ n l ]; l 0,1,2,... and for periodic signals with period N it

k 2 k 1
n k
1 N 1
is rxx [l ]
x[n]x[n l ]; l 0,1,2,... and this rxx[l] is also periodic with N. This is
N n 0
verified in Fig. 5.3 where we use the periodicity property of the autocorrelation sequence to
determine the period of the periodic signal y[n] which is x[n] (=cos(0.25*pi*n)) corrupted by
an additive uniformly distributed random noise of amplitude in the range [-0.5 0.5]

Algorithm:
1. Input the sequence as x.
2. Use the xcorr function to get auto correlated output r.
3. Plot the sequences.

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

MATLAB Programs
%Energy signals
%simple sequence
x2=[3,-1,2,1];
>> xcorr(x2)
ans = 3 5 -3 15

-3

%Computation of Autocorrelation of a
% rectangular Sequence
n = -5:5;
N=10;
% Generate the square sequence
x = ones(1,11);
% Compute the correlation sequence
%r = conv(x, fliplr(x));
r=xcorr(x);
disp('autocorrelation sequence r=');
disp(r);
%plot the sequences
subplot(2,1,1)
stem(n,x);
title('square sequence');
subplot(2,1,2)
k = -N:N;
stem(k, r);
title('autocorrelation output');
xlabel('Lag index'); ylabel('Amplitude');
Fig.5.1 Autocorrelation output
Result:
autocorrelation sequence r = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000
8.0000 9.0000 10.0000 11.0000 10.0000 9.0000 8.0000 7.0000 6.0000 5.0000
4.0000 3.0000 2.0000 1.0000

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 6:Cross correlation of a given sequence and verification of


its properties.
Aim: To obtain cross correlation of the given sequence and verify its properties.
Theory:
Cross Correlation has been introduced in the last experiment. Comparing the equations for
the linear convolution and cross correlation we find that
rxy [l ]

x[n] y[n l ] x[n] y[(l n)] x[l ] y[l ] . i.e., convolving the

reference signal with a folded version of sequence to be shifted (y[n]) results in cross
correlation output. (Use fliplr function for folding the sequence for correlation).
The properties of cross correlation are 1) the cross correlation sequence sample values are
upper bounded by the inequality rxx [l ] rxx [0]ryy [0] x y
2) The cross correlation of two sequences x[n] and y[n]=x[n-k] shows a peak at the value
of k. Hence cross correlation is employed to compute the exact value of the delay k
between the 2 signals. Used in radar and sonar applications, where the received signal
reflected from the target is the delayed version of the transmitted signal (measure delay to
determine the distance of the target).
3) The ordering of the subscripts xy specifies that x[n] is the reference sequence that
remains fixed in time, whereas the sequence y[n] is shifted w.r.t x[n]. If y[n] is the
reference sequence then ryx [l ] rxy [l ] . Hence ryx[l] is obtained by time reversing the
sequence rxy[l].

Algorithm:
1. Input the sequence as x and y.
2. Use the xcorr function to get cross correlated output r.
3. Plot the sequences.
MATLAB Programs
% Computation of Cross-correlation Sequence using folded sequence and convolution
x = input('Type in the reference sequence = ');
y = input('Type in the second sequence = ');

% Compute the correlation sequence


n1 = length(y)-1;
n2 = length(x)-1;
r = conv(x,fliplr(y));
disp(Cross correlation output is =);
disp(r);
k = (-n1):n2; %time vector for plotting
stem(k,r);
xlabel('Lag index'); ylabel('Amplitude');

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

% Computation of Cross-correlation Sequence using xcorr function


x = input('Type in the reference sequence = ');
y = input('Type in the second sequence = ');

% Compute the correlation sequence


n1 = length(y)-1;
n2 = length(x)-1;
r = xcorr(x,y);
%[r,lag]=xcorr(x,y);
disp('Cross correlation output is =');
disp(r);
N=max(n1,n2) ;
k = (-N):N;
stem(k,r); %stem(lag,r);
xlabel('Lag index'); ylabel('Amplitude');
Result:
Type in the reference sequence = [1 3 -2 1 2 -1 4 4 2]
Type in the second sequence = [2 -1 4 1 -2 3]
Cross correlation output is =
3 7 -11 14 13 -15 28 6 -2 21 12 12

Verification: with xcorr(x,y), the output is


{-0.0000 , -0.0000 , 0.0000, 3.0000, 7.0000, -11.0000, 14.0000, 13.0000, -15.0000, 28.0000,
6.0000, -2.0000, 21.0000, 12.0000, 12.0000, 6.0000 , 4.0000}
Note: For sequences with different lengths, the length of the output using xcorr is 2*max(n1,n2)-1
= 2* 9-1=17 whereas using conv program, the length of output is n1+n2-1.

Fig.6.1 Cross correlation output using Convolution

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Fig.6.2 Cross correlation output using xcorr

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 7 Solving a given difference equation


Aim: To obtain the impulse response/step response of a system described by the
given difference equation
Theory:
A difference equation with constant coefficients describes a LTI system. For example the
difference equation y[n] + 0.8y[n-2] + 0.6y[n-3] = x[n] + 0.7x[n-1] + 0.5x[n-2] describes a
LTI system of order 3. The coefficients 0.8, 0.7, etc are all constant i.e., they are not
functions of time (n). The difference equation y[n]+0.3ny[n-1]=x[n] describes a time
varying system as the coefficient 0.3n is not constant.
The difference equation can be solved to obtain y[n], the output for a given input x[n] by
rearranging as y[n] = x[n] + 0.7x[n-1]+0.5x[n-2]- 0.8y[n-2]- 0.6y[n-3] and solving.
The output depends on the input x[n]
o With x[n]= [n], an impulse, the computed output y[n] is the impulse response.
o If x[n]=u[n], a step response is obtained.
o If x[n] = cos(wn) is a sinusoidal sequence, a steady state response is obtained
(wherein y[n] is of the same frequency as x[n], with only an amplitude gain and
phase shift-refer Fig.7.3).
o Similarly for any arbitrary sequence of x[n], the corresponding output response y[n]
is computed.
The difference equation containing past samples of output, i.e., y[n-1], y[n-2], etc leads to a
recursive system, whose impulse response is of infinite duration (IIR). For such systems
the impulse response is computed for a large value of n, say n=100 (to approximate n=).
The MATLAB function filter is used to compute the impulse response/ step response/
response to any given x[n]. Note: The filter function evaluates the convolution of an
infinite sequence (IIR) and x[n], which is not possible with conv function (remember conv
requires both the sequences to be finite).
The difference equation having only y[n] and present and past samples of input (x[n], x[nk]), represents a system whose impulse response is of finite duration (FIR). The response of
FIR systems can be obtained by both the conv and filter functions. The filter function
results in a response whose length is equal to that of the input x[n], whereas the output
sequence from conv function is of a longer length (xlength + hlength-1).

Algorithm:
1. Input the two sequences as a and b representing the coefficients of y and x.
2. If IIR response, then input the length of the response required (say 100, which can be made
constant).
3. Compute the output response using the filter command.
4. Plot the input sequence & impulse response (and also step response, etc if required).
Given Problem
1)Difference equation y(n) - y(n-1) + 0.9y(n-2) = x(n);
Calculate impulse response h(n) and also step response at n=0,..,100
2)Plot the steady state response y[n] to x[n]=cos(0.05n)u(n), given y[n]-0.8y[n-1]=x[n]

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

MATLAB Program:
%To find Impulse Response
N=input('Length of response required=');
b=[1];
%x[n] coefficient
a=[1,-1,0.9]; %y coefficients
%impulse input
x=[1,zeros(1,N-1)];
%time vector for plotting
n=0:1:N-1;
%impulse response
h=filter(b,a,x);
*note
%plot the waveforms
subplot(2,1,1);
stem(n,x);
title('impulse input');
xlabel('n');
ylabel('(n)');
subplot(2,1,2);
stem(n,h);
title('impulse response');
xlabel('n');
ylabel('h(n)');
Result:
Length=100
Plots in Fig. 7.1
Fig.7.1 Impulse Response

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

%To find step response


N=input('Length of response required=');
b=[1]; %x[n] coefficient
a=[1,-1,0.9]; %y coefficients
x=[ones(1,N)]; %step input
n=0:1:N-1;
%time vector for plotting
y=filter(b,a,x); %step response
%plot the waveforms
subplot(2,1,1);
stem(n,x);
title('step input');
xlabel('n');
ylabel('u(n)');
subplot(2,1,2);
stem(n,h);
title('step response');
xlabel('n');
ylabel('y(n)');
Result:
Length=100
Plots in Fig. 7.2
Fig.7.2 Step Response
%To find steady state response
%y[n]-0.8y[n-1]=x[n]
N=input('Length of response required=');
b=[1]; %x[n] coefficient
a=[1,-0.8]; %y coefficients
n=0:1:N-1;
%time vector
x=cos(0.05*pi*n); % sinusoidal input
y=filter(b,a,x); %steady state response
Result:
Length=100
Plots in Fig. 7.3

Fig. 7.3 Steady state Response to a cosine input


Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 8. Computation of N point DFT of a given sequence and to


plot magnitude and phase spectrum.
Aim: To compute DFT of the given sequence.
Theory:
Discrete Fourier Transform (DFT) is used for performing frequency analysis of discrete
time signals. DFT gives a discrete frequency domain representation whereas the other
transforms are continuous in frequency domain.
The N point DFT of discrete time signal x[n] is given by the equation
N -1

X (k ) x[ n]e

j 2kn
N

; k 0,1,2,....N - 1

n 0

Where N is chosen such that N L , where L=length of x[n].


The inverse DFT allows us to recover the sequence x[n] from the frequency samples.
j 2kn
1 N 1
N
x[n]
x
[
n
]
e
; n 0,1,2,....N - 1

N k 0
X(k) is a complex number (remember ejw=cosw + jsinw). It has both magnitude and phase
which are plotted versus k. These plots are magnitude and phase spectrum of x[n]. The k
gives us the frequency information.
Here k=N in the frequency domain corresponds to sampling frequency (fs). Increasing N,
increases the frequency resolution, i.e., it improves the spectral characteristics of the
sequence. For example if fs=8kHz and N=8 point DFT, then in the resulting spectrum, k=1
corresponds to 1kHz frequency. For the same fs and x[n], if N=80 point DFT is computed,
then in the resulting spectrum, k=1 corresponds to 100Hz frequency. Hence, the resolution
in frequency is increased.

Since N L , increasing N to 8 from 80 for the same x[n] implies x[n] is still the same
sequence (<8), the rest of x[n] is padded with zeros. This implies that there is no further
information in time domain, but the resulting spectrum has higher frequency resolution. This
spectrum is known as high density spectrum (resulting from zero padding x[n]). Instead of
zero padding, for higher N, if more number of points of x[n] are taken (more data in time
domain), then the resulting spectrum is called a high resolution spectrum.
Algorithm:
1. Input the sequence for which DFT is to be computed.
2. Input the length of the DFT required (say 4, 8, >length of the sequence).
3. Compute the DFT using the fft command.
4. Plot the magnitude & phase spectra.
Matlab Program:
x=[1,2,3,6]; %x[n] sequence
N=4
%N points for DFT
xk=fft(x,N); %computes DFT
% compute & plot amplitude spectrum
n=0:1:N-1;
figure(1);
stem(n,abs(xk));
Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


xlabel(' k');
ylabel('lxkl');
title('Magnitude spectrum');
% phase spectrum
figure(2);
stem(n,angle(xk));
xlabel(' k');
ylabel('angle(xk)');
title('phase spectrum');
figure(3);
n1=0:1:length(x)-1;
stem(n1,x);
xlabel(' n');
ylabel('x[n]');
title('original signal');
x=[2 3 9 -1];
N=4;
for k=0:N-1
xk(k+1)=0;
for n=0:N-1
xk(k+1)=xk(k+1)+x(n+1)*exp(-j*2*pi*n*k/N);
end
end
n=0:1:N-1;
figure(1);
stem(n,abs(xk));
xlabel(' k');
ylabel('lxkl');
title('Magnitude spectrum');
% phase spectrum
figure(2);
stem(n,angle(xk));
xlabel(' k');
ylabel('angle(xk)');
title('phase spectrum');
figure(3);
n1=0:1:length(x)-1;
stem(n1,x);
xlabel(' n');
ylabel('x[n]');
title('original signal');

V semester

Result:
Run1: with N =4, plots are as shown in Fig. 8.1
Run2: with N =8, plots are as shown in Fig. 8.2
Run 3: with n1=0:7; x=cos(2*pi*n*250/8000); %x[n] sequence of 250Hz with fs=8kHz,
& N=8 point DFT, Fig. 8.3 is the output, which shows a frequency of 0Hz, i.e., a peak at k=0 in the
magnitude spectrum.
Run 4: with n1=0:7; x=cos(2*pi*n*250/8000); %x[n] sequence of 250Hz with fs=8kHz,

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


V semester
& N=80 point DFT, Fig. 8.4 is the output, which shows still a frequency of 0Hz, i.e., a peak at k=0
in the magnitude spectrum, but the spectra are more smooth (=continuous). This is a high density
spectra.
Run 5: with n1=0:79; x=cos(2*pi*n*250/8000); %x[n] sequence of 250Hz with fs=8kHz, i.e., the
length of x[n] has increased(implies more information from the time domain)
& N=80 point DFT,
Fig. 8.5 is the output, which shows two frequencies of 200 and 300Hz, i.e., 2 peaks at k=2
and 3 in the magnitude spectrum for N=80. This is a high resolution spectra.
Run 6: with n1=0:79; x=cos(2*pi*n*250/8000); %x[n] sequence of 250Hz with fs=8kHz, &
N=160 point DFT, Fig. 8.6 is the output, which shows one maximum frequency of 250 Hz, i.e., a
peak at k=5 in the magnitude spectrum for N=160.

Fig.8.1

Fig.8.2
Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Fig.8.3

Fig.8.4

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Fig.8.5

Fig 8.6

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 9 Linear convolution of two given sequences using DFT and


IDFT
Aim: To perform linear convolution of two given sequences x1 & x2 using DFT & IDFT
And also
EXPERIMENT NO 10 Circular convolution of two given sequences using DFT and
IDFT
Aim: To perform circular convolution of two given sequences x1 & x2 using DFT &
IDFT
Theory:
By multiplying two N-point DFTs in the frequency domain, we get the circular convolution
in the time domain.
y[n] x[ n] h[ n] N DFT
Y ( k ) X (k ) H ( k )

Circular Convolution is made identical to linear convolution by choosing the number of


points in DFT as N xlength + hlength -1.
For Circular Convolution, N = max (xlength, length).

Algorithm:
1. Input the two sequences as x1, x2
2. Compute N = xlength + hlength -1
(for circular convolution, N=max(xlength + hlength))
3. Obtain N-point DFTs (X1, X2) of both the sequences.
4. Multiply both the DFTs (Y=X1X2).
5. Perform IDFT on Y to get y[n] (the linearly convolved sequence) in time domain.
6. Verify using the conv command.
7. Plot the sequences.
MATLAB Program:
%Linear Convolution Program using DFT
x1=[1 2 3 4];
x2= [1 2 3 4];
N=length(x1)+length(x2)-1;
%obtain DFTs
X1= fft(x1,N);
X2= fft(x2,N);
%Perform vector multiplication
y= X1.*X2;
%ifft to get y[n]
yn= ifft(y,N);
disp('linear convolution of x1 &x2 is yn=');
disp(yn);
%verify
disp('output using conv');
yv=conv(x1,x2);
disp(yv);
%plot
stem(yn);
Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


title('linear convolution output y(n)');

V semester

Result:
linear convolution of x1 &x2 is yn=
1.0000 4.0000 10.0000 20.0000 25.0000 24.0000 16.0000
output using conv
1 4 10 20 25 24 16
The output plot is shown in Fig. 9.1

Fig. 9.1

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

%Circular Convolution Program using DFT


x1=[1 2 3 4];
x2= [1 2 3 4];
N=max(length(x1),length(x2));
%obtain DFTs
X1= fft(x1,N);
X2= fft(x2,N);
%Perform vector multiplication
y= X1.*X2;
%ifft to get y[n]
yn= ifft(y,N);
disp('circular convolution of x1 &x2 is yn=');
disp(yn);
%plot
stem(yn);
title('Circular convolution output y(n)');
Result:
circular convolution of x1 &x2 is yn=
26 28 26 20
The output plot is shown in Fig. 9.2

Fig. 9.2

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 11. Design and implementation of FIR filter to meet given


specifications
Aim: To design and implement a FIR filter for given specifications.
DESIGNING AN FIR FILTER (using window method):
Method I: Given the order N, cutoff frequency fc, sampling frequency fs and the window.
Step 1: Compute the digital cut-off frequency Wc (in the range - < Wc < , with
corresponding to fs/2) for fc and fs in Hz. For example let fc=400Hz, fs=8000Hz
Wc = 2** fc / fs = 2* * 400/8000 = 0.1* radians
For MATLAB the Normalized cut-off frequency is in the range 0 and 1, where 1
corresponds to fs/2 (i.e.,fmax)). Hence to use the MATLAB commands
wc = fc / (fs/2) = 400/(8000/2) = 0.1
Note: if the cut off frequency is in radians then the normalized frequency is computed as
wc = Wc /
Step 2: Compute the Impulse Response h(n) of the required FIR filter using the given
Window type and the response type (lowpass, bandpass, etc). For example given a
rectangular window, order N=20, and a high pass response, the coefficients (i.e., h[n]
samples) of the filter are computed using the MATLAB inbuilt command fir1 as
h =fir1(N, wc , 'high', boxcar(N+1));
Note: In theory we would have calculated h[n]=hd[n]w[n], where hd[n] is the desired
impulse response (low pass/ high pass,etc given by the sinc function) and w[n] is the
window coefficients. We can also plot the window shape as stem(boxcar(N)).
Plot the frequency response of the designed filter h(n) using the freqz function and observe the
type of response (lowpass / highpass /bandpass).
Method 2:
Given the pass band (wp in radians) and Stop band edge (ws in radians) frequencies, Pass band
ripple Rp and stopband attenuation As.
Step 1: Select the window depending on the stopband attenuation required. Generally if
As>40 dB, choose Hamming window. (Refer table )
Step 2: Compute the order N based on the edge frequencies as
Transition bandwidth = tb=ws-wp;
N=ceil (6.6*pi/tb);
Step 3: Compute the digital cut-off frequency Wc as
Wc=(wp+ws)/2
Now compute the normalized frequency in the range 0 to 1 for MATLAB as
wc=Wc/pi;
Note: In step 2 if frequencies are in Hz, then obtain radian frequencies (for computation of tb and
N) as wp=2*pi*fp/fs, ws=2*pi*fstop/fs, where fp, fstop and fs are the passband, stop band and
sampling frequencies in Hz
Step 4: Compute the Impulse Response h(n) of the required FIR filter using N, selected
window, type of response(low/high,etc) using fir1 as in step 2 of method 1.
IMPLEMENTATION OF THE FIR FILTER
1. Once the coefficients of the FIR filter h[n] are obtained, the next step is to simulate an
input sequence x[n], say input of 100, 200 & 400 Hz (with sampling frequency of fs), each
of 20/30 points. Choose the frequencies such that they are >, < and = to fc.

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


V semester
2. Convolve input sequence x[n] with Impulse Response, i.e., x (n)*h (n) to obtain the output
of the filter y[n]. We can also use the filter command.
3. Infer the working of the filter (low pass/ high pass, etc).
MATLAB IMPLEMENTATION
FIR1 Function
B = FIR1(N,Wn) designs an N'th order lowpass FIR digital filter and returns the filter
coefficients in length N+1 vector B. The cut-off frequency Wn must be between 0 < Wn < 1.0,
with 1.0 corresponding to half the sample rate. The filter B is real and has linear phase, i.e., even
symmetric coefficients obeying B(k) = B(N+2-k), k = 1,2,...,N+1.
If Wn is a two-element vector, Wn = [W1 W2], FIR1 returns an order N bandpass filter with
passband W1 < W < W2. B = FIR1(N,Wn,'high') designs a highpass filter. B = FIR1(N,Wn,'stop')
is a bandstop filter if Wn = [W1 W2]. If Wn is a multi-element vector,
Wn = [W1 W2 W3 W4
W5 ... WN], FIR1 returns an order N multiband filter with bands
0 < W < W1, W1 < W < W2, ..., WN < W < 1.
FREQZ Digital filter frequency response. [H,W] = FREQZ(B,A,N) returns the N-point complex
frequency response vector H and the N-point frequency vector W in radians/sample of the filter
whose numerator and denominator coefficients are in vectors B and A. The frequency response is
evaluated at N points equally spaced around the upper half of the unit circle. If N isn't specified, it
defaults to 512.
For FIR filter enter A=1 and B = h[n] coefficients. Appropriately choose N as 128, 256, etc

Window
Name
Rectangular

Table: Commonly used window function characteristics


Transition
Width
Min. Stop band
Matlab
Approximate Exact values
Attenuation
Command
4
M

Bartlett
Hanning
Hamming
Blackman

8
M
8
M
12
M

8
M

1.8
M

21db
6.1
M

6.2
M
6.6
M

B = FIR1(N,Wn,boxcar)
25db

B = FIR1(N,Wn,bartlett)

44db

B = FIR1(N,Wn,hanning)

53db

B= FIR1(N,Wn,hamming)

11
M

74db

B =

FIR1(N,Wn,blackman)
Matlab Program
%Design and implementation of FIR filter Method 1
%generate filter coefficients for the given %order & cutoff Say N=33, fc=150Hz,
%fs=1000 Hz, Hamming window
h=fir1(33, 150/(1000/2),hamming(34));
%generate simulated input of 50, 300 & 200 Hz, each of 30 points
n=1:30;
f1=50;f2=300;f3=200;fs=1000;
x=[];
x1=sin(2*pi*n*f1/fs);
Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


x2=sin(2*pi*n*f2/fs);
x3=sin(2*pi*n*f3/fs);
x=[x1 x2 x3];
subplot(2,1,1);
stem(x);
title('input');
%generate o/p
%y=conv(h,x);
y=filter(h,1,x);
subplot(2,1,2);
stem(y);
title('output');

V semester

Result:
Plots are in Fig.10.3 & 10.4
Notice that freqs below 150 Hz are passed & above 150 are cutoff
%Method 2:
The following program gives only the design of the FIR filter- for implementation continue with
the next program (after h[n])
%input data to be given: Passband & Stopband frequency
% Data given: Passband ripple & stopband attenuation As. If As>40 dB, Choose hamming
clear
wpa=input('Enter passband edge frequency in Hz');
wsa= input('Enter stopband edge frequency in Hz');
ws1= input('Enter sampling frequency in Hz');
%Calculate transmission BW,Transition band tb,order of the filter
wpd=2*pi*wpa/ws1;
wsd=2*pi*wsa/ws1;
tb=wsd-wpd;
N=ceil(6.6*pi/tb)
wc=(wsd+wpd)/2;
%compute the normalized cut off frequency
wc=wc/pi;
%calculate & plot the window
hw=hamming(N+1);
stem(hw);
title('Fir filter window sequence- hamming window');
%find h(n) using FIR
h=fir1(N,wc,hamming(N+1));
%plot the frequency response
figure(2);
[m,w]=freqz(h,1,128);
mag=20*log10(abs(m));
plot(ws1*w/(2*pi),mag);
title('Fir filter frequency response');
grid;
Result:
Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


Enter passband edge frequency in Hz100
Enter stopband edge frequency in Hz200
Enter sampling frequency in Hz1000
N = 33
Plots are as in Fig.10.1 and 10.2

V semester

Notice the maximum stopband attenuation of 53 dB from plot 10.2

Fig.10.1

Fig.10.3(using filter command)

Dept. of TCE, Dr.AIT

Fig.10.2

Fig.10.4(using conv command)

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Fig.10.5 Freqs f1=150;f2=300;f3=170;fs=1000;

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 12. Design and implementation of IIR filter to meet given


specifications
Aim: To design and implement an IIR filter for given specifications.
Method I:
Given the order N, cutoff frequency fc, sampling frequency fs and the IIR filter type (butterworth,
cheby1, cheby2).
Step 1: Compute the digital cut-off frequency Wc (in the range - < Wc < , with
corresponding to fs/2) for fc and fs in Hz. For example let fc=400Hz, fs=8000Hz
Wc = 2** fc / fs = 2* * 400/8000 = 0.1* radians
For MATLAB the Normalized cut-off frequency is in the range 0 and 1, where 1 corresponds
to fs/2 (i.e.,fmax)). Hence to use the MATLAB commands
wc = fc / (fs/2) = 400/(8000/2) = 0.1
Note: if the cut off frequency is in radians then the normalized frequency is computed as wc =
Wc /
Step 2: Compute the Impulse Response [b,a] coefficients of the required IIR filter and the
response type (lowpass, bandpass, etc) using the appropriate butter, cheby1, cheby2 command.
For example given a butterworth filter, order N=2, and a high pass response, the coefficients
[b,a] of the filter are computed using the MATLAB inbuilt command butter as [b,a]
=butter(N, wc , 'high');
Method 2:
Given the pass band (Wp in radians) and Stop band edge (Ws in radians) frequencies, Pass
band ripple Rp and stopband attenuation As.
Step 1: Since the frequencies are in radians divide by to obtain normalized frequencies to
get wp=Wp/pi and ws=Ws/pi
If the frequencies are in Hz (note: in this case the sampling frequency should be given),
then obtain normalized frequencies as wp=fp/(fs/2), ws=fstop/(fs/2), where fp, fstop and fs
are the passband, stop band and sampling frequencies in Hz
Step 2: Compute the order and cut off frequency as
[N, wc] = BUTTORD(wp, ws, Rp, Rs)
Step 3: Compute the Impulse Response [b,a] coefficients of the required IIR filter and the
response type as [b,a] =butter(N, wc , 'high');
IMPLEMENTATION OF THE IIR FILTER
1. Once the coefficients of the IIR filter [b,a] are obtained, the next step is to simulate an
input sequence x[n], say input of 100, 200 & 400 Hz (with sampling frequency of fs), each
of 20/30 points. Choose the frequencies such that they are >, < and = to fc.
2. Filter the input sequence x[n] with Impulse Response, to obtain the output of the filter y[n]
using the filter command.
3. Infer the working of the filter (low pass/ high pass, etc).
MATLAB IMPLEMENTATION
BUTTORD Butterworth filter order selection.
[N, Wn] = BUTTORD(Wp, Ws, Rp, Rs) returns the order N of the lowest order digital
Butterworth filter that loses no more than Rp dB in the passband and has at least Rs dB of
attenuation in the stopband. Wp and Ws are the passband and stopband edge frequencies,
normalized from 0 to 1 (where 1 corresponds to pi radians/sample). For example,
Lowpass: Wp = .1, Ws = .2 Highpass: Wp = .2, Ws = .1
Bandpass: Wp = [.2 .7], Ws = [.1 .8] Bandstop: Wp = [.1 .8], Ws = [.2 .7]
BUTTORD also returns Wn, the Butterworth natural frequency (or, the "3 dB frequency") to use
with BUTTER to achieve the specifications.
Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


V semester
[N, Wn] = BUTTORD(Wp, Ws, Rp, Rs, 's') does the computation for an analog filter, in which
case Wp and Ws are in radians/second.
When Rp is chosen as 3 dB, the Wn in BUTTER is equal to Wp in BUTTORD.
BUTTER Butterworth digital and analog filter design.
[B,A] = BUTTER(N,Wn) designs an Nth order lowpass digital Butterworth filter and returns the
filter coefficients in length N+1 vectors B (numerator) and A (denominator). The coefficients are
listed in descending powers of z. The cutoff frequency Wn must be 0.0 < Wn < 1.0, with 1.0
corresponding to half the sample rate. If Wn is a two-element vector, Wn = [W1 W2], BUTTER
returns an order 2N bandpass filter with passband W1 < W < W2. [B,A] =
BUTTER(N,Wn,'high') designs a highpass filter. [B,A] = BUTTER(N,Wn,'stop') is a bandstop
filter if Wn = [W1 W2].
BUTTER(N,Wn,'s'), BUTTER(N,Wn,'high','s') and BUTTER(N,Wn,'stop','s') design analog
Butterworth filters. In this case, Wn is in [rad/s] and it can be greater than 1.0.
Matlab Program (Design & implementation)
%generate filter coefficients for the given %order & cutoff Say N=2, fc=150Hz, %fs=1000 Hz,
butterworth filter
[b,a]=butter(2, 150/(1000/2));
%generate simulated input of 100, 300 & 170 Hz, each of 30 points
n=1:30;
f1=100;f2=300;f3=170;fs=1000;
x=[];
x1=sin(2*pi*n*f1/fs);
x2=sin(2*pi*n*f2/fs);
x3=sin(2*pi*n*f3/fs);
x=[x1 x2 x3];
subplot(2,1,1);
stem(x);
title('input');
%generate o/p
y=filter(b,a,x);
subplot(2,1,2);
stem(y);
title('output');
Result:
Plot is in Fig. 11.1, which shows that 100 Hz is passed, while 300 is cutoff and 170 has slight
attenuation.
Note: If fp,fstp,fs, rp,As are given then use
[N,wc]=buttord(2*fp/fs,2*fstp/fs,rp,As)
[b,a]=butter(N,wc);
If wp & ws are in radians
[N,wc]=buttord(wp/pi,ws/pi,rp,As)
[b,a]=butter(N,wc);
If wc is in radians & N is given
[b,a]=butter(N,wc/pi);
For a bandpass output
Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


wc=[150/(1000/2) 250/(1000/2)];
[b,a]=butter(4, wc);
Plot is in Fig.11.2 where only 170 is passed, while 100 & 300 are cutoff.

V semester

Fig.11.1 Low pass IIR filter(butterworth) output

Fig.11.2 IIR output for bandpass (150-250 Hz)


Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Part B

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

CCS INTRODUCTION
Procedure
1. Double click on CCS icon
2. Create a new project: project New
Type the project name (x.pjt) & store in myprojects folder
To open an existing project: project open
3. Files to be added to the project: project Add Files to project
a. c: \ CCStudio \ c5400 \ cgtools \ lib \ rts.lib
<Select type of file as: library>
b. c: \ ti \ c5400\ tutorial \ hello1 \ hello.cmd
< Select type of file as: Linker Command file>
4. File New source file same as xx.c
( Select type of file as: C/C++ file before saving) & add this C file to your project
5. Project Build. (obtain Build successful)
6. To execute ; File load program (select pjtname.out file)
7. To Run : Debug Run
8. Observe the output on the stdout window or waveforms using graph or CRO
9. To view waveforms View Graph

Changes in graph property dialog box to be made


a. Display type Dual (to observe 2 waveforms)
b. Title User defined
c. Start address upper display x (user defined variable array names used in C
program. Note: x, y should be made global to be used by graph)
d. Start address lower display y
e. Acquisition Buffer size 60 (depends on the array size)
f. Display Buffer size 60
g. DSP data type 32-bit Floating pt
h. Auto scale ON (if off choose max value=1)

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 1
Aim: To perform linear convolution for the given sequences
The linear convolution sum is y[n] x[n] h[ n]

x[k ]h[n k ] x[n k ]h[k ]

C Program
# include<stdio.h>
# include<math.h>
main()
{//the two sequences can be of different lengths, no need to zero pad for this program
float h[4] = { 2,2,2,2}; float x[4] ={1,2,3,4};
float y[10];
int xlen=4; int hlen=4;
int N=xlen+hlen-1;
int k,n;
for(n=0;n<N;n++)
//outer loop for y[n] array
{
y[n]=0;
for(k=0;k<hlen;k++)
//inner loop for computing each y[n] point
{
if (((n-k)>=0) & ((n-k)<xlen))
y[n]=y[n]+h[k]*x[n-k];
//compute output
}
//end of inner for loop
printf("%f\t", y[n]);
}
//end of outer for loop
}
//end of main
Result
6.000000
12.000000
20.000000
18.000000
Verify with MATLAB / theoretical verification

Dept. of TCE, Dr.AIT

14.000000

8.000000

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 2
Aim: To perform circular convolution of two given sequences
The circular convolution sum is y[n] x[n] N h[n]

h[k ]x

nk

C Program
# include<stdio.h>
# include<math.h>
main()
{ //input the two sequences, if of uneven lengths zero pad the smaller one such that both are of
same size
float x[5]={1,2,3,4,5};
float h[5]={2,1,3,4,5};
float y[10];
//output sequence
int N=5;
// N=max of xlen and hlen//
nt k,n,i;
for(n=0;n<N;n++)
//outer loop for y[n] array
{
y[n]=0;
for(k=0;k<N;k++)
//inner loop for computing each y[n] point
{
i=(n-k)%N;
//compute the index modulo N
if(i<0)
//if index is <0, say x[-1], then convert to x[N-1]
i=i+N;
y[n]=y[n]+h[k]*x[i];
//compute output
}
//end of inner for loop
printf("%f\t",y[n]);
}
//end of outer for loop
}
//end of main
Result
41.000000
51.000000
51.000000
46.000000
Verify with MATLAB / theoretical verification

Dept. of TCE, Dr.AIT

36.000000

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO: 3: Computation of N- Point DFT of a given sequence


Aim: To compute the N (=4/8/16) point DFT of the given sequence
Theory:
The N point DFT of discrete time signal x[n] is given by the equation
N -1

X (k ) x[ n]e

j 2kn
N

; k 0,1,2,....N - 1

n 0

Where N is chosen such that N L , where L=length of x[n]. To implement using C program we
j 2kn
2kn
2kn
use the expression e N cos
j sin
and allot memory space for real and
N
N
imaginary parts of the DFT X(k)
C Program
#include <stdio.h>
#include <math.h>
main()
{
float y[16]; //for 8 point DFT to store real & imaginary
float x[4]={1,3,2,5}; //input only real sequence
float w;
int n,k,k1,N=8,xlen=4;
for(k=0;k<2*N;k=k+2)
{
y[k]=0; y[k+1]=0;
//initialize real & imag parts
k1=k/2; //actual k index
for(n=0;n<xlen;n++)
{
w=-2*3.14*k1*n/N; //careful about minus sign
y[k]=y[k]+x[n]*cos(w);
y[k+1]=y[k+1]+x[n]*sin(w);
}
printf("%f+j%f \n",y[k],y[k+1]);
}
}//end of main
Result: (on std out)
11.000000+j0.000000
2.424618+j-3.646700
-0.971311+j-2.009436

-0.407551+j-7.660230
-4.999950+j-0.022297
-0.460726+j7.633037

-1.009554+j1.996801
2.396780+j3.673694

MATLAB verification
>> x=[1 3 2 5];
>> fft(x,8) 11.0000
-0.4142 - 7.6569i
-1.0000 + 2.0000i 2.4142 - 3.6569i -5.0000
2.4142 + 3.6569i
-1.0000 - 2.0000i
-0.4142 + 7.6569i

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT 4
Aim: To find the Impulse response of the given first order / second order
system
Theory:A linear constant coefficient difference equation representing a second order system is
given by y[n] a1 y[n 1] a 2 y[n 2] b0 x[n] b1 x[n 1] b2 x[n 2];
For a first order system the coefficients a2 and b2 are zero.
Since the difference equation contains past samples of output, i.e., y[n-1], y[n-2], its impulse
response is of infinite duration (IIR). For such systems the impulse response is computed for a
large value of N, say N=100 (to approximate n=).
Impulse response implies x[n]= [n], an impulse, and the initial conditions x[-1], x[-2], y[-1] and
y[-2] are zero.
(refer expt 2 &7of part A - h=impz(b,a,N); %impulse response verification in MATLAB)
To implement in C the following algorithm is used.
Algorithm
1. Input the coefficients b0 b1 b2, a1 a2 (Say the coefficients from a 2nd order butterworth filter.
Note coefficient of y[n] is a0=1 always)
2. Generate the impulse input of size n (1st element=1, rest all=0)
3. Compute the output as y[n] a1 y[n 1] a 2 y[n 2] b0 x[n] b1 x[ n 1] b2 x[n 2];
4. Repeat step 3 for n=0 through N (say 50,100, etc)
C Program
#include <stdio.h>
float x[60],y[60];
main()
{
float a1,a2,b0,b1,b2;
int i,j,N=20;
a1= -1.1430; a2= 0.4128;
b0= 0.0675;b1=0.1349;b2=0.0675;
//generate impulse input
x[0]=1;
for(i=1;i<N;i++)
x[i]=0;
//generate output
for(j=0;j<N;j++)
{
y[j]=b0*x[j];
if(j>0)
y[j]=y[j]+b1*x[j-1]-a1*y[j-1];
if ((j-1)>0)
y[j]=y[j]+b2*x[j-2]-a2*y[j-2];
printf("%f \t",y[j]);
}
}
//end of main

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Result (on std out)


0.067500
0.212053 0.282012 0.234804 0.151967 0.076771 0.025017 -0.003096
-0.013866
-0.014571 -0.010931 -0.006479 -0.002893 -0.000632 0.000471 0.000800
0.000720
0.000492 0.000266 0.000100
The plot obtained using graph is shown in Fig. 7.1
MATLAB verification:
[b,a]=butter(2,0.2) //copy the coeffs into C program
x=impz(b,a,20)
x = 0.0675 0.2120 0.2819 0.2347 0.1519 0.0767 0.0250 -0.0031 -0.0139 -0.0146
-0.0109 -0.0065 -0.0029 -0.0006 0.0005 0.0008 0.0007 0.0005 0.0003 0.0001

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 5
Aim: Realization of an FIR filter ( any type ) to meet given specifications. The
input can be a signal from function generator / speech signal .
Pre-requisite: Input is given from the signal generator of amplitude 1 v p-p and frequency > 20
Hz.
DSK kit: Plug in the signal generator o/p to line in and line out of TMS to CRO Before compiling,
Copy header files dsk6713.h and dsk6713_aic23.h from
C:\CCStudio_v3.1\c6000\dsk6713\include and paste it in the current project folder
C Program
#include "FIRcfg.h"
#include "dsk6713.h"
#include "dsk6713_aic23.h"
float filter_Coeff[] ={0.000000,-0.001591,-0.002423,0.000000,0.005728, 0.011139, 0.010502,0.000000, -0.018003,-0.033416,-0.031505,0.000000,0.063010, 0.144802,
0.220534,0.262448,0.220534,0.144802,0.063010,0.000000,-0.031505,-0.033416,
-0.018003, 0 ,0.010502, 0.011139,0.005728,0.000000, -0.002423,-0.001591, 0.0};
static short in_buffer[100];
DSK6713_AIC23_Config config = { \
0x0017,
0x0017,
0x00d8,
0x00d8,
0x0011,
0x0000,
0x0000,
0x0043,
0x0081,
0x0001

/* 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume */ \


/* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\
/* 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */ \
/* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */ \
/* 4 DSK6713_AIC23_ANAPATH Analog audio path control */ \
/* 5 DSK6713_AIC23_DIGPATH Digital audio path control */ \
/* 6 DSK6713_AIC23_POWERDOWN Power down control */
\
/* 7 DSK6713_AIC23_DIGIF
Digital audio interface format */ \
/* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */
\
/* 9 DSK6713_AIC23_DIGACT Digital interface activation */ \

};
/* main() - Main code routine, initializes BSL and generates tone */
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output, r_output;
/* Initialize the board support library, must be called first */
Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


DSK6713_init();

V semester

hCodec = DSK6713_AIC23_openCodec(0, &config); /* Start the codec */


DSK6713_AIC23_setFreq(hCodec, 1);
while(1)
{

/* Read a sample to the left channel */


while (!DSK6713_AIC23_read(hCodec, &l_input));
/* Read a sample to the right channel */
while (!DSK6713_AIC23_read(hCodec, &r_input));
l_output=(Int16)FIR_FILTER(&filter_Coeff ,l_input);
r_output=l_output;
while (!DSK6713_AIC23_write(hCodec, l_output));
/* Send o/p to the left channel */
while (!DSK6713_AIC23_write(hCodec, r_output));
/* Send o/p to the right channel */

}
DSK6713_AIC23_closeCodec(hCodec); /* Close the codec */
}
signed int FIR_FILTER(float * h, signed int x)
{
int i=0; signed long output=0;
in_buffer[0] = x; /* new input at buffer[0] */
for(i=31;i>0;i--)
in_buffer[i] = in_buffer[i-1]; /* shuffle the buffer */
for(i=0;i<31;i++)
output = output + h[i] * in_buffer[i];
return(output);
}
Result: The output plot is observed on the CRO. This behaves as a highpass filter. See the effect
of filtering by giving a sinusoidal input to DSP kit and slowly varying its frequency in the range
from 0 to 3.5 kHz. What is the cutoff frequency of the filter? Change the filter co-efficients for
different types of window & Cut-off frequencies (refer FIR filter design part from experiment 11
in part A-MATLAB)
Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

EXPERIMENT NO 6
Noise removal programs:
(i)

Add noise above 3kHz and then remove (using adaptive filters)

(ii)

Interference suppression using 400 Hz tone

Theory:
In the previous experiments involving IIR & FIR filters, the filter coefficients were
determined before the start of the experiment and they remained constant. Whereas Adaptive filters
are filters whose transfer function coefficients or taps change over time in response to an external
error signal. Typical applications of these filters are Equalization, Linear Prediction, Noise
Cancellation, Time-Delay Estimation, Non-stationary Channel Estimation, etc. Different types of
adaptive filter algorithms are the Kalman adaptive filter algorithm, LMS adaptive filter algorithm
and RLS adaptive filter algorithm.

Fig.6.1 Adaptive Structure for noise cancellation


Fig.6.2 Adaptive Filter (In program the
coefficients (weights) a replaced by
w[T], X0-> delay [0],
Figure 6.1 shows the adaptive structure.
The desired signal d is corrupted by uncorrelated
additive noise n. The input to the adaptive filter is
an noise n that is correlated with the noise n. The noise n could come from the same source as n
but modified by environment. The adaptive filters output y is adapted to the noise n. When this
happens, the error signal approaches the desired signal d. The overall output is this error signal and
not the adaptive filters output y. If d is uncorrelated with n, the strategy is to minimize E(e2).
In the below program, two signals - a desired sinusoidal signal (can be the output of the PC
speaker/ signal generator of square/ sine wave of frequency not correlated to 3kHz and not above
the fsample/2 of the codec) into the Left channel and noise signal of 3KHz into the Right channel
of the Line In are given (generally using two signal generators with common ground is sufficient).

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

C Program
#include "NCcfg.h"
#include "dsk6713.h"
#include "dsk6713_aic23.h"
#define beta 1E-13
//rate of convergence
#define N 30
//adaptive FIR filter length-vary this parameter & observe
float delay[N];
float w[N];
DSK6713_AIC23_Config config = { \
0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume */ \
0x0017, /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\
0x00d8, /* 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */ \
0x00d8, /* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */ \
0x0011, /* 4 DSK6713_AIC23_ANAPATH Analog audio path control */ \
0x0000, /* 5 DSK6713_AIC23_DIGPATH Digital audio path control */ \
0x0000, /* 6 DSK6713_AIC23_POWERDOWN Power down control */
\
0x0043, /* 7 DSK6713_AIC23_DIGIF
Digital audio interface format */ \
0x0081, /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */
\
0x0001 /* 9 DSK6713_AIC23_DIGACT Digital interface activation */ \
};
/* main() - Main code routine, initializes BSL and generates tone*/
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
int l_input, r_input,l_output, r_output,T;
/* Initialize the board support library, must be called first */
DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0, &config); /* Start the codec */
DSK6713_AIC23_setFreq(hCodec, 1);
for (T = 0; T < 30; T++)
{
w[T] = 0;
delay[T] = 0;
}

//Initialize the adaptive FIR coeffs=0


//init buffer for weights
//init buffer for delay samples

while(1)
{
/* Read a sample to the left channel */
while (!DSK6713_AIC23_read(hCodec,&l_input));
/* Read a sample to the right channel */
while (!DSK6713_AIC23_read(hCodec, &r_input));
l_output=(short int)adaptive_filter(l_input,r_input);
r_output=l_output;
while (!DSK6713_AIC23_write(hCodec, l_output));
/* Send o/p to the left channel */
Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


while (!DSK6713_AIC23_write(hCodec, r_output));
/* Send o/p to the right channel*/
}
DSK6713_AIC23_closeCodec(hCodec); /* Close the codec */
}
signed int adaptive_filter(int l_input,int r_input)
{
short i,output;
float yn=0, E=0, dplusn=0,desired,noise;
desired = l_input;
noise = r_input;
dplusn = (short)(desired + noise);
delay[0] = noise;

V semester

//ISR

//desired+noise
//noise as input to adapt FIR

for (i = 0; i < N; i++)


//to calculate out of adapt FIR
yn += (w[i] * delay[i]);
//output of adaptive filter
E = (desired + noise) - yn;
//"error" signal=(d+n)-yn
for (i = N-1; i >= 0; i--)
//to update weights and delays
{
w[i] = w[i] + beta*E*delay[i]; //update weights
delay[i] = delay[i-1];
//update delay samples
}
//output=((short)E);
//error signal as overall output
output=((short)dplusn);//output (desired+noise)
//overall output result
return(output);
}

Result:
Observe the waveform that appears on the CRO screen. Verify that the 3 KHz noise signal is being
cancelled gradually.

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Sample Viva Voce question:


1.

What is MATLAB?

2.

What are the applications of MATLAB?

3.

State sampling theorem.

4.

What is meant by Nyquist rate and Nyquist criteria?

5.

What do you mean Aliasing? What is the condition to avoid aliasing for sampling?

6.

Explain scaling and superposition properties of a system.

7.

What is meant by linearity of a system and how it is related to scaling and superposition?

8.

Explain the statement- t= 0:0.000005:0.05

9.

What is impulse function?

10.

What is meant by impulse response?

11.

What is energy signal? How to calculate energy of a signal?

12.

What is power signal? How to calculate power of a signal?

13.

Differentiate between even and odd signals.

14.

Explain time invariance property of a system with an example.

15.

What is memory less system?

16.

When a system is said to have memory?

17.

What is meant by causality?

18.

Explain linear convolution and circular convolution.

19.

What is the length of linear and circular convolutions if the two sequences are having the
length n1 and n2?

20.

What are Fourier series and Fourier transform?

21.

What are the advantages and special applications of Fourier transform, Fourier series, Z
transform and Laplace transform?

22.

How to perform linear convolution using circular convolution?

23.

What is meant by correlation?

24.

What is auto-correlation?

25.

What is cross-correlation?

26.

What are the advantages of using autocorrelation and cross correlation properties in signal
processing fields?

27.

Differentiate between IIR filters and FIR filters.

28.

What is the procedure to design a digital Butterworth filter?

29.

What is the difference between Butterworth, Chebyshev I and Chebyshev II filters?

30.

What are difference equations and differential equations?

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


31. What is filter?

V semester

32.

What is window method? How you will design an FIR filter using window method.

33.

What are low-pass and band-pass filter and what is the difference between these two?

34.

Explain the command N=ceil(6.6*pi/tb)

35.

What is CCS? Explain in detail to execute a program using CCS.

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57

V semester

Question Bank
PART A:
01. Write a MATLAB program to sample a continuous signal band limited to fm = _____ Hz,
under the following conditions:
a) Under sampling (Half the Nyquist rate)
b) Critical sampling (Nyquist rate)
c) Over sampling (> Twice the Nyquist rate)
02. Compute and verify using MATLAB program for the impulse response of a system described
by the following difference equation.
03. Compute and verify using MATLAB program the linear convolution of two given sequences
with/without using functions.
04. Compute and verify using MATLAB program the circular convolution between the two given
sequences with/without using function file.
05. Compute and verify using MATLAB program for the cross correlation for a given
Sequence.
06. Compute and verify using MATLAB program for the auto correlation for a given
Sequence.
07. Obtain the solution of the following difference equation for an arbitrary input x(n) and verify
using MATLAB program.
y (n) + 0.7 y(n-1) 0.45 y(n-2) 0.6 y(n-3) = 0.8 x(n) 0.44 x(n-1) + 0.36
x(n-2) + 0.02 x(n-3)
a) Calculate and plot the impulse response h (n) at n = 0:40
b) Calculate and plot the unit step response h (n) at n = 0:40
08. Compute and verify using MATLAB program the solution of a difference equation given the
initial conditions:
Difference equation is y(n) 1.5 y(n-1) + 0.5 y(n-2) = x(n), n>0 and given that
x(n) = (1/4) ^ n u(n) subject to y(-1) = 4 and y(-2) = 10. plot the output.
09. Compute and verify using MATLAB program the N point DFT of a given sequence and plot
its magnitude and phase spectrum.
10. Compute and verify using MATLAB program the N point IDFT of a given sequence and plot
its magnitude and phase spectrum.
11. Compute and verify using MATLAB program the linear convolution between the two given
sequences using DFT and IDFT.
12. Compute and verify using MATLAB program the circular convolution between the two given
sequences using DFT and IDFT.

Dept. of TCE, Dr.AIT

17

Digital Signal Processing Lab Manual -- 06ECL57


V semester
13. Design and implement a digital IIR low pass Butterworth filter using bilinear transformation
method.
14. Design and implement a digital IIR low pass Chebyshev filter using bilinear transformation
method.
15. Design and implement a digital FIR low pass filter using Hamming Window.

PART B:
01. Compute and verify using C program the linear convolution of the two given sequences.
02. Compute and verify using C program the circular convolution of the two given sequences.
03. Compute a verify using C program the DFT of a given sequence.
04. Compute and verify using C program to find the impulse response of the given first / second
order system.
05. Compute and verify using C program to Realization of an FIR filter (any type) to meet given
specifications .The input can be a signal from function generator / speech signal.

Dept. of TCE, Dr.AIT

17

Anda mungkin juga menyukai