Professional Documents
Culture Documents
15UEC727 - Master Record-1
15UEC727 - Master Record-1
15UEC727 - Master Record-1
MASTER RECORD
PREPARED BY
Mr.B.Muthupandian
Mrs.G.Ramu Priya
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
Institute Vision To promote excellence in technical education and scientific research for
Core Values
Quality
Commitment
Innovation
Team work
Courtesy
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
Department Mission
To provide quality technical education to fulfill the
aspiration of the student and to meet the needs of the
industry.
To provide holistic learning ambience.
To impart skills leading to employability and
entrepreneurship.
To establish effective linkage with industries.
To promote research and development activities.
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
PROGRAMME OUTCOMES
Design solutions for complex engineering problems in the areas of VLSI and
3 Communication systems. (Design and Development of Solutions)
Select and apply appropriate techniques and modern engineering tools for the
5 design of VLSI and communication systems. (Modern Engineering Tools)
Recognize the need for and have the preparation and ability to engage in
independent and life-long learning to follow developments in Electronics and
12
Communication Engineering. (Life-long learning)
PSO – II Design and analyze power electronic interfaces for renewable energy systems.
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
AIM
To introduce the student to various Digital Signal Processing techniques using TMS 320c5x family
processors and MATLAB.
OBJECTIVES:
To implement the processing techniques using the instructions of TMS320C5X/TMS320C
67XX/ADSP 218X/219X/BS531/532/561
To implement the IIR and FIR filter using MATLAB.
COURSE OUTCOMES:
After successful completion of this course, the Students will be able to:
LIST OF EXPERIMENTS
CYCLE-I
EXPERIMENTS USING MATLAB
1.Generation of Signals
2.Linear and circular convolution of two sequences
3.Sampling and effect of aliasing
4.Design of FIR filters
5.Design of IIR filters
6.Calculation of FFT of a signal
.
CYCLE-II
EXPERIMENTS USING TMS320C5416
OBJECTIVE:
ALGORITHM:
PROGRAM:
a) Create a unit step input which satisfies the below equation
u(n)=1; n>=0
=0; n<0
(N=Number of sequences=10)
clc;
clear all;
close all;
N=input('Enter the Value of N');
t=-N:1:N;
u=[zeros(1,N),ones(1,N+1)];
figure(1);
subplot(2,2,1);
stem(t,u);
xlabel('n----->');
ylabel('Amplitude----->');
title('UNIT STEP SEQUENCE');
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
t=0:1:N-1;
r=t;
figure(1);
subplot(2,2,2);
stem(t,r);
xlabel('n----->');
ylabel('Amplitude----->');
title('UNIT RAMP SEQUENCE');
b) Unit Impulse:
s(n)=1; n>=0
=0; n<0
(N=Number of sequences=10)
t=-N:1:N;
s=[zeros(1,N),ones(1,1),zeros(1,N)];
figure(1);
subplot(2,2,3);
stem(t,s);
xlabel('n----->');
ylabel('Amplitude----->');
title('UNIT IMPULSE SEQUENCE');.
c) Exponential signal:
t=0:1:N-1
a=input('Enter the a value');
y=exp(a*t);
figure(1);
subplot(2,2,4);
stem(t,y);
xlabel('n----->');
ylabel('Amplitude----->');
title('EXPONENTIAL SEQUENCE');
e) Generate a Sinusoidal signal of frequency with interval 0.25 sec t=0 to 5 sec
t=0:0.25:5;
u=sin(0.5*pi*t);
figure(2);
subplot(2,2,1);
stem(t,u);
xlabel('n----->');
ylabel('Amplitude----->');
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
title('SINSUOIDAL SEQUENCE');
f) Cosine signal
t=0:0.25:5;
u=cos(0.5*pi*t);
figure(2);
subplot(2,2,2);
stem(t,u);
xlabel('n----->');
ylabel('Amplitude----->');
title('COSINE SEQUENCE');
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
VIVA:
1. Define signal and classify it
A signal is the entity that carries information. They are classified as
1. Periodic and non-Periodic
2. Deterministic and random
3. Energy and Power
4. Even and Odd
2. Identify the operations involved in the following signal x(2n) &x(n/2)
Ans: x(2n)- Compression
X(n/2)-Expansion
3. How unit step and impulse functions are related?
δ(n)=u(n)-u(n-1)
δ(t)=du(t)/dt
4. Consider the following 2 sequence of length 5 defined for 0≤n≤4
C(n)={3.2, 41, 36,-9.5,0}
d(n)={1.7,-0.5,0,0.8,1}
RESULT:
Thus basic discrete time signals are generated using MATLAB programs and the
output is verified.
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
OBJECTIVE:
To write a MATLAB program to find the convolution for the sequences x(n)={1,1,2} and
h(n)= {2,0,2,0} using
(i) Linear convolution
(ii) Circular Convolution.
Analyze the convolution results with all the three methods
PROGRAM:
clc;
clear all;
close all;
x=input('Enter the 1st sequence');
h=input('Enter the 2nd sequence');
n1=length(x);
n2=length(h);
y=conv(x,h);
n3=length(y);
figure(1);
subplot(2,2,1);
stem(x);
xlabel('n----->');
ylabel('Amplitude----->');
title('Input signal 1');
subplot(2,2,2);
stem(h);
xlabel('n----->');
ylabel('Amplitude----->');
title('Input signal 2');
subplot(2,2,3);
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
stem(y);
xlabel('n----->');
ylabel('Amplitude----->');
title('Output convoluted signal');
disp('The resultant signal is');
disp(y);
disp('length of the output sequence is:');
OBSERVATION:
Enter the 1st sequence[ 2 3 1 0]
Enter the 2nd sequence[ 3 5 2 0]
The resultant signal is
6 19 22 11 2 0 0
length of the output sequence is: 7
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
stem(y);
grid on;
xlabel('time');
ylabel('amplitude');
title('a');
OBSERVATION:
Enter for a [2 3 4 5]
Enter for b [1 2 3]
y = 2 7 16 22
VIVA:
1.State the Properties of convolution.
i.x(n)*h(n)=h(n)*x(n)
ii.For cascade of 2 systems,h1(n)*h2(n)
iii.For parallel connection of 2 systems h1(n)+h2(n)
2.Which steps are performed in convolution
i.Folding
ii.Shifting
iii.Multiplication
iv.Integration/Summation
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
RESULT:
Thus the linear and circular convolution program is executed and verified using
MATLAB
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
grid on;
xlabel('n-------->');
ylabel('u(n)------>');
title('sine');
%under sampling
t=0:.2:4;
S=sin(2*3.14*f*t);
subplot(3,1,2);
stem(t,S);
grid on;
xlabel('n--------->');
ylabel('u(n)------->');
%aliasing
t=0:.6:4;
S=sin(2*3.14*f*t);
subplot(3,1,3);
stem(t,S);grid on;
xlabel('n--------->') ;
ylabel('u(n)--------->’);
OBSERVATION:
sine
1
u(n)------>
-1
0 0.5 1 1.5 2 2.5 3 3.5 4
n-------->
1
u(n)------->
-1
0 0.5 1 1.5 2 2.5 3 3.5 4
n--------->
1
u(n)---------->
-1
0 0.5 1 1.5 2 2.5 3 3.5 4
n--------->
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
Observation
VIVA
1.State Sampling Theorem.
A continuous time signal can be completely represented in its samples and recovered back if the
sampling frequency Fs ≥2W where Fs = sampling frequency W-=Max frequency present in
the signal.
2.What is aliasing
Due to under sampling, high frequencies appear as low frequencies and they interfere with each
other. This effect is called aliasing.
3. How aliasing can be avoided
i.To have sampling rate higher than Nyquist rate
ii.To pass the signal through pre-alias filter before sampling.
4. What is pre-alias filter?
A pre-alias filter is low pass filter which blocks all frequencies above Hz. Basically it is
bandlimiting operation.
5. What is Nyquist rate and Nyquist interval?
Nyquist rate= 2*highest signal frequency
Nyquist interval= 1/Nyquist rate
Result: Thus the sampling and the effect of aliasing for a single tone signal and multi tone signals
were performed using MATLAB
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
OBJECTIVE:
To write a MATLAB program to design FIR filters for Pass Band Frequency1000,
StopBand Frequency 2000, Pass Band Ripple 0.05, Stop Band Ripple 0.04, Frequency 10000
figure(3);
freqz(b,1,256);
title('BPF Filter-Kaiser window');
wn=[wp ws];
b=fir1(N,wn,'stop',kaiser(N+1,.1));
figure(4);
freqz(b,1,256);
title('BSF Filter-Kaiser window');
Observation:
Enter PassBand Frequency 1000
Enter StopBand Frequency 2000
Enter PassBand Ripple 0.05
Enter StopBand Ripple 0.04
Enter Frequency 10000
-50
-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
0
Phase (degrees)
-100
-200
-300
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
0
Magnitude (dB)
-20
-40
-60
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
200
Phase (degrees)
-200
-400
-600
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
-10
-20
-30
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-200
Phase (degrees)
-400
-600
-800
-1000
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
ALGORITHM:
1. Get the pass band, stop band, pass band ripple, stop band ripple and sampling frequency.
2. Calculate the value of ωp =(2*fp)/Fs, ωs=(2*fs)/Fs
3. Assign ωn = ωp then calculate the value of N.
4. Then plot the graph for low pass, high pass, band pass and band reject filter for the
Hanning filter with the respective formulas in separate figure windows.
PROGRAM:
clc; clear all; close all;
fp=input('Enter PassBand Frequency');
fs=input('Enter StopBand Frequency');
rp=input('Enter PassBand Ripple');
rs=input('Enter StopBand Ripple');
f=input('Enter Frequency');
num=(-20*log10(sqrt(rp*rs)))-13;
den=(14.6*(fs-fp))/f;
N=ceil(num/den);
wp=2*fp/f; ws=2*fs/f;
wn=wp;
b=fir1(N,wn,hann(N+1));
figure(1);
freqz(b,1,256);
title('LPF Filter-Hanning window');
wn=ws;
b=fir1(N,wn,'high',hann(N+1));
figure(2);
freqz(b,1,256);
title('HPF Filter-Hanning window');
wn=[wp ws];
b=fir1(N,wn,'band',hann(N+1));
figure(3);
freqz(b,1,256);
title('BPF Filter-Hanning window');
wn=[wp ws];
b=fir1(N,wn,'stop',hann(N+1));
figure(4);
freqz(b,1,256);
title('BSF Filter-Hanning window');
OBSERVATION:
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
-50
-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
0
Phase (degrees )
-100
-200
-300
-400
-500
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
-50
-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
400
P h a s e (d e g re e s )
200
-200
-400
-600
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-50
-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
0
Phase (degrees)
-200
-400
-600
-800
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
-2
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-200
Phase (degrees)
-400
-600
-800
-1000
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
ALGORITHM:
1. Get the pass band, stop band, pass band ripple, stop band ripple and sampling frequency.
2. Calculate the value of ωp =(2*fp)/Fs, ωs=(2*fs)/Fs.
3. Assign ωn = ωp then calculate the value of N.
4. Then plot the graph for low pass, high pass, band pass and band reject filter for the
Hamming filter with the respective formulas in separate figure windows.
PROGRAM:
clc; clear all; close all;
fp=input('Enter PassBand Frequency');
fs=input('Enter StopBand Frequency');
rp=input('Enter PassBand Ripple');
rs=input('Enter StopBand Ripple');
f=input('Enter Frequency');
num=(-20*log10(sqrt(rp*rs)))-13;
den=(14.6*(fs-fp))/f;
N=ceil(num/den);
wp=2*fp/f; ws=2*fs/f; wn=wp;
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
b=fir1(N,wn,hamming(N+1));
figure(1);
freqz(b,1,256);
title('LPF Filter-Hamming window');
wn=ws;
b=fir1(N,wn,'high',hamming(N+1));
figure(2);
freqz(b,1,256);
title('HPF Filter-Hamming window');
wn=[wp ws];
b=fir1(N,wn,'band',hamming(N+1));
figure(3);
freqz(b,1,256);
title('BPF Filter-Hamming window');
wn=[wp ws];
b=fir1(N,wn,'stop',hamming(N+1));
figure(4);
freqz(b,1,256);
title('BSF Filter-Hamming window');
OBSERVATION:
Enter PassBand Frequency 1000
Enter StopBand Frequency 2000
Enter PassBand Ripple 0.05
Enter StopBand Ripple 0.04
Enter Frequency 10000
-50
-100
-150
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
P h a s e (d e g re e s )
-200
-400
-600
-800
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
-50
-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
400
P has e (degrees )
200
-200
-400
-600
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-50
-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
0
Phase (degrees)
-200
-400
-600
-800
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
0
Magnitude (dB)
-2
-4
-6
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-200
Phase (degrees)
-400
-600
-800
-1000
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
Algorithm:
1. Get the pass band, stop band, pass band ripple, stop band ripple and sampling frequency.
2. Calculate the value of ωp =(2*fp)/Fs, ωs=(2*fs)/Fs.
3. Assign ωn = ωp then calculate the value of N.
4. Then plot the graph for low pass, high pass, band pass and band reject filter for the
rectangular filter with the respective formulas in separate figure windows.
Program:
clc; clear all; close all;
fp=input('Enter PassBand Frequency');
fs=input('Enter StopBand Frequency');
rp=input('Enter PassBand Ripple');
rs=input('Enter StopBand Ripple');
f=input('Enter Frequency');
num=(-20*log10(sqrt(rp*rs)))-13;
den=(14.6*(fs-fp))/f;
N=ceil(num/den);
wp=2*fp/f;
ws=2*fs/f;
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
wn=wp;
b=fir1(N,wn,boxcar(N+1));
figure(1);
freqz(b,1,256);
title('LPF Filter-Rectangular window');
wn=ws;
b=fir1(N,wn,'high',boxcar(N+1));
figure(2);
freqz(b,1,256);
title('HPF Filter-Rectangular window');
wn=[wp ws];
b=fir1(N,wn,'band',boxcar(N+1));
figure(3);
freqz(b,1,256);
title('BPF Filter-Rectangular window');
wn=[wp ws];
b=fir1(N,wn,'stop',boxcar(N+1));
figure(4);
freqz(b,1,256);
title('BSF Filter-Rectangular window');
OBSERVATION:
Enter PassBand Frequency 1000
Enter StopBand Frequency2000
Enter PassBand Ripple0.05
Enter StopBand Ripple0.04
Enter Frequency10000
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
M a g n it u d e ( d B )
LPF Filter-Rectangular window
0
-50
-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
P h a s e (d e g re e s )
-100
-200
-300
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-20
-40
-60
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
200
P ha s e (de gre es )
-200
-400
-600
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
-50
-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
300
Phase (degrees)
200
100
-100
-200
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-10
-20
-30
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
0
P has e (degrees )
-200
-400
-600
-800
-1000
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
VIVA
1.What is FIR filter? State the properties of FIR filter?
FIR stands for Finite Impulse Response filter. It’s length of impulse response is finite.
FIR filters have linear phase.
FIR filters are inherently stable.
FIR filters need higher orders for similar magnitude response compare to IIR filter
RESULT:
Thus the various FIR filters using rectangular, hamming, hanning and Blackman window
programs were written and executed successfully.
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
OBJECTIVE:
Design an IIR filter for the following Specifications
Pass Band Frequency1000, Stop Band Frequency2000 and Sampling freq10000
ALGORITHM:
1. Get the pass band, stop band, pass band attenuation, stop band attenuation and sampling
frequency.
2. Calculate the value of ωp = (2*fp)/Fs, ωs = (2*fs)/Fs.
3. Plot the analog low pass filter using butter function, digital impulse invariant filter using
impinvar function, digital bilinear filter using bilinear function.
4. Plot the analog high pass filter using butter function.
PROGRAM:
clc;
clear all;
close all;
fp=input('Enter PassBand Frequency');
fs=input('Enter StopBand Frequency');
rp=5;
rs=50;
f=input('Enter sampling freq');
wp=(2*fp)/f;
ws=(2*fs)/f;
[N wn]=buttord(wp,ws,rp,rs);
[b a]=butter(N,wn,'s');
figure(1);
freqs(b,a);
title('analog low pass filter');
[b1 a1]=impinvar(b,a);
figure(2);
freqz(b1,a1);
title('digital impvar filter');
[b2 a2]=bilinear(b,a,f);
figure(3);
freqz(b2,a2);
title('digital bilinear filter');
plot(omega,phase);
grid;
title('phase plot');
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
OBSERVATION:
0
analog low pass filter
10
M a g n it u d e
-5
10
-2 -1 0
10 10 10
Frequency (rad/s)
200
P h a s e (d e g re e s )
100
-100
-200
-2 -1 0
10 10 10
Frequency (rad/s)
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
-100
-200
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
0
P has e (degrees )
-200
-400
-600
-800
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-100
Magnitude (dB)
-200
-300
-400
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
280
260
Phase (degrees)
240
220
200
180
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
PROGRAM-
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
HIGHPASS –IIR
clc;
clear all;
close all;
fp=input('Enter PassBand Frequency');
fs=input('Enter StopBand Frequency');
rp=5;
rs=50;
f=input('Enter sampling freq');
wp=(2*fp)/f;
ws=(2*fs)/f;
[N wn]=buttord(wp,ws,rp,rs);
[b a]=butter(N,wn,'high','s');
figure(1);
freqs(b,a);
title('analog low pass filter');
[b1 a1]=impinvar(b,a);
figure(2);
freqz(b1,a1);
title('digital impvar filter');
[b2 a2]=bilinear(b,a,f);
figure(3);
freqz(b2,a2);
title('digital bilinear filter');
OBSERVATION:
Enter PassBand Frequency 1000
Enter StopBand Frequency2000
Enter sampling freq10000
0
analog low pass filter
10
M a g n it u d e
-5
10
-10
10
-2 -1 0 1
10 10 10 10
P h a s e (d e g re e s )
Frequency (rad/s)
200
100
-100
-200
-2 -1 0 1
10 10 10 10
Frequency (rad/s)
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
-10
-20
-30
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
300
P h a s e (d e g re e s )
200
100
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-10
-20
-30
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
300
P h a s e (d e g re e s )
200
100
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
VIVA
1.What is IIR filter? What are various methods to design IIR filter?
3. What is prewarping?
Frequency warping or nonlinear frequency relationship is the main problem of bilinear
transformation.
Prewarping is the method of introducing nonlinearily in frequency relationship to
compensate warping effect.
Formula Ὠ=2/T tan ω/2
RESULT:
Thus the digital butter worth IIR filters were designed and executed successfully
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
OBJECTIVE:
To compute FFT using the MATLAB program for the sequences [1 1 1 1] and [1 1 1 1 0 0 0 0]
ALGORITHM:
PROGRAM:
clc;
x=input('Enter the input sequence');
n=length(x);
s=fft(x,n);
disp('The output sequence');s
a=real(s);
disp('Real part of the output sequence');a
b=imag(s);
disp('Imag. part of the output sequence');b
figure;
subplot(3,1,1);
stem(x);
grid on;
title('Input');
xlabel('n-->');
ylabel('Amplitude -->');
subplot(3,1,2);
stem(a);
grid on;
title('Real part');
xlabel('n-->');
ylabel('Amplitude -->');
subplot(3,1,3);
stem(b);
title('Imaginary part');
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
xlabel('n-->');
ylabel('Amplitude -->');
OBSERVATION:
Enter the input sequence [1 1 0 0]
The output sequence
s=
a=
2 1 0 1
b=
0 -1 0 1
Input
1
Amplitude -->
0.5
0
1 1.5 2 2.5 3 3.5 4
n-->
Real part
2
Amplitude -->
0
1 1.5 2 2.5 3 3.5 4
n-->
Imaginary part
1
Amplitude -->
-1
1 1.5 2 2.5 3 3.5 4
n-->
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
VIVA:
1.What is FFT?
The fast fourier transform is an algorithm used to compute the DFT. It is based on the principle of
decomposing the computation of DFTof a sequence of length N into successively smaller DFTs.
2. What is the main advantage of FFT?
i.To reduce the computation time of DFT
ii.Provides speed-increase factors.
3.. What is meant by radix-2 FFT?
The FFT algorithm is most efficient in calculating N-point DFT. If the the number of output points
N can be expressed as a power of 2, that is N= , where M is an integer, then this algorithm is
known as radix-2 FFT algorithm.
4.The DFT of a sequence x(n) that has N=2m can be calculated using 2 algoritms.Algorithm A
computes the DFT by direct computation & take N2 seconds to run. Algorithm B implements DIT-
FFT & takes 5Nlog2N sesc to run.What is the shortest sequence N such that Algorithm B runs
faster than Algorithm A.
OBJECTIVE:
To add two 16-bit number using indirect addressing mode
ALGORITHM:
Program:
(A) 16 BIT ADDITION USING INDIRECT ADDRESSING MODE
.MMREGS
.TEXT
LDP#100H
LAR AR0,# 8000H
LAR AR1,# 8001H
LAR AR2,#80002H
ZAP
MAR*,AR0
ADD*
MAR*,AR1
ADD*
MAR*,AR2
SACL*
HLT: B HLT
OUTPUT:
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
OBJECTIVE:
To add two 16-bit number using direct addressing mode
ALGORITHM:
1. Load the data directly to accumulator
2. Add the contents of accumulator to the next 16 bit data
3. Store the result in data memory location
4. Halt the execution
5.
Program:
.MMREGS
.TEXT
LDP #100H
LACC # 1234H
ADD #2345H
SACL 8000H
HLT: B HLT
OUTPUT:
OBJECTIVE:
To add two 32-bit number
ALGORITHM:
LACC 8001,10H
ADDS 8000H
ADDS 8002H,10H
ADDS 8003H
SACH 8005H
HLT: B HLT
OUTPUT:
RESULT:
Thus the addition of two 16 bit number and 32 bit number is performed using
TMS320C50
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
OBJECTIVE:
To Sample the input sinewave waveform using TMS320C6745 DSP KIT.
PROCEDURE:
2. In WorkSpace Launcher.
BROWSE → Select the project location and make one new folder, MAKE NEW
FOLDER → Type the Workspace name, OK → OK.
6. Paste the Linker file in the project location.(linker file is available in cd)
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
10. Connections
Note: Connect the Function generator probe positive terminal to Adc input pin and negative
terminal to ground. Set the frequency as 1Khz & Amplitude as 3V.
PROGRAM:
#include "stdio.h"
#include "c6745.h"
#include "spiadc.h"
{
C6745_init( );
spiadc_init();
for(i=0;i<500;i++)
{
//for(j=0;j<100000;j++);
}
while(1);
RESULT:
Thus, the Sampling of input sine waveform was sampled and Displayed the sampled signal in
Graph.
OBJECTIVE:
To design and implement Digital Finite Impulse Response [FIR] Filter.
ALGORITHM:
1. Get sampling frequency, filter order and cut off frequency
2. Obtain filter coefficient for low pass FIR and high pass FIR filter using MATLAB.
3. Copy the above filter coefficients into the array “h” in the given fir_filter.c file.
PROCEDURE:
1. Connect CRO to the Socket Provided for SPKR OUT.
2. Connect a Signal Generator to the LINE IN Socket.
3. Switch on the Signal Generator with a sine wave of frequency 500 Hz.
4. Now Switch on the DSK and Bring Up Code Composer Studio on the PC.
5. Copy the given source code into the my projects folder of CCS installation folder.
6. From the Project Menu of CCS Select the Open Menu.
7. Select fir_filter.pjt and open it.
8. Build, Load and Run the program.
9. You can notice the input signal of 500 Hz. appearing on the CRO without any
attenuation.
10. Change the frequency of the input signal to 3000 Hz, you can observe that no signal
appears on the CRO, this is because any input signal with frequency more than 800 Hz (cutoff
frequency) will be attenuated and hence not passed through the filter.
11. Design a Highpass filter with the above given filter specifications and set the input
signal frequency to 4000 Hz, the signal appears on the CRO without any attenuation.
12. Change the frequency of the input signal to 1000 Hz, you can observe that no signal
appears on the CRO, this is because any input signal with frequency less than 3000 Hz (cutoff
frequency) will be attenuated and hence not passed through the filter.
13. You can also pass an audio input and hear the output signal through the speakers,
Where a Lowpass filter will result in BASS and Highpass filter will result in TREBLE part of the
audio input.
Program:
#include "fft_configcfg.h"
#include <dsk5416.h>
#include <dsk5416_pcm3002.h>
#define N 33
short filter(short*,short*);
short filter_l(short*,short*);
//High pass
// b=fir1(32,(2*3000)/48000,'high')
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
//short h[N]={-1,23,60,116,186,249,268,199,-1,-360,-881,-1534,-2257,-2964,-3560,-
3958,28679,-3958,-3560,-2964,-2257,-1534,-881,-360,-1,199,268,249,186,116,60,23,-1};
//low pass
//b=fir1(32,(2*800)/48000);
short
h[N]={96,115,158,230,330,459,612,786,975,1170,1363,1546,1710,1846,1949,2013,2035,
2013,1949,1846,1710,1546,1363,1170,975,786,612,459,330,230,158,115,96};
short l_inp_buffer[N],r_inp_buffer[N];
short left_output,right_output,left_input,right_input,i;
DSK5416_PCM3002_Config setup = {
left_output=filter(l_inp_buffer,h);
right_output=filter(r_inp_buffer,h);
for(i=N-1;i>0;i--)
{
l_inp_buffer[i]=l_inp_buffer[i-1];
r_inp_buffer[i]=r_inp_buffer[i-1];
}
/******************************/
while(!DSK5416_PCM3002_write16(hCodec, right_output));
}
}
RESULT: Thus the finite impulse response (FIR) filter is successfully implemented
and verified
EX.NO. 10 CALCULATION OF FFT
OBJECTIVE:
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
ALGORITHM:
PROCEDURE:
1. Connect CRO to the Socket Provided for SPKR OUT.
2. Connect a Signal Generator to the LINE IN Socket.
3. Switch on the Signal Generator with a sine wave of frequency 500 Hz.
4. Now Switch on the DSK and Bring Up Code Composer Studio on the PC.
5. Copy the given source code into the my projects folder of CCS installation folder.
6. From the Project Menu of CCS Select the Open Menu.
7. Select fir_filter.pjt and open it.
8. Build, Load and Run the program.
9. You can notice the input signal of 500 Hz. appearing on the CRO without any
attenuation.
10. Change the frequency of the input signal to 3000 Hz, you can observe that no signal
appears on the CRO, this is because any input signal with frequency more than 800 Hz (cutoff
frequency) will be attenuated and hence not passed through the filter.
11. Design a Highpass filter with the above given filter specifications and set the input
signal frequency to 4000 Hz, the signal appears on the CRO without any attenuation.
12. Change the frequency of the input signal to 1000 Hz, you can observe that no signal
appears on the CRO, this is because any input signal with frequency less than 3000 Hz (cutoff
frequency) will be attenuated and hence not passed through the filter.
13. You can also pass an audio input and hear the output signal through the speakers,
Where a Lowpass filter will result in BASS and Highpass filter will result in TREBLE part of the
audio input.
Program:
.include "twi.asm"
.include "twr.asm"
.include "cos.asm"
.include "5416_iv.asm"
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
.def start
.data
R1 .word 0h ;Variables
I1 .word 0h
stages .word 7h
grp .word 64
grp1 .word 0h
but .word 1h
but1 .word 0h
R .word 0h
I .word 0h
A1 .word 0h
sizetw .word 40h
sizein .word 80h
bitr .word 40h
shi .word 7Fh
CNT .word 128
E .word 45h
.text
start LD #R1,DP
RSBX INTM
LD #022Bh,0,A
STLM A,PMST
SSBX INTM
STM SPCR1,McBSP0_SPSA ;SPCR1 reset
STM #0090h,McBSP0_SPSD
NOP
NOP
STM SPCR1,McBSP0_SPSA
STM #0091h,McBSP0_SPSD ;Take 'em out of reset
NOP
NOP
STM SPCR2,McBSP0_SPSA
STM #00A1h,McBSP0_SPSD
;--------------------------McBSP2 Initializations------------------------------
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
NOP
NOP
STM SPCR1,McBSP2_SPSA
STM #0091h,McBSP2_SPSD ;Take 'em out of reset
NOP
NOP
STM SPCR2,McBSP2_SPSA
STM #00A1h,McBSP2_SPSD
RSBX INTM
LD #017h,0,A
STLM A,IMR
STM #0h,McBSP0_DXR1
STM #0h,McBSP0_DXR2
STM #0007h,GPIOCR
STM #0003h,GPIOSR
STM #SPCR2,McBSP2_SPSA
STM #00E1h,McBSP2_SPSD ;Mclk
NOP
STM #0007h,GPIOSR
STM #SPCR2,McBSP0_SPSA
STM #00E1h,McBSP0_SPSD ;Sclk & Fs
;----------------------------------------------------------------------------
;-----------------------------Program Starts----------------------
SSBX SXM
RSBX OVM
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
LD #0h,0,A
RPT #127
STL A,*AR1+
STM #1800h,AR1
STM #3500h,AR7
WAIT NOP
NOP
LD CNT,B
BC FFT,BEQ
NOP
NOP
B WAIT
_RINT0_ISR
PSHM AL
PSHM AH
PSHM AG
PSHM BL
PSHM BH
PSHM BG
LD *AR6+,0,A
STLM A,McBSP0_DXR1 ;o/p for R Channel
STLM A,McBSP0_DXR2 ;o/p for L Channel
LD CNT,B
SUB #1h,0,B
STL B,0,CNT
POPM BG
POPM BH
POPM BL
POPM AG
POPM AH
POPM AL
RETE
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
FFT NOP
NOP
LD #0,A
STLM A,IMR
STM #1000h,AR6
STM #1800h,AR1
STM #2000h,AR4
STM #1000h,AR3
RPT #127
MVDD *AR4+,*AR3+
LD #R1,DP
NOP
LD #80h,A
STL A,CNT
NOP
PORTW E,0
;------------Bit Reversal-----------------------
;------------For 128 pt FFT The Index value is 128/2=64(40H)-------------------
RPT #127
MVPD #2000h,*AR4+0B ;Bit Reversal
NOP
NOP
STM #2400h,AR5
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
LD #0h,0,A
STM #2800h,AR3
RPT #127
STL A,0,*AR3+
SU LD stages,0,A
LD grp,0,B
STL B,grp1
LD but,0,A
STM #2400h,AR5
STM #2800h,AR2
GU LD #40h,B
STLM B,BK
LD but,0,A
STL A,but1
LD #0h,0,B
SUB A,0,B
STL B,A1
STM #3000h,AR3
STM #3400h,AR4
BU LD #80h,B
STLM B,BK
LD *AR5,0,A
LD *AR2,0,B
STL A,0,R
STL B,0,I
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
LD but,0,A
STLM A,AR0
NOP
NOP
MAR *AR5+0%
MAR *AR2+0%
MPY *AR3,*AR5,A
MPY *AR4,*AR2,B
SUB B,0,A
STH A,R1
MPY *AR3,*AR2,A
MPY *AR4,*AR5,B
ADD A,0,B
STH B,I1
LD R,-1,A
LD R1,0,B
SUB B,0,A
STL A,*AR5
LD I,-1,A
LD I1,0,B
SUB B,0,A
STL A,*AR2
NOP
NOP
NOP
LD A1,0,B
STLM B,AR0
NOP
NOP
MAR *AR5+0%
MAR *AR2+0%
LD R,-1,A
LD R1,0,B
ADD B,0,A
STL A,*AR5+
LD I,-1,A
LD I1,0,B
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
ADD B,0,A
STL A,*AR2+ ;BUT
NOP
LD #40h,0,B
STLM B,BK
LD grp,0,A
STLM A,AR0
NOP
NOP
NOP
NOP
MAR *AR3+0%
MAR *AR4+0%
LD but1,0,B
SUB #1h,0,B
STL B,0,but1
BC BU,BNEQ ;;;;;Butterfly End
LD #80h,B
STLM B,BK
NOP
NOP
NOP
LD but,0,B
STLM B,AR0
NOP
NOP
MAR *AR5+0%
MAR *AR2+0%
LD grp1,0,B
SUB #1h,0,B
STL B,grp1
BC GU,BNEQ ;;;;;;;;Group End
NOP
LD but,0,B
SFTA B,1
STL B,but
STL B,but1
LD grp,0,B
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
SFTA B,-1
STL B,grp
STL B,grp1
LD stages,0,A
SUB #1h,0,A
STL A,stages
BC SU,ANEQ ;;;;;;;;;STAGES
LD #0h,0,A
LD #0h,0,B
;-------------------Initialization of Variables-----------------------
LD #7h,0,B
STL B,stages
LD #40h,0,A
STL A,grp
LD #1h,0,B
STL B,but
STM #2400h,AR3
STM #1800h,AR6
STM #7Fh,BRC
RPTB VE
LD *AR3+,A
ABS A
STL A,*AR6+
NOP
VE NOP
NOP
STM #1800h,AR6
LD #0017h,A
STLM A,IMR
NOP
NOP
B WAIT
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
RESULT:
Thus the finite impulse response (FIR) filter is successfully implemented and
verified.
ANNEXURE
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
Objective:
To configure the Multichannel Buffered Serial Port for a talk through program using the
chip support library.
Prerequisites
TMS320C5416 DSP Starter Kit, PC with Code Composer Studio, CRO, Audio Source,
Speakers and Signal Generator.
Procedure
• All the Real time implementations covered in the Implementations module follow
McBSP Configuration using chip support library.
• The Chip Support Library (CSL) is a collection of functions, macros, and symbols
used to configure and control on-chip peripherals.
• The goal is peripheral ease of use, shortened development time, portability,
hardware abstraction, and some level of standardization and compatibility among
TI devices.
• CSL is a fully scalable component of DSP/BIOS. It does not require the use of
other DSP/BIOS components to operate.
Steps:
1. Connect CRO to the Socket Provided for SPKR OUT.
2. Connect a Signal Generator to the LINE IN Socket.
3. Switch on the Signal Generator with a sine wave of frequency 500 Hz.
4. Now Switch on the DSK and Bring Up Code Composer Studio on the PC.
5. Create a new project with name McBSP_init.pjt.
6. From the File Menu new DSP/BIOS Configuration select “dsk5416.cdb”
and save it as “mcbsp_init.cdb” and add it to the current project.
7. Double click on the “mcbsp_init.cdb” from the project explorer and double click on
the “chip support library” explorer.
8. Double click on the “MCBSP” under the “chip support library” where you can see
“MCBSP Configuration Manager” and “MCBSP Resource Manager”.
9. Right click on the “MCBSP Configuration Manager” and select “Insert
mcbspCfg” where you can see “mcbspCfg0” appearing under “MCBSP
Configuration Manager”.
10. Right click on “mcbspCfg0” and select properties where “mcbspCfg0 properties”
window appears.
11. Under “General” property set “Breakpoint Emulation” to “Do Not Stop”.
12. Under “Transmit modes” property set “clock polarity” to “Falling Edge”.
13. Under “Transmit Lengths” property set “Word Length Phase1” to “32-bits” and
set “Words/Frame phase1” to “2”.
14. Under “Receive modes” property set “clock polarity” to “Rising Edge”.
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
15. Under “Receive Multichannel” property set “Rx Channel Enable” to “All 128
Channels”.
16. Under “Transmit Multichannel” property set “Tx Channel Enable” to “All 128
Channels”.
17. Under the Receive Lengths property set “Word Length Phase1” to “32-bits” and set
“Words/Frame phase1” to “2”.
18. Under the “Sample-Rate Gen” property set “Generator Clock Source” to “BCLKR
pin”. Set “Frame Width” to “32” and “Frame period” to “64”.
19. Select “Apply” and click “O.K”.
20. Select “McBSP2” under the “MCBSP Resource Manager”.
21. Right click on “McBSP2” and select properties where a “McBSP2 Properties”
Window appears. Enable the “Open handle to McBSP” option and
Preinitialization” option. Select “msbspCfg0” under the “Pre-initialize” pop-up
menu and change the “Specify Handle Name” property to
“C54XX_DMA_MCBSP_hMcbsp”. Select “Apply” and click “O.K”.
22. Add the given “mcbsp_io.c” file to the current project which has the main function
and calls all the other necessary routines.
23. Add the generated “mcbsp_initcfg.cmd” file to the current project.
24. View the contents of the generated file “mcbsp_initcfg_c.c” and copy the include
header file at line 8 to the “mcbsp_io.c” file.
25. Add the library file “dsk5416f.lib” from the location
“C:\ti\C5400\dsk5416\lib\dsk5416f.lib” to the current project
26. Select projectbuild optionsCompilerAdvance and enable the “use Far
calls” option.
27. Build, Load and Run the program.
28. You can notice the input signal of 500 Hz. appearing on the CRO verifying the
McBSP configuration.
29. You can also pass an audio input and hear the output signal through the speakers.
30. You can also vary the sampling frequency using the DSK5416_PCM3002_setFreq
Function in the “mcbsp_io.c” file and repeat the above steps.
Conclusion:
The Multichannel Buffered Serial Port is successfully configured using the chip
support library and verified.
2.Define MAC.
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
Multiply Accumulate with Data Shift,multiplies the content of the program memory with
the content of the data memory with address dma and stores the result in the product register.The
content of the product register is added to the accumulator before the new product is
stored.Further,the content of dma is copied to the next location whose address is dma+1.
4.What is TMS320C5X?
It belongs to the Fifth Generation of the Texas Instruments TMS320 family of DSPs.It
consists of 16 bit fixed point and 32 bit floating point single chip DSPs.These DSPs posseses the
operational flexibility ofhigh speed controllers and the numerical capability of array processors.C
implies that CMOS technology is used.
i.Program Bus
ii.ProgramAddress Bus
iii.Data Read Bus
iv.Data Read Address Bus
i.Clock Generator
ii.Hardware Timer
iii.Software Programmable Wait State Generation
iv.Parallel I-O Ports
v.Host Port Interface
vi.Serial Port
SIT/ECE/2021-22/L5/ 15UEC727- SIGNAL PROCESSING LABORATORY
i.Direct Addressing
ii.Memory mapped register addressing
iii.Indirect Addressing.
iv.Immediate Addressing
v.Dedicated register addressing
vi.Circular addressing
i.Fetching
ii.Decoding
iii.Reading
iv.Execution are the operations performed simultaneously using 4-phase clock.