5 DSP Final
5 DSP Final
5 DSP Final
2. General information
Index
3.1 Experiment-1
Extended Precision Addition & Subtraction of Two 64-Bit
Numbers Using DSP Trainer Kit.
3.2 Experiment-2
Multiplication & Convolution of Two 64-Bit Numbers Using
DSP Trainer Kit.
3.3 Experiment-3
To Plot Signals Both Continuous & Discrete Using
MATLAB.
3.4 Experiment-4
To Get Linear Convolution of Any Two Given Sequences(
Basically of Two 1x3 Matrix) Using MATLAB
3.5 Experiment-5
To Perform Auto Co-Relation of Any Two Given Sequences
(Basically Of Two 1x3 Matrix) Using MATLAB
3.6 Experiment-6
To Perform Cross Co-Relation of Any Two Given Sequences
(Basically of Two 1x3 Matrix) Using MATLAB
3.7 Experiment-7
To Perform Circular Convolution of Two Sequences Using
MATLAB.
3.8 Experiment-8
To Design A Fir Low pass Filter Using Different Windows
Technique.(Hamming, Blackman, Rectangular, Kaiser)
3.9 Experiment-9
To Design Butter worth Low Pass Filter For Given
Specifications
3.10 Experiment-10
To Design Butter worth High Pass Filter For Given
Specifications
1
GENERAL INSTRUCTION
INTRODUCTION:
GENERAL INFORMATION:
Students must turn up in time and contact concerned faculty for the experiment
they are supposed to perform.
Students will not be allowed after ten minutes from the scheduled time.
Attendance in the laboratory is compulsory. For any absence, students have to
write an application with sufficient reasons and proof as per the BPUT rules and
regulation & may be allowed with permission of concerned HOD.
Students will not leave the class till the period is over.
Students should come prepared for their experiment with lab record.
2
Experimental results should be entered in the lab. Record and certified /signed by
concerned faculty/lab instructor.
Students must get the connection of experimental setup verified before switching
on the power supply.
After the experiment is over, the experimental kits/modules. Measuring tools and
any other tools for the experiments should be returned to the lab instructor.
Students should maintain silence while performing the experiments. If necessity
arises for discussion amongst them, they should discuss with a very low pitch
without disturbing the adjacent groups.
Students should not unnecessarily fiddle with the instruments knob or any other
pot. In the instruments which may disturb the calibration accuracy, range or zero
etc.
Violating the above code of conduct may attract disciplinary action.
ATTENDANCE:
Students should come to the lab thoroughly prepared on the experiments they are
assigned to perform on that day.
Faculty may check their preparation and understanding of the experiments. If not
found satisfactory, students may be debarred from doing the experiments.
Students should record the experimental results and observation in the lab.
Record.
3
Students must bring the Record (fair and rough) on each practical class with
written records of the last experiments performed complete in all respect.
Students without Record will not be allowed to do the experiments and hence
loose their attendance.
Any instrument damaged or tools lost during experiments may attract punishment
in the form of fine or suspension from class.
LAB REPORTS:
Each student is required to write a complete report of the experiment he/she has
performed and bring to lab class for evaluation in the next working lab.
Report should be written very clearly and lab record should be maintained neatly.
The lab must contain the following
Duly completed title page.
Each report should include connection diagram (where applicable),
graphs, trace papers, equations, calculations, flow charts etc.
Standard symbols should be used to draw the diagrams.
Calculations and comparison with appropriate equations and comments.
Observation can be included explaining your experience in conducting
the experiments.
PRECAUTION:-
Switch on the PC and turn off at the end of the lab properly with switching
off the UPS.
Outside floppy disks, CDs and pen drives are strictly prohibited without
prior permission of the concerned faculty to avoid virus infection.
Choose the block parameters of simulink suitably to get proper waveform
and results.
Connect the cables properly to get the desired result.
4
BHUBANESWAR COLLEGE OF ENGINEERING, BHUBANESWAR
Department of Electronics and Communication Engineering
INTRODUCTION:
It is needless to say that in order to utilize the full feature of the DSP chip
TMS320C50, the DSP engineer must have a complete knowledge of the DSP device.
This chapter is an introduction to the hardware aspects of the TMS320C50. The
important units of TMS320C50 are discussed.
The TMS320C50 is a 16- bit fixed point digital signal processor that combines the
flexibility of a high speed controller with the numerical capability of an array processor,
thereby offering an in expensive alternative to mustachio bit slice processors.
The TMS320C50 optimizes speed by implementing functions in hardware that other
processor implement through microcode or software. This Hardware intensive approach
provides the design engineer with processing power previously unavailable on a single
chip. The TMS320C50is the third generation digital signal processor in TMS320C50
family, its powerful instruction set, inherent flexibility, high speed number-crunching &
innovative architecture have made this high – performance, cost-effective processor the
ideal solution to many telecommunications, computer, commercial industrial, & military
application.
5
* 224K x 16 – bit maximum addressable external memory space (64K program, 64K
data, 64K I /O, & 32K global)
* 32- bit arithmetic logic unit (ALU), 32-bit accumulator (ACC), & 32-bit accumulator
buffer (ACCB).
* 16-bit parallel logic unit (PLU)
* 16x16-bit parallel multiplier with a 32-bit product capability.
* Single-cycle multiply/accumulate instructions
* Eight auxiliary registers with a dedicated auxiliary register arithmetic unit for indirect
addressing.
* Eleven context-switch registers (shadow registers) for storing strategic CPU-controlled
registers during an interrupt service routine.
* Eight-level hardware stack
* 0-to 16-bit left and right data barrel-shifters & a 64-bit incremental data shifter
* Two indirectly addressed circular buffers for circular addressing
* Single-instruction repeat & block repeat operations for program code
* Block memory move instructions for better program/data management
* Full-duplex synchronous serial port for direct communication between the C5x &
another serial device
* Time-division multiple-access (TDM) serial port
* Interval timer with period, control, & counter registers for software stop, start, & reset
* 64K parallel I/O ports, 16 of which are memory mapped
*Sixteen software programmable wait- state generators for programs, data, & I/O
memory spaces.
ARCHITECTURE:
32-BIT ACCUMMULATOR:
The TMS320C50 contains a 32-bit ALU & accumulator for support of double-
precision, two’s complement arithmetic. The ALU is a general purpose arithmetic unit
that operates on 16-bit words taken from the data RAM or derived from immediate
instructions. In addition to the usual arithmetic instructions, the ALU can perform
Boolean operations, providing the bit manipulation ability required of a high-speed
controller. The accumulator stores the output from the ALU & is often an input to the
ALU. Its word length is 32-bit. The accumulator divided into a high-order word (bits 31
6
through 16) & a low- order word (bits 15 through 0). Instructions are provided for storing
& loading the high & lower order accumulator words to memory.
The multiplier performs a 16 x 16- bit two’s complement multiplication with a 32-bit
result in a single instruction cycle. The multiplier consists of three units: the T-registers,
P-register, & multiplier array. The 16-bit T-Register temporarily stores the multiplicand&
the P-Register stores the 32-bit product. Multiplier values either come from the data
memory or are derived immediately from the MPY (multiply immediate) instruction
word. The fast on-chip multiplier allows the device to perform fundamental operations
such as convolution, correlation, & filtering. Two multiply/ accumulate instructions in the
instruction set fully utilize the computational bandwidth of the multiplier, allowing both
operands to be processed simultaneously.
SHIFTERS:
A 16-bit scaling shifter is available at the accumulator input. This shifter produces left
shift of 0 to 16-bits on the input data to accumulator.
TMS320C50 also contains a shifter at the accumulator output. This shifter provides a left
shift of 0 to 7, on the data from either the ACCH or ACCL register. In addition one
shifter at the P-register can shift the product by 1 or 4-bits left or 6-bits right, before
transferring the product to accumulator.
Since the TMS320C50 uses Harvard architecture, data and program memory reside in
two separate spaces. Additionally TMS320C50 is 64kKW each of program, Data and I/O
memory. The 64KW of data memory is divided into 512 pages with each page containing
128 words. Only one page can be active at a time. One data page selection is done by
setting data single access Data/Program RAM. The1056 words of on chip data memory is
divided as three blocks B0, B1, & B2, of which B0 can be configured as program or data
RAM.
Out of the 64KW of total program memory, TMS320C50 has 2K words of on-chip
program ROM.
The TMS320C50 offers two modes of operation defined by the state of the MC/MP pin,
the microcomputer mode, on-chip ROM is mapped into the memory space with up to 2K
words of memory available. In the microprocessors mode all 64K words of program
memory are external.
7
BHUBANESWAR COLLEGE OF ENGINEERING, BHUBANESWAR
Department of Electronics and Communication Engineering
EXPERIMENT NO- 01
AIM OF THE EXPERIMENT: -
Write a program for extended precision addition of two 64-bit numbers & Write a
program for extended precision subtraction of two 64-bit numbers.
EQUIPMENTS REQUIRED:-
I) ADDITION .
PROGRAM: -
8
I NPUT: -
[8000]: -? [8004]: -?
[8001]: -? [8005]: -?
[8002]: -? [8006]: -?
[8003]: -? [8007]: -?
OUTPUT: -
[8008]: -? [800A]: -?
[8009]: -? [800B]: -?
CONCLUSION: -
9
II) SUBTRACTION
PROGRAM: -
ADDRESS OPCODE MNEMONICS OPERAND
C000 BD00 LDP #100H
C001 6A01 LACC 0001,10
C002 6200 ADDS 0000
C003 6604 SUBS 0004
C004 6505 S UB 0005,10
C005 9008 SACL 0008
C006 9809 SACH 0009
C007 1002 LACC 0002,0
C008 6406 SUBB 0006
C009 6103 ADD 0003,10
C00A 6507 SUB 0007,10
C00B 900A SACL 000A, 0
C00C 980B SACH 000B, 0
C00D 7980 B C00D
I NPUT: -
[8000]: -? [8004]: -?
[8001]: -? [8005]: -?
[8002]: -? [8006]: -?
[8003]: -? [8007]: -?
OUTPUT: -
[8008]: -? [800A]: -?
[8009]: -? [800B]: -?
CONCLUSION: -
10
BHUBANESWAR COLLEGE OF ENGINEERING, BHUBANESWAR
Department of Electronics and Communication Engineering
EXPERIMENT NO:-02
EQUIPMENTS REQUIRED:-
I) MULTIPLICATION:
PROGRAM: -
11
I NPUT: -
[8000]: - 37A
[8001]: - 12E
OUTPUT: -
[8002]: -?
[8003]: -?
CONCLUSION: -
The result of multiplication of two numbers 037A and 012E is stored in memory location
8002H and 8003H.
12
II)LINEAR CONVOLUTION :
PROGRAM:
ADDRESS OPCODE MNEMONICS OPERAND
C000 BC02 LDP #0002H
C001 BF0B, 8200 LAR 3, #8200H
C003 B407 LAR 4, #0007
C004 BF09, 8100 LAR 1, #8100H
C006 8B89 MAR *, 1
C007 10A0 LACC *+
C008 9050 SACL 050H
C009 BF0A, 0153 LAR 2,0153H
C00B 8B8A MAR *, 2
C00C BE59 ZAP
C00D BB03 RPT #0003
C00E A390, C100 MACD 0C100, *-
C010 BE04 APAC
C011 8B8B MAR *, 3
C012 90A0 SACL *+
C013 8B8C MAR *, 4
C014 7B90,C006 BANZ C006, *-
C016 7980 B C016
C017 C016
I NPUT: -
X (n) data memory H (n) program memory
[8100] = 0001 [c100] = 0001
[8101] = 0003 [c101] = 0002
[8102] = 0001 [c102] = 0001
[8103] = 0003 [c103] = 0000
OUTPUT: -
[8200] =?
[8201] =?
[8202] =?
[8203] =?
[8204] =?
[8205] =?
[8206] =?
CONCLUSION: -
Hence the illustration of Linear Convolution is done..
13
BHUBANESWAR COLLEGE OF ENGINEERING, BHUBANESWAR
Department of Electronics and Communication Engineering
EXPERIMENT NO- 03
i) Matlab R2010A
ii) Personal Computer (Dual Core, 2GB RAM)
iii) Plat form – Window 2010
THEORY:
Signal:- A signal is defined as any physical quantity that varies with time,space,or any
other independent variable.
Example:-x(t)=t2+5
Signals can be of two types.
i) Continuous time signal
ii) Discrete time signal
i) Continuous Time Signal: A signal that varies continuously with time is called
continuous time signal. It is represented as x(t),where t is independent variable. For
example- sinusoidal signal.
14
ii)Discrete Time Signal: Asignal that has values at discrete instants of time is known as
discrete time signal. The signal is not defined for fractional or non-integer value of time.
It can be obtained by sampling a continuous signal.
PROGRAM:
clc
clear all
%Program to create Discrete time signal
%Program to generate unit step function
a=[zeros(1,50),ones(1,51)];
x=[-50:1:50];
subplot(2,2,1)
stem(x,a)
xlabel('n')
ylabel('u(n)')
title('unit step function')
%Program to create unit impulse function
a=[zeros(1,15),1,zeros(1,15)]
x=[-15:1:15]
15
subplot(2,2,2)
stem(x,a)
xlabel('n')
ylabel('unitimpulse')
title('unit impulse sequence')
%Program to generate unit ramp signal
a=[zeros(1,5),0:10];
x=-5:1:10;
subplot(2,2,3)
stem(x,a)
xlabel('n')
ylabel('Ur(n)')
title('unit ramp function')
%Program to create continuous signal(sinosodial)
t=linspace(0,2*pi,90)
x=sin(2*t)
subplot(2,2,4)
plot(t,x)
xlabel('t')
ylabel('sint')
title('continuous signal')
CONCLUSION
The signals both discrete and continuous forms are generated and printed
16
BHUBANESWAR COLLEGE OF ENGINEERING, BHUBANESWAR
Department of Electronics and Communication Engineering
EXPERIMENT NO- 04
AIM OF THE EXPERIMENT:-
OBJECTIVES:-
i) Generate a random signal ‘x’ and a system impulse response ‘h’ with a nr of
samples.
ii) Find the convolution sum without using the inbuilt matlab function ‘conv’
iii) Plot the output ‘y’ using stem command and take printout of it.
THEORY:
The formula that gives the response y(n) of the LTI system as a function of the input
signal x(n) and the unit sample (impulse) response h(n) is called a convolution sum.We
say that the input x(n) is convoluted with the impulse response h(n) to yield the output
y(n).
Convolution between x(n) and h(n) is represented as y(n)=x(n)*h(n),where ‘*’ denotes
convolution operation.
Mathematically convolution is represented as
∞
y(n)= ∑ x(k)h(n-k)
k=-∞
17
Process to compute convolution :-
i) Commutative law-
x(n)*h(n)=h(n)*x(n)
ii)Associative law-
[ x(n)*h1(n)]*h2(n)= x(n)*[h1(n)*h2(n)]
iii)Distributive law-
x(n)*[h1(n)+h2(n)]= x(n)*h1(n)+x(n)*h2(n)
PROGRAM: -
clc
clear all
x=input('enter the 1st seq')
h=input('enter the second seq')
m=length(x)
p=length(h)
n=m+p-1
x=[x,zeros(1,p-1)]
z=zeros(1,p)
for i=1:n
for j=p:-1:2
z(j)=z(j-1)
end
z(1)=x(i)
sum=0
for k=1:p;
sum=sum+z(k)*h(k)
end
18
y(i)=sum
end
disp('the result is');y
subplot(3,1,1)
stem(x)
xlabel('time')
ylabel('amp')
title('x(n)')
subplot(3,1,2)
stem(h)
xlabel('time')
ylabel('amp')
title('h(n)')
subplot(3,1,3)
stem(y)
title('y(n)')
CONCLUSION: -
We got the result of linear convolution of two sequences and printed the output.
19
BHUBANESWAR COLLEGE OF ENGINEERING, BHUBANESWAR
Department of Electronics and Communication Engineering
EXPERIMENT NO-05
OBJECTIVES:-
i) To generate two sequences x1 & x2 containing a number of samples.
ii) To find circular convolution between x1 &x2 using matlab applying the logic of
concentric circle method.
iii) To plot x1,x2 and circular convolution of both.
THEORY:
If x1(n) &x2(n) are two sequences having L&M number of samples respectively then
circular convolution between x1(n) &x2(n) is denoted as
x3(n)= x1(n) N x2(n) and x3(n) contains max(L,M) number of samples.
Two methods are there, Concentric circle method and Matrix multiplication method.
It can not be used to find the response of a filter without zero padding.
PROGRAM
20
%Circuar convolution of two sequencel
clc
clear all
x1=input('enter the first sequence')
x2=input('enter the second sequence')
n1=length(x1)
n2=length(x2)
n=max(n1,n2)
n3=n1-n2
if n3>0
x2=[x2,zeros(1,n3)]
else
x1=[x1,zeros(1,-n3)]
end
for a=1:n
y(a)=0
for i=1:n
j=a-i+1
if(j<=0)
j=n+j
end
y(a)=y(a)+(x1(i)*x2(j))
end
end
disp('result is');y
subplot(3,1,1)
stem(x1)
xlabel('n')
ylabel('x1(n)')
title('input x1(n)')
subplot(3,1,2)
stem(x2)
xlabel('n')
ylabel('x2(n)')
title('input x2(n)')
subplot(3,1,3)
stem(y)
xlabel('n')
ylabel('y(n)')
title('output y(n)')
21
CONCLUSION: -
We got the result of linear convolution of two sequences and printed the output.
22
BHUBANESWAR COLLEGE OF ENGINEERING, BHUBANESWAR
Department of Electronics and Communication Engineering
EXPERIMENT NO-06
OBJECTIVES:-
i) To generate two sequences x1 & x2 containing a number of samples.
ii) To find circular convolution between x1 &x2 using function file and script file.
iii) To find linear convolution between the same two sequences.
iv) To plot both linear and circular convolution.
THEORY
Linear Convolution-
i) If x(n) has ‘l’ samples and h(n) has’m’samples then y(n) result has ‘m+l-1’
number of samples.
ii) There is no modulo-N operation.
iii) It is used to find the response of a filter.
Circular convolution-
i) Here output y(n) has max(l,m) number of samples .
ii) Shifting operation is done here in circular manner by computing index of one
23
iii) sequense modulo N.
iv) It cann’t be used to find response of a filter without zero padding.
PROGRAM
% FUNCTION FILE
function y=my_circonv(x1,x2)%function file declaration
%This gives circular convolution of x1,x2
%To call this:-y=my_circonv(x1,x2)
%The file is stored under the function name(my_circonv)
%y=output,x1=input,x2=input
n1=length(x1)
n2=length(x2)
n=max(n1,n2)
n3=n1-n2
if n3>0
x2=[x2,zeros(1,n3)]
else
x1=[x1,zeros(1,-n3)]
end
for a=1:n
y(a)=0
for i=1:n
j=a-i+1
if(j<=0)
j=n+j
end
y(a)=y(a)+(x1(i)*x2(j))
end
end
disp('result is');y
%SCRIPT FILE
%Comparision between circular & linear convolution
%This is a script file
24
stem(x4)
xlabel('n')
ylabel('x3(n)')
title('circular conv')
CONCLUSION: -
We got the result of linear convolution of two sequences and circular convolution of two
sequences and printed the both.
25
BHUBANESWAR COLLEGE OF ENGINEERING, BHUBANESWAR
Department of Electronics and Communication Engineering
EXPERIMENT NO:- 06
or equivalently as as
n=∞
rxy(l)= ∑x(n+l)y(n) l=0,±1, ±2,…
n=-∞
The index l is the (time) shift(or lag) parameter and subscripts xy in the cross correlation
sequence rxy(l) indicate the sequences being correlated.The order of subscripts with x
proceeding y,indicates the direction in which one sequence is shifted related to the other.
Properties-
rxy(l)= ryx(-l)
Relation between convolution and correlation-
26
rxy(l)= x(l)*y(l)
PROGRAM:-
%Cross correlation between two sequence
clc
clear all
x=input('enter the first sequence')
y=input('enter the second sequence')
r=xcorr(x,y)
subplot(3,1,1)
stem(x)
xlabel('n')
ylabel('x(n)')
title('input x(n)')
subplot(3,1,2)
stem(y)
xlabel('n')
ylabel('y(n)')
title('input y(n)')
subplot(3,1,3)
stem(r)
xlabel('n')
ylabel('rxy(l)')
title('cross correlation')
CONCLUSION: -
We got the cross correlation of two sequences and the output is printed.
27
AIM OF THE EXPERIMENT:
To perform auto correlation of any two sequences using matlab.
OBJECTIVES:-
i) To generate a sequences containing a number of samples and to find auto
correlation using xcorr(A, A).
ii) To plot auto correlation.
or equivalently
n=∞
rxx(l)= ∑x(n+l)x(n) l=0,±1, ±2,…
n=-∞
Properties-
rxx(l)= rxx(-l)
Relation between convolution and correlation-
rxx(l)=x(l)*x(-l)
PROGRAM:-
%Auto correlation between two sequence
clc
clear all
x=input('enter the input sequence')
r=xcorr(x,x)
subplot(2,1,1)
stem(x)
28
xlabel('n')
ylabel('x(n)')
title('input x(n)')
subplot(2,1,2)
stem(r)
xlabel('n')
ylabel('rxy(l)')
title('Auto correlation')
PLOTS FOR AUTO CORRELATION
CONCLUSION: -
We got the auto correlation of two sequences and the output is printed.
29
BHUBANESWAR COLLEGE OF ENGINEERING, BHUBANESWAR
Department of Electronics and Communication Engineering
EXPERIMENT NO:- 07
OBJECTIVES:-
THEORY:
Let x1(n) and x2(n) are finite duration sequences both of length N with DFTs X1(k)
and X2(k). Now we find a sequence x3(n) for which the DFT is X3(k).
where
X3(k).= X1(k) X2(k) …(i)
We know
N-1
x3((n))N= ∑ x1((m))Nx2((n-m))N
m=0
For 0≤n≤N-1, x3((n))N =x3(n),similarly x1((m))N= x1(m)
30
So N-1
x3(n)= ∑ x1(m)x2((n-m))N …(ii)
m=0
Eq.(ii) represents the circular convolution of x1(n) and x2(n) represented as
PROGRAM:-
%Circular convolution using DFT
clc
clear all
x1=input('enter the first sequence')
x2=input('enter the second sequence')
n1=length(x1)
n2=length(x2)
n4=max(n1,n2)
n=n1-n2
if n>0
x2=[x2,zeros(1,n)]
else x1=[x1,zeros(1,-n)]
end
X1=fft(x1,n4)
X2=fft(x2,n4)
X3=X1.*X2
n3=length(X3)
x3=ifft(X3,n3)
subplot(3,1,1)
stem(x1)
xlabel('n')
ylabel('x1(n)')
title('first input sequence')
subplot(3,1,2)
stem(x2)
xlabel('n')
ylabel('x2(n)')
31
title('Second input sequence')
subplot(3,1,3)
stem(x3)
xlabel('n')
ylabel('x3(n)')
title('Circonv output sequence')
CONCLUSION:
We obtain the result of circular convolution using DFT method.
32
BHUBANESWAR COLLEGE OF ENGINEERING, BHUBANESWAR
Department of Electronics and Communication Engineering
EXPERIMENT NO-08
i) Matlab R2010A
ii) Personal Computer (Dual Core, 2GB RAM)
iii) Plat form – Windows 2010
THEORY:
A filter may be required to have a given frequency response or a specific response to an
impulse,step,ramp or simulate an analog signal.Digital filters areclassified as either FIR
or IIR.
The response of FIR filters depends only on the present and past input samples.
FIR filters have an exact linear phase,are always stable,the design methods are generally
linear,they can be realized efficiently in hardware.
The filter start up duration are finite.FIR filters are employed in filtering problems
where linear phase characteristics within the passband of the filter is required.
Linear phase filters are those filters in which the phase delay and group are constant.
MATLAB KEYWORDS USED
33
PROGRAMS:-
34
PLOTS FOR FIR LOWPASS FILTER
35
plot(w/(2*pi),grd);grid
title('group delay')
xlabel('frequency in pi units')
ylabel('delay in sample')
36
37
%Designof Fir bandstop/bandreject filter
clc
clear all
w1=triang(42+2)
wn=[0.5 0.8]
b=fir1(41,wn,'stop')
a=1
[H,w]=freqz(b,a)
mag=abs(H)
db=20*log((mag+eps)/max(mag))
pha=angle(H)
grd=grpdelay(b,a,w)
subplot(2,2,1)
plot(w/(2*pi),mag);grid
title('magnitude response')
subplot(2,2,2)
plot(w/(2*pi),db);grid
title('log magnitude response')
xlabel('frequency in pi units')
ylabel('db')
subplot(2,2,3)
plot(w/(2*pi),pha);grid
title('phase response')
xlabel('frequency in pi units')
ylabel('phase in pi units')
subplot(2,2,4)
plot(w/(2*pi),grd);grid
title('group delay')
xlabel('frequency in pi units')
ylabel('delay in sample')
38
PLOTS FOR FIR BANDSTOP FILTER
CONCLUSION: -
By conducing this experiment we plotted response of various filter types.
39
BHUBANESWAR COLLEGE OF ENGINEERING, BHUBANESWAR
Department of Electronics and Communication Engineering
EXPERIMENT NO-09
AIM OF THE EXPERIMENT:-
OBJECTIVES:-
THEORY:
Infinite impulse response(IIR) filters are a type of digital filters.Thus the design of an
IIR filter involves design of a digital filter in analog domain and transforming the design
in digital domain.IIR filter can be designed by using the impulse invariance method.Here
the desired impulse response of a digital filter is obtained by uniformly sampling impulse
response of equivalent analog filter.
IIR filters can be designed using the bilinear trans formation technique.The
magnitude response of Chebyshev filter has equiripple passband maximally flat
stopband.By increasing the filter order N, the Chebyshev response approximates the ideal
response.The phase response of Chebyshev filteris more nonlinear than the Butterworth
filter for a given filter length ‘N’.
40
ix)freqz x) cheb10rd xi)cheby1
PROGRAM: -
%Design of Chebyshev filter
clc
clear all
wp=0.6*pi
ws=0.4586
rp=1
rs=15
%To find order and frequency
[N,wn]=cheb1ord((wp/pi),(ws/pi),rp,rs)
%To design the filter
[b,a]=cheby1(N,rp,wn,'high')
[H,w]=freqz(b,a)
mag=abs(H)
db=20*log((mag+eps)/max(mag))
pha=angle(H)
grd=grpdelay(b,a,w)
subplot(2,2,1)
plot(w/(2*pi),mag);grid
title('magnitude response')
subplot(2,2,2)
plot(w/(2*pi),db);grid
title('log magnitude response')
xlabel('frequency in pi units')
ylabel('db')
subplot(2,2,3)
plot(w/(2*pi),pha);grid
title('phase response')
xlabel('frequency in pi units')
ylabel('phase in pi units')
subplot(2,2,4)
plot(w/(2*pi),grd);grid
title('group delay')
xlabel('frequency in pi units')
ylabel('delay in sample')
41
PLOTS FOR CHEBYSHEV FILTER
CONCLUSION: -
We got the magnitude and phase response of Chebyshev filter and the output is printed
42
BHUBANESWAR COLLEGE OF ENGINEERING, BHUBANESWAR
Department of Electronics and Communication Engineering
EXPERIMENT NO-10
AIM OF THE EXPERIMENT
To find linear convolution of two sequences using overlap save method.
OBJECTIVES:-
i) To generate a random sequence.
ii) To find linear convolution using overlap save method
PROGRAM: -
%Function file for overlap save
function y=ovrlsav(x,h,N)
if(N<length(h))
error('N must be >=length(h)')
end
Nx=length(x)
M=length(h)
M1=M-1
L=N-M1
x=[zeros(1,M-1),x,zeros(1,N-1)]
43
h=[h zeros(1,N-M)]
k=floor((Nx+M1)/(L))
Y=zeros(k+1,N)
for k=0:k
xk=x(k*L+1:k*L+N)
y(k+1,:)=circonv(xk,h,N)
end
y=y(:,M:N)'
y=(y(:))'
%Script file
44
x=[3 -1 0 1 3 2 0 1 2 1]
h=[1 1 1]
N=5
y=ovrlsav(x,h,N)
CONCLUSION: -
We got the result of circular convolution using overlapsave method
45