DSP LAB
DSP LAB
NO:1
DATE:
INTRODUCTION TO MATLAB
AIM:
To familiarise with MATLAB software, general functions and signal
processing toolbox functions
THEORY:
The name MATLAB stands for MATrix LABoratory produced by
Mathworks Inc., USA. It is a matrix-based
powerful software package for scientific and engineering computation and
visualization. Complex numerical problems
can be solved in a fraction of the time that required with other high level
languages. It provides an interactive environment
with hundreds of built -in –functions for technical computation, graphics and
animation. In addition to built-in-functions,
user can create his own functions.
MATLAB offers several optional toolboxes, such as signal processing,
control systems, neural networks etc.
It is command driven software and has online help facility.
MATLAB has three basic windows normally; command window, graphics
window and edit window.
Command window is characterized by the prompt ‘>>’.
All commands and the ready to run program filename can be typed here.
Graphic window gives the display of the figures as
the result of the program. Edit window is to create program files with an
extension .m.
Some important commands in MATLAB
Help List topics on which help is available
Help command name Provides help on the topic selected
Demo Runs the demo program
Who Lists variables currently in the workspace
Whos Lists variables currently in the workspace with their size
Clear Clears the workspace, all the variables are removed
Clear x,y,z Clears only variables x,y,z
Quit Quits MATLAB
1
Some of the frequently used built-in-functions in Signal Processing
Toolbox
filter(b.a.x) Syntax of this function is Y = filter(b.a.x)
It filters the data in vector x with the filter described by vectors
a and b to create the filtered data y.
fft (x) It is the DFT of vector x
ifft (x) It is the DFT of vector x
conv (a,b) Syntax of this function is C = conv (a,b)
It convolves vectors a and b. The resulting vector is of
Length, Length (a) + Length (b)-1
deconv(b,a) Syntax of this function is [q,r] = deconv(b,a)
It deconvolves vector q and the remainder in vector r such that
b = conv(a,q)+r
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.
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 rad/sec)
Cheby1(N,R,Wn) designs an Nth order lowpass digital
Chebyshev filter with R decibels of peak-to-peak ripple in the
passband. CHEBY1 returns the filter coefficients in length N+1
vectors B (numerator) and A (denominator). The cutoff frequency
Wn must be 0.0 < Wn < 1.0, with 1.0 corresponding to half the
sample rate.
Cheby1(N,R,Wn,'high') designs a highpass filter.
Cheb1ord(Wp, Ws, Rp, Rs) returns the order N of the lowest
order digital Chebyshev Type I 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)
cheby2(N,R,Wn) designs an Nth order lowpass digital
Chebyshev filter with the stopband ripple R decibels down and
stopband edge frequency Wn. CHEBY2 returns the filter
2
coefficients in length N+1 vectors B (numerator) and A .
The cutoff frequency Wn must be 0.0 < Wn < 1.0, with 1.0 corresponding
to half the sample rate.
cheb2ord(Wp, Ws, Rp, Rs) returns the order N of the lowest
order digital Chebyshev Type II 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,
abs(x) It gives the absolute value of the elements of x. When x is
complex, abs(x) is the complex modulus (magnitude)
of the elements of x.
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.
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 rad/sec)
Cheby1(N,R,Wn) designs an Nth order lowpass digital
Chebyshev filter with R decibels of peak-to-peak ripple in the
passband. CHEBY1 returns the filter coefficients in length N+1
vectors B (numerator) and A (denominator). The cutoff frequency
Wn must be 0.0 < Wn < 1.0, with 1.0 corresponding to half the
sample rate.
Cheby1(N,R,Wn,'high') designs a highpass filter.
Cheb1ord(Wp, Ws, Rp, Rs) returns the order N of the lowest
order digital Chebyshev Type I 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)
cheby2(N,R,Wn) designs an Nth order lowpass digital
Chebyshev filter with the stopband ripple R decibels down and
stopband edge frequency Wn. CHEBY2 returns the filter
coefficients in length N+1 vectors B (numerator) and A .
The cutoff frequency Wn must be 0.0 < Wn < 1.0, with 1.0 corresponding
to half the sample rate.
3
cheb2ord(Wp, Ws, Rp, Rs) returns the order N of the lowest
order digital Chebyshev Type II 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,
abs(x) It gives the absolute value of the elements of x. When x is
complex, abs(x) is the complex modulus (magnitude)
of the elements of x.
RESULT:
Thus the details about MATLAB software is studied.
4
EX. NO:2
DATE:
WAVEFORM GENERATION
AIM:
Write a program in MATLAB to generate the following waveforms
(Discrete – Time signal)
APPARATUS REQUIRED:
Pentium 4 Processor, MATLAB software
THEORY:
Real signals can be quite complicated. The study of signals therefore
starts with the analysis of basic and fundamental signals. For linear systems,
a complicated signal and
its behaviour can be studied by superposition of basic signals. Common
basic signals
are:
5
n, for n 0
x ( n) r ( n)
Unit ramp sequence. 0, otherwise
Sinusoidal sequence. x(n) A sin(n ) .
ALGORITHM/PROCEDURE:
1. Start the program
2. Get the inputs for signal generation
3. Use the appropriate library function
4. Display the waveform
7
FLOWCHART:
START
STOP
RESULT:
The program to generate various waveforms is written, executed
and the
output is verified.
8
EX. NO:3
DATE:
CONVOLUTION OF SIGNALS
AIM:
TO write a MATLAB program to compute convolution of two given
sequences
APPARATUS REQUIRED:
Pentium 4 Processor, MATLAB software
PROCEDURE:
Open MATLAB
Open new M-file
Type the program
Save in current directory
Compile and Run the program
For the output see command window\
Figure window
ALGORITHM:-
9
PROGRAM:
LINEAR CONVOLUTION:
CIRCULAR CONVOLUTION:
FLOWCHART:
START
STOP
12
13
RESULT:
Thus the linear and circular convolution signal is generated and
verified
by MATLAB.
EX. NO: 4
DATE:
SAMPLING RATE CONVERSION
AIM:
Write a MATLAB Script to perform sampling rate conversion
for any given arbitrary sequence (D.T) or signal (C.T) by
interpolation, decimation, upsampling, downsampling and
resampling (i.e. fractional value)
.
APPARATUS REQUIRED:
PC, MATLAB software
THEORY:
SAMPLING PROCESS:
14
It is a process by which a continuous time signal is converted
into discrete time signal. X[n] is the discrete time signal obtained by
taking samples of the analog signal x(t) every T seconds, where T is
the sampling period.
X[n] = x (t) x p (t)
Where p(t) is impulse train; T – period of the train
SAMPLING THEOREM:
It states that the band limited signal x(t) having no frequency
components above Fmax Hz is specified by the samples that are taken
at a uniform rate greater than 2 Fmax Hz (Nyquist rate), or the
frequency equal to twice the highest frequency of x(t).
Fs ≥ 2 Fmax
ALGORITHM/PROCEDURE:
1. Generate a sinusoidal waveform
2. Using the appropriate library function for
interpolation ,decimation ,upsampling ,
downsampling and resampling, perform sampling rate
conversion for the sinusoidal waveform
3. Find the spectrum of all the signals and compare them in
frequency domain.
4. Display the resultant waveforms
Source code :
15
clc;
clear all;
close all;
%continuous sinusoidal signal
a=input('Enter the amplitude:');
f=input('Enter the Timeperiod:');
t=-10:1:20;
x=a*sin(2*pi*f*t);
subplot(2,3,1);
plot(t,x);
xlabel('time');
ylabel('Amplitude');
title('Sinusoidal signal');
%decimating the signal
d=input('Enter the value by which the signal is to be
decimated:');
y1=decimate(x,d);
subplot(2,3,2);
stem(y1);
xlabel('time');
ylabel('Amplitude');
title('Decimated signal');
%interpolating the signal
i=input('Enter the value by which the signal is to be
interpolated:');
y2=interp(x,i);
subplot(2,3,3);
stem(y2);
xlabel('time');
ylabel('Amplitude');
title('Interpolated signal');
%resampling the signal
y3=resample(x,3,2);
subplot(2,3,4);
stem(y3);
xlabel('time');
ylabel('Amplitude');
title('Resampled signal');
%downsampling the signal
y4=downsample(x,2);
16
subplot(2,3,5);
stem(y4);
xlabel('time');
ylabel('Amplitude');
title('Downsampled signal');
%upsampling the signal
y5=upsample(x,3);
subplot(2,3,6);
stem(y5);
xlabel('time');
ylabel('Amplitude');
title('Upsampled signal');
FLOWCHART:
START
18
The program written using library functions and the sampling
rate conversion process is studied.
AIM:
Write a MATLAB Script to design Analog Butterworth filters
for the given specifications.
APPARATUS REQUIRED:
PC, MATLAB software
THEORY:
BUTTERWORTH FILTER:
Low pass Analog Butterworth filters are all pole filters
characterised by magnitude frequency response by
1
2N
1+ Ω
( )
|H ( jω)|2 = Ωc
19
elimination filters can be derived from the Normalized Low pass
filter.
ALGORITHM/PROCEDURE:
1. Click on the MATLAB icon on the desktop (or go to Start – All
programs and click on MATLAB) to get into the Command
Window.
2. Type ‘edit’ in the MATLAB prompt ‘>>’ that appears in the
Command window.
3. Write the program in the ‘Edit’ window and save it in ‘M-file’.
4. Run the program.
5. Enter the input in the command window.
6. The result is displayed in the Command window and the
graphical output is displayed in the Figure Window.
Butterworth Filters
SOURCE CODE:1
clc;
clear all;
close all;
%% Butterworth low pass Filter
20
% Filter Specifications
%Find the order and Cutofrf frequency using the given specification
of
%filter
[n,Wc]=buttord(w1,w2,k1,k2,'s');
disp('The order is:');
disp(n);
disp('The cutoff frequency is:');
disp(Wc);
f=linspace(1,512,1000);
h=freqs(b,a,f);
m=20*log(abs(h));
subplot(2,1,1);
semilogx(f,m);
xlabel('Frequency');
ylabel('Magnitude');
title('Magnitude response of Butterworth LPF');
% Phase response
p=angle(h);
subplot(2,1,2);
semilogx(f,p);
xlabel('Frequency');
ylabel('Phase');
title('Phase response of Butterworth LPF');
SOURCE CODE:2
21
clc;
clear all;
close all;
%% Butterworth high pass Filter
% Filter Specifications
%Find the order and Cutofrf frequency using the given specification
of
%filter
[n,Wc]=buttord(w1,w2,k1,k2,'s');
disp('The order is:');
disp(n);
disp('The cutoff frequency is:');
disp(Wc);
f=linspace(1,512,1000);
h=freqs(b,a,f);
m=20*log(abs(h));
subplot(2,1,1);
semilogx(f,m);
xlabel('Frequency');
ylabel('Magnitude');
title('Magnitude response of Butterworth HPF');
% Phase response
p=angle(h);
subplot(2,1,2);
semilogx(f,p);
xlabel('Frequency');
ylabel('Phase');
22
title('Phase response of Butterworth HPF');
SOURCE CODE:3
clc;
clear all;
close all;
%% Bandpass Filter Specifications
Wp=input('Enter the pass band edge frequency : ');
Ws=input('Enter the stop band edge frequency : ');
Rp=input('Enter the Pass band ripple: ');
Rs=input('Enter the stop band gain: ');
SOURCE CODE:4
clc;
clear all;
close all;
%% Bandstop Filter Specifications
Wp=input('Enter the pass band edge frequency : ');
Ws=input('Enter the stop band edge frequency : ');
Rp=input('Enter the Pass band ripple: ');
Rs=input('Enter the stop band gain: ');
23
%Band stop Filtering
[b,a]=butter(N,Wc,'stop','s');
FLOWCHART:
START
STOP
24
RESULT:
Analog Butterworth Filter is designed for the given
specifications, and manually verified the order, cut off frequency and
AIM:
Write a MATLAB Script to compute Discrete Fourier
Transform and Inverse Discrete Fourier Transform of the given
sequence using FFT algorithms (DIT-FFT & DIF-FFT)
.
APPARATUS REQUIRED:
PC, MATLAB software
THEORY:
25
The DFT of a finite duration sequence x[n] is given by
N−1
∑ x ( n ) e− j 2 πnk/N
X (k) = n=0 k=0, 1….N-1
which may conveniently be written in the form
N −1
∑ x ( n ) wnk
N
X (k) = n=0 k=0, 1….N-1
where WN=e-j2/N which is known as Twiddle or Phase
factor.
ALGORITHM/PROCEDURE:
1. Input the given sequence x[n]
2. Compute the Discrete Fourier Transform using FFT library
function (ditfft or diffft) and obtain X[k]
3. Compute the Inverse Discrete Fourier Transform using FFT
library function (ditfft or diffft) and obtain X[n] by following
steps
a. Take conjugate of X [k] and obtain X[k]*
b. Compute the Discrete Fourier Transform using FFT
library function (ditfft or diffft) for X[k]* and obtain
N.x[n]*
c. Once again take conjugate for N.x[n]* and divide by N
to obtain x[n]
4. Display the results.
SOURCE CODE:(DITFFT)
clc;
clear all;
close all;
26
N=input('Enter the number of elements:');
for i=1:N
re(i)= input('Enter the real part of the element:');
im(i)= input('Enter the imaginary part of the element:');
end
%% Call Dit_fft function
[re1,im1]= ditfft(re,im,N);
disp(re1);
disp(im1);
figure(1);
subplot(2,2,1);
stem(re1);
xlabel('Time period');
ylabel('Amplitude');
title('Real part of the output');
subplot(2,2,2);
stem(im1);
xlabel('Time period');
ylabel('Amplitude');
title('Imaginary part of the output');
%%dit_ifft
[re1,im1]=ditifft(re,im,N);
for i=1:N
re1(i)=re1(i)/N;
im1(i)=-im1(i)/N;
end
27
disp(re1);
disp(im1);
%figure(2)
subplot(2,2,3);
stem(re1);
xlabel('Time period');
ylabel('Amplitude');
title('Real part of the output');
subplot(2,2,4);
stem(im1);
xlabel('Time period');
ylabel('Amplitude');
title('Imaginary part of the output');
%% DIF_FFT
clc;
clear all;
close all;
%%
N=input('Enter the number of points in DIF DFT:');
for i=1:N
re(i)=input('Enter the real part of the element:');
im(i)=input('Enter the imaginary part of the element:');
end
%%
% Call DIf_FFT Function
[re1, im1]=diffft(re,im,N);
display(re1);
display(im1);
figure(1);
subplot(2,2,1);
stem(re1);
xlabel('Time');
ylabel('Amplitude');
28
title('Real part of the output');
subplot(2,2,2);
stem(im1);
xlabel('Time');
ylabel('Amplitude');
title('Imaginary part of the output');
%% DIF IFFT
N=input('Enter the number of points in DIF IFFT:');
for i=1:N
re(i)=input('Enter the real part of the element:');
im(i)=input('Enter the imaginary part of the element:');
end
for i=1:N
re(i)=re(i);
im(i)=-im(i);
end
%% Call dif_ifft function
[re1, im1]=ditifft(re,im,N);
for i=1:N
re1(i)=re1(i)/N;
im1(i)=-im1(i)/N;
end
display(re1)
display(im1);
% figure(2);
subplot(2,2,3);
stem(re1);
xlabel('Time');
ylabel('Amplitude');
title('Real part of the output');
subplot(2,2,4);
stem(im1);
xlabel('Time');
ylabel('Amplitude');
title('Imaginary part of the output');
29
FLOWCHART:
START
STOP 30
RESULT:
The DFT and IDFT of the given sequence are computed using
FFT algorithm both DITFFT and DIFFFT.
AIM:
Write a MATLAB Script to design Analog Chebyshev filter for
the given specifications.
APPARATUS REQUIRED:
PC, MATLAB software
THEORY:
Chebyshev Filters :
There are two types of Chebyshev filters.
Type I are all-pole filters that exhibit equi-ripple behaviour in pass
band and monotonic characteristics in stop band.
31
Type II are having both poles and zeros and exhibit monotonic
behavior in pass band and equi-ripple behavior in stop band. The zero
lies on the imaginary axis.
The magnitude-squared function is given as
1
|H ( jω)|2 = 2
1+ε C 2N (Ω /Ω p )
ε is the ripple parameter in pass band
CN(x) is the Nth order Chebyshev polynomial defined as
CN(x) =
{Cos(Ncosh−1 x) , |x|≤1 ¿ ¿¿¿
ALGORITHM/PROCEDURE:
1. Click on the MATLAB icon on the desktop (or go to Start – All
programs and click on MATLAB) to get into the Command
Window.
32
2. Type ‘edit’ in the MATLAB prompt ‘>>’ that appears in the
Command window.
3. Write the program in the ‘Edit’ window and save it in ‘M-file’.
4. Run the program.
5. Enter the input in the command window.
6. The result is displayed in the Command window and the
graphical output is displayed in the Figure Window.
CHEBYSHEV FILTERS :
Source code:1
clc;
clear all;
close all;
%% Chebyshev low pass Filter
% Filter Specifications
%Find the order and Cutofrf frequency using the given specification
of
%filter
[n,Wc]=cheb1ord(w1,w2,k1,k2,'s');
disp('The order is:');
disp(n);
disp('The cutoff frequency is:');
disp(Wc);
Source code:2
clc;
33
clear all;
close all;
%% Chebyshev High pass Filter
% Filter Specifications
%Find the order and Cutofrf frequency using the given specification
of
%filter
[n,Wc]=cheb1ord(w1,w2,k1,k2,'s');
disp('The order is:');
disp(n);
disp('The cutoff frequency is:');
disp(Wc);
Source code: 3
clc;
clear all;
close all;
%% Bandpass Filter Specifications
Wp=input('Enter the pass band edge frequency : ');
Ws=input('Enter the stop band edge frequency : ');
Rp=input('Enter the Pass band ripple: ');
Rs=input('Enter the stop band gain: ');
34
%Band pass Filtering
[b,a]=cheby1(N,Rp,Wc,'bandpass','s');
Source code: 4
clc;
clear all;
close all;
%% Bandstop Filter Specifications
Wp=input('Enter the pass band edge frequency : ');
Ws=input('Enter the stop band edge frequency : ');
Rp=input('Enter the Pass band ripple: ');
Rs=input('Enter the stop band gain: ');
%Bandstop Filtering
[b,a]=cheby1(N,Rp,Wc,'stop','s');
FLOWCHART:
START
35
specifications, and manually verified the order, cut off frequency and
EX. NO:8
the filter.
DATE :
DESIGN OF FIR FILTERS
AIM:
Write a MATLAB Script to design a low pass FIR filter using
Window Method for the given specifications
.
APPARATUS REQUIRED:
PC, MATLAB software
THEORY:
37
FIR filters:
They are non-recursive type and h [n] has finite number of
samples.
The transfer function is of the form:
N −1
H ( z )= ∑ hn z −n
n=0
TYPES OF WINDOWS:
1. Rectangular
2. Triangular
3. Hamming
4. Hanning
5. Blackman
6. Kaiser
POGRAM:
38
Source code :1
%windows technique of Rectangular window using low pass filter
clc;
clear all;
close all;
N=input('Size of window:');
wc=input('Cut off frequency:');
h=fir1(N-1,wc/pi,boxcar(N));
tf(h,1,1,'variable','z^-1');
freqz(h);
xlabel('Frequency');
ylabel('Magnitude');
title('FIR Filter');
Source code :2
%windows technique of Triangular(Bartlet Window) using High pass
filter
clc;
clear all;
close all;
N=input('Size of window:');
wc=input('Cut off frequency:');
h=fir1(N-1,wc/pi,'high',triang(N));
tf(h,1,1,'variable','z^-1');
freqz(h);
xlabel('Frequency');
ylabel('Magnitude');
title('FIR Filter');
Source code :3
%windows technique of Hamming using Band pass filter
clc;
clear all;
close all;
N=input('Size of window:');
wc1=input('Lower Cut off frequency:');
wc2=input('Upper Cut off frequency:');
wc=[wc1 wc2];
39
h=fir1(N-1,wc/pi,'bandpass',hamming(N));
tf(h,1,1,'variable','z^-1');
freqz(h);
xlabel('Frequency');
ylabel('Magnitude');
title('FIR Filter');
Source code :4
%windows technique of Hanning using Band stop filter
clc;
clear all;
close all;
N=input('Size of window:');
wc1=input('Lower Cut off frequency:');
wc2=input('Upper Cut off frequency:');
wc=[wc1 wc2];
h=fir1(N-1,wc/pi,'stop',hanning(N));
tf(h,1,1,'variable','z^-1');
freqz(h);
xlabel('Frequency');
ylabel('Magnitude');
title('FIR Filter');
Source code :5
%windows technique of Blackman window using low pass filter
clc;
clear all;
close all;
N=input('Size of window:');
wc=input('Cut off frequency:');
h=fir1(N-1,wc/pi,blackman(N));
tf(h,1,1,'variable','z^-1');
freqz(h);
xlabel('Frequency');
ylabel('Magnitude');
title('FIR Filter');
40
FLOWCHART:
START
STOP
RESULT:
The given low pass filter was designed using Window method
EX. NO: 9
DATE:
DESIGN OF IIR FILTERS
AIM:
Write a MATLAB Script to design Butterworth and
Chebyshev low pass filters using
Bilinear Transformation
Impulse Invariant Transformation
.
APPARATUS REQUIRED:
PC, MATLAB software
THEORY:
42
A digital filter is a linear time invariant discrete time system.
The digital filters are classified into two, based on their lengths of
impulse response
1. Finite Impulse response (FIR)
They are of non-recursive type and h [n] has finite
number of samples
2. Infinite Impulse response (IIR)
h[n] has finite number of samples. They are of
recursive type. Hence, their transfer function is of the
form
H ( z ) h ( n ) z n
n 0
M −1
∑ bk Z−k
K=0
H ( Z )= N −1
1+ ∑ a j Z− j
j=1
The digital filters are designed from analog filters. The two
widely used methods for digitizing the analog filters include
1. Bilinear transformation
2. Impulse Invariant transformation
43
2
tan
T 2
BILINEAR TRANSFORMATION:
DESIGN STEPS:
1. From the given specifications, Find pre-warped analog
frequencies using
2
tan
T 2
2. Using the analog frequencies, find H(s) of the analog
filter
2 1−Z −1
S= ×
3. Substitute T 1+Z−1 in the H(s) of Step:2
ALGORITHM/PROCEDURE:
44
2. Design the analog counterpart
3. Using Impulse Invariant /Bilinear transformation design the
digital filter
4. Display the transfer function. Plot the magnitude response and
phase response
SOURCE CODE:
/ Butterworth Lowpass Impulse invariant method
clc;
clear all;
close all;
warning off;
% Design of IIR Filters
%% Filter Specifications
% Input Wp,Ws,Sp,Ss,T
% T=1,bothe ripple gains should be b/w .1 to .3
disp(' Butterworth Lowpass filter using Impulse invariant method
');
% Calculation of ohmp,ohms,Ap,As
Ap=abs(20*log10(1-Sp));
As=abs(20*log10(Ss));
ohmp=Wp/T;
ohms=Ws/T;
% Butterworth Filter
% Calculation of order and cutoff freq. for the above filter specs.
45
[n,Wc]=buttord(ohmp,ohms,Ap,As,'s');
% Magnitude Response
Hm=20*log10(abs(H));
subplot(2,1,1);
semilogx(O,Hm);
xlabel('Frequency');
ylabel('Magnitude');
title('Magnitude Response of IIR Filter using Impulse Invariant
Method');
% Phase Response
Ha=angle(H);
subplot(2,1,2);
semilogx(O,Ha);
xlabel('Frequency');
ylabel('Phase');
title('Phase Response of IIR Filter using Impulse Invariant
Method');
clc;
clear all;
close all;
warning off;
% Design of IIR Filters
%% Filter Specifications
% Input Wp,Ws,Sp,Ss,T
% T=1,both the ripple gains should have band width( .1 to .3)
46
disp(' Butterworth Lowpass filter using Bilnear transformation
method ');
% Calculation of ohmp,ohms,Ap,As
Ap=abs(20*log10(1-Sp));
As=abs(20*log10(Ss));
ohmp=Wp/T;
ohms=Ws/T;
% Butterworth Filter
% Calculation of order and cutoff freq. for the above filter specs.
[n,Wc]=buttord(ohmp,ohms,Ap,As,'s');
% Magnitude Response
Hm=20*log10(abs(H));
subplot(2,1,1);
semilogx(O,Hm);
xlabel('Frequency');
ylabel('Magnitude');
title('Magnitude Response of IIR Filter using Bilinear
Transformation Method');
% Phase Response
Ha=angle(H);
subplot(2,1,2);
semilogx(O,Ha);
xlabel('Frequency');
47
ylabel('Phase');
title('Phase Response of IIR Filter using Bilinear Transformation
Method');
clc;
clear all;
close all;
warning off;
% Design of IIR Filters
%% Filter Specifications
% Input Wp,Ws,Sp,Ss,T
% T=1,bothe ripple gains should be b/w .1 to .3
disp(' Chebyshev Lowpass filter using Impulse invariant method
');
% Calculation of ohmp,ohms,Ap,As
Ap=abs(20*log10(1-Sp));
As=abs(20*log10(Ss));
ohmp=Wp/T;
ohms=Ws/T;
% Chebyshev Filter
% Calculation of order and cutoff freq. for the above filter specs.
[n,Wc2]=cheb1ord(ohmp,ohms,Ap,As,'s')
48
% Magnitude Response
Hm=20*log10(abs(H));
subplot(2,1,1);
semilogx(O,Hm);
xlabel('Frequency');
ylabel('Magnitude');
title('Magnitude Response of IIR Filter using Impulse Invariant
Method');
% Phase Response
Ha=angle(H);
subplot(2,1,2);
semilogx(O,Ha);
xlabel('Frequency');
ylabel('Phase');
title('Phase Response of IIR Filter using Impulse Invariant
Method');
clc;
clear all;
close all;
warning off;
% Design of IIR Filters
%% Filter Specifications
% Input Wp,Ws,Sp,Ss,T
% T=1,bothe ripple gains should be b/w .1 to .3
disp(' Chebyshev Lowpass filter using Bilnear transformation
method ');
% Calculation of ohmp,ohms,Ap,As
49
Ap=abs(20*log10(1-Sp));
As=abs(20*log10(Ss));
ohmp=Wp/T;
ohms=Ws/T;
% Chebyshev Filter
% Calculation of order and cutoff freq. for the above filter specs.
[n,Wc2]=cheb1ord(ohmp,ohms,Ap,As,'s')
% Magnitude Response
Hm=20*log10(abs(H));
subplot(2,1,1);
semilogx(O,Hm);
xlabel('Frequency');
ylabel('Magnitude');
title('Magnitude Response of IIR Filter using Bilinear
Transformation Method');
% Phase Response
Ha=angle(H);
subplot(2,1,2);
semilogx(O,Ha);
xlabel('Frequency');
ylabel('Phase');
title('Phase Response of IIR Filter using Bilinear Transformation
Method');
50
FLOWCHART:
START
STOP
51
RESULT:
Butterworth and Chebyshev Lowpass filters were designed
52
verified the order, cut off frequency and filter co-efficient of the
filters.
AIM:
To study about the TMS 320C6713.
Theoy:
53
54
55
FUNCTIONAL OVERVIEW OF THE TMS 320C6713 DSK
56
CODE COMPOSER STUDIO
57
without stopping the target. Key statistics and performance can be
monitored in real time. Through the Joint Team Action Group
(JTAG), communication with on-chip emulation support occurs to
control and monitor program execution. The C6713 DSK board
includes a JTAG emulator interface.
BASIC OPERATION
58
RESULT:
Thus the details about the TMS 320C6713 was studied.
59
60