DSP Lab 2019-20
DSP Lab 2019-20
* Visit https://vtuconnect.in for more info. For any queries or questions wrt our
platform contact us at: support@vtuconnect.in
VTU Connect Android App Download Now On Google Play Store
LABORATORY MANUAL
MISSION:
• To keep pace with advancements in knowledge and make the students competitive and capable at
the global level.
• To create an environment for the students to acquire the right physical, intellectual, emotional and
moral foundations and shine as tourch bearers of tomorrow's society.
• To strive to attain ever-higher benchmarks of educational excellence
VISION:
Development of academically excellent, culturally vibrant, socially responsible and globally competent
human resources.
VISION
To develop highly skilled and globally competent professionals in the field of Electronics and
Communication Engineering to meet industrial and social requirements with ethical responsibility.
MISSION
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 1
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
PO2. Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
PO3. Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and
environmental considerations.
PO5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
PO6. The engineer and society: Apply reasoning informed by the contextual knowledge to
assess societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
PO7. Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and
need for sustainable development.
PO8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
PO9. Individual and team work: Function effectively as an individual, and as a member or
leader in diverse teams, and in multidisciplinary settings.
PO11. Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member
and leader in a team, to manage projects and in multidisciplinary environments.
PO12. Life-long learning: Recognize the need for, and have the preparation and ability to
engage in independent and life-long learning in the broadest context of technological
change.
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 2
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
• Graduates will have a successful professional career and will be able to pursue higher
education and research globally in the field of Electronics and Communication
Engineering thereby engaging in lifelong learning.
• Graduates will be able to analyse, design and create innovative products by adapting to
the current and emerging technologies while developing a conscience for environmental/
societal impact.
• Graduates with strong character backed with professional attitude and ethical values will
have the ability to work as a member and as a leader in a team.
• Graduates with effective communication skills and multidisciplinary approach will be
able to redefine problems beyond boundaries and develop solutions to complex problems
of today’s society.
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 3
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
VTU SYLLABUS
2 Linear and circular convolution of two given sequences, Commutative, distributive and associative property
of convolution.
3 Auto and cross correlation of two sequences and verification of their properties
5 Computation of N point DFT of a given sequence and to plot magnitude and phase spectrum (using
DFT equation and verify it by built-in routine).
6 (i) Verification of DFT properties (like Linearity and Parseval’s theorem, etc.)
(ii) DFT computation of square pulse and Sinc function etc.
7 Design and implementation of Low pass and High pass FIR filter to meet the desired specifications
(using different window techniques) and test the filter with an audio file. Plot the spectrum of audio
8 signal
Designbefore and after filtering.
and implementation of a digital IIR filter (Low pass and High pass) to meet given
specifications and test with an audio file. Plot the spectrum of audio signal before and after filtering
PART-B : Experiments to be done using DSP kit
9 Obtain the Linear convolution of two sequences.
12 Determine the Impulse response of first order and second order system.
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 4
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
SCILAB: SCILAB is a software package for high performance numerical computation and
visualization provides an interactive environment with hundreds of built in functions for
technical computation, graphics and animation. The diagram 1 shows the main features and
capabilities of SCILAB.
SCILAB
GRAPHICS EXTERNAL
COMPUTATIONS
2-D Graphics INTERFACE
Linear Algebra
3 –D Graphics Interface with C and
Signal Processing
Animations FORTAN language
Polynomial and
interpolation
Quadrature solution
of ODE’S
TOOL BOX
Signal Processing Image Processing
Statistics Control Systems
Neural Network Communications
It also allows you to put a list of your processing requests together in a file and save that
combined list with a name so that you can run all of those commands in the same order at some
later time. Furthermore, it allows you to run such lists of commands such that you pass in data
and/or get data back out (i.e. the list of commands is like a function in most programming
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 5
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
languages). Once you save a function, it becomes part of your toolbox (i.e. it now looks to you as
if it were part of the basic toolbox that you started with).
For those with computer programming backgrounds: Note that SCILAB runs as an
interpretive language (like the old BASIC). That is, it does not need to be compiled. It simply
reads through each line of the function, executes it, and then goes on to the next line. (In practice,
a form of compilation occurs when you first run a function, so that it can run faster the next time
you run it.
SCILAB Windows:
SCILAB works with through three basic windows
Command Window: This is the main window. It is characterized by SCILAB command prompt
>> when you launch the application program SCILAB puts you in this window all commands
including those for user-written programs ,are typed in this window at the SCILAB prompt
Graphics window: the output of all graphics commands typed in the command window are
flushed to the graphics or figure window, a separate gray window with white background color
the user can create as many windows as the system memory will allow
Edit window: This is where you write edit, create and save your own programs in files called M
files.
INPUT-OUTPUT:
SCILAB supports interactive computation taking the input from the screen and flushing,
the output to the screen. In addition it can read input files and write output files
Data Type: the fundamental data –type in SCILAB is the array. It encompasses several distinct
data objects- integers, real numbers, matrices, character strings, structures and cells. There is no
need to declare variables as real or complex, SCILAB automatically sets the variable to be real.
Dimensioning: Dimensioning is automatic in SCILAB. No dimension statements are required
for vectors or arrays .we can find the dimensions of an existing matrix or a vector with the size
and length commands.
1. T = 0: 1:10
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 6
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
This instruction indicates a vector T which as initial value 0 and final value 10 with an increment
of 1. Therefore T = [0 1 2 3 4 5 6 7 8 9 10]
2. F= 20: 1: 100
Therefore F = [20 21 22 23 24 ……… 100]
3. T= 0:1/pi: 1
Therefore T= [0, 0.3183, 0.6366, 0.9549]
4. Zeros (1, 3)
The above instruction creates a vector of one row and three columns whose values are zero
Output= [0 0 0]
5. Ones (5,2)
The above instruction creates a vector of five rows and two columns
Output = 1 1
11
11
11
11
6. Zeros (2, 4)
Output = 0 0 0 0
0000
7. a = [ 1 2 3] , b = [4 5 6]
THEN a.*b = [4 10 18]
i.e. [4*1 5*2 6*3]
8. if C= [2 2 2] and b = [4 5 6]
b.*C results in [8 10 12]
9. Plot (t, x)
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 7
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
If x = [6 7 8 9] and t = [1 2 3 4]; this instruction will display a figure window which indicates the
plot of x versus t as shown in the figure 2
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 8
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 9
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
Ramp Signal
Exponential Signal
Sine wave
x(n) = Sin n
x(n) = Sin t
Cosine wave
x(n) = Cos n
x(n) = Cos t
PROGRAM
clc; % clear screen
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 10
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
subplot(2,2,3);
% to generate exponential
N2 = input('enter the length N2 = '); % define the length of unit step signal
exponential
subplot(2,2,4);
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 11
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
OUTPUT:
Enter the value of N = 10
enter the value of N1 = 10
enter the length N2 = 6
enter the value of a = 3
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 12
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
VIVA QUESTIONS:
1. Define Signal.
A signal is defined as any physical quantity that varies with time, space or any other
independent variable or variables
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 13
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
The digital signal is same as discrete signal except that the magnitude of the signal is
quantized. The magnitude of the signal can take one of the values in a set of quantized values.
Here quantization is necessary to represent the signal in binary codes.
6. How will you classify the discrete time signals?
The discrete time signals are classified depending on their characteristics. Some ways
of classifying discrete time signals are (a) Energy signals and Power signals, (b) Periodic and
Aperiodic signals, (c) Symmetric and Anti symmetric signals.
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 14
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
SAMPLING THEOREM
AIM: Verification of sampling theorem.
Objectives:
• After completing this experiment, student will be able to verify sampling theorem using
SCILAB.
• Study the importance of Sampling Theorem with its conditions.
• Study the plotting of frequency spectrum for all the cases of sampling theorem.
THEORY:
Sampling: Is the process of converting a continuous time signal into a discrete time signal. It is
the first step in conversion from analog signal to digital signal.
Sampling theorem: Sampling theorem states that “Exact reconstruction of a continuous time
base-band signal from its samples is possible, if the signal is band-limited and the sampling
frequency is greater than twice the signal bandwidth” i.e., fs> 2W, where W is the signal
bandwidth.
Nyquist Rate Sampling: The Nyquist rate is the minimum sampling rate required to avoid
aliasing, equal to the highest modulating frequency contained within the signal. In other words,
Nyquist rate is equal to two sided bandwidth of the signal (Upper and lower sidebands) i.e., fs =
2W.To avoid aliasing, the sampling rate must exceed the Nyquist rate. i.e., fs>fN, where fN =2W.
PROGRAM LOGIC:
1.Select the frequency of analog signal f Hz
2.To generate sine wave of f Hz define a closely spaced time vector
3.Generate the sinusoid and plot the signal Select the sampling frequency fs= 10f samples/sec.
Generate a suitable time scale for this sampling signal
4.Sample the analog signal at the instant specified by n.
5.Modify the time vector n used for discrete simulation
6.Reconstruct the analog signal from its discrete samples
8. Compare the analog and reconstructed signal
9. Repeat the values experiment for different values of f and verify reconstructed and analog
signal
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 15
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
close all; % close all figure windows); % enter the analog frequency
fd= input('enter the analog frequency'); % define analog signal
% define analog signal for comparison
xt = sin(2*pi*fd*t); % define analog signal
% simulate condition for under sampling
fs1 = 1.3*fd;
n1= 0: 1/fs1: tfinal; % define time vector for discrete signal
xn = sin(2*pi*n1*fd);% to generate under sampled signal
% plot the analog and sampled signal
subplot(3,1,1);
plot(t,xt,'b',n1,xn,'r*-');
title('under sampling');
% simulate condition for Nyquist rate
fs2= 2*fd; ;% simulate condition for nyquist rate
n2= 0:1/fs2:tfinal; % define time vector for discrete signal .
xn = sin(2*pi*n2*fd); % to generate under sampled signal
subplot(3,1,2);
plot(t,xt,'b',n2,xn,'r*-'); );% plot the analog and sampled signal
title('nyquist rate');
% simulate condition for over sampling
fs3 = 2.5*fd;
n3= 0:1/fs3:tfinal;
xn = sin(2*pi*n3*fd);%generate over sampling signal
subplot(3,1,3);
plot(t,xt,'b',n3,xn,'r*-'); );% plot the analog and sampled signal
title('over sampling');
OUTPUT:
enter the analog wave frequency = 500
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 16
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
OUTCOMES:
The advantages of DSP are (i) programs can be modified easily for better performance;
(ii) Better accuracy can be achieved by using adaptive algorithms, (iii) digital signals can be
easily stored and transported, (iv)digital systems are cheaper than analog equivalent.
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 17
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
Speech coding & decoding Audio mixing & editing, speech encryption & decryption
Image compression & decompression, Speech recognition, Image compression and processing.
When a discrete time signal x(n) satisfies the condition x(n) = x(n+N), then it is
called periodic, with periodicity of N samples.
When processing the analog signal using DSP System, it is sampled at some rate
depending upon the bandwidth. The rate of sampling is decided by the Nyquist criterion.
However, signals that are found in physical systems will never be strictly band limited. To
eliminate signal content beyond the desired bandwidth, anti-aliasing filter is used. The filter
cannot be a digital filter. This is because anti-alias filtering is required to be performed in the
analog domain prior to applying the signal to A/D converter where aliasing would take place.
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 18
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
• To find linear convolution of both sided sequence using inbuilt SCILAB function “CONV” and
its theoretical method to verify the result
Mathematical Formula:
The linear convolution of two continuous time signals x(t) and h(t) is defined by
Where x(n) is the input signal and h(n) is the impulse response of the system.
ALGORITHM:
1. Input the two sequences x1 and x2
2. Use conv to get convoluted output.
3. Plot the sequences.
PROGRAM LOGIC:
The convolution Sum is given by
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 19
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
1. The impulse response h[k] is time reversed (that is reflected about the origin) to obtain h[-k]
and then shifted by n to form h[n-k]=h[-(k-n)] which is a function of K with Parameter n.
2. Two sequences x[k] and h[n-k] are multiplied together for all values of k with n fixed at some
value
3. The product x[k]h[n-k] is summed over all k to produce a single output sample y[n]
4. Steps 1 to 3 are repeated as n varies over -∞ to +∞ o produce the entire output y[n]
CALCULATION:
On simplification we get,
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 20
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
%graphical display
subplot(2,2,1); % divide the display screen in four sections and choose the first one to display
plot2d3 (x1); % plot the first sequence
xlabel('n'); % label x axis
ylabel('x1(n)'); % label y axis
title('plot of x1(n)'); % graph title
subplot(2,2,2); %divide the display screen in four sections and choose the first second to display
plot2d3 (x2); % plot the second sequence
xlabel('n'); % label x axis
ylabel('x2(n)'); % labely axis
title('plot of x2'); % graph title
subplot(2,1,2); );% divide the display screen in four sections and choose the first second to
display
plot2d3 (x2); % plot the second sequence
xlabel('n'); % label x axis
ylabel('y(n)'); % label y axis
title('convolution output'); % graph title
OUTPUT:
enter the first sequence x1(n) = [1 2 3 4]
enter the second sequence x2(n) = [3 6 7 2]
Linear convolution of x1 and x2 is = 3 12 28 46 49 34 8
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 21
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
CIRCULAR CONVOLUTION
THEORY: Let x1(n) and x2(n) are finite duration sequences both of length N with DFT’s X1(k)
and X2(k). Convolution of two given sequences x1(n) and x2(n) is given by the equation,
x3(n) = IDFT[X3(k)]where X3(k) = X1(k) X2(k)
𝑁−1
𝑥3(𝑛) = ∑𝑚=0 𝑥1(𝑚)𝑥2((𝑛 − 𝑚)) 𝑁
ALGORITHM:
1. Input the two sequences x and h
2. Circularly convolve both to get the output of y.
3. Plot the sequences.
PROGRAM LOGIC:
1.Read the first input sequence, x[n] and plot.
7.For each output sample access the samples of y[n] in cyclic order.
8.Find the sum of products of x[n] and cyclically folded and shifted h[n] to get circular
convoluted output.
EXAMPLE:
Let’s take x1(n) = {1, 1, 2, 1} and x2(n) = {1, 2, 3, 4}
x3(0) = x1(m) x2(-m)
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 22
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
i=i+N;
end
y(n+1) =y(n+1)+hn(m+1)*xn(i+1);
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 23
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
end
end
disp('Circular convolution in Time Domain = ');
disp(y); % display the output
subplot(2,2,1); % graphical plot the first input sequence
plot2d3 (xn);
xlabel('n');
ylabel('x(n)');
title('Plot of x(n)');
subplot(2,2,2); % graphical plot the second input sequence
plot2d3 (hn);
xlabel('n');
ylabel('h(n)');
title('Plot of h(n)');
subplot(2,2,3); % graphical plot the output sequence
plot2d3 (y);
xlabel('n');
ylabel('y(n)');
title('Circular Convolution Output');
OUTPUT:
enter the first sequence x(n) = [1 2 3]
enter the second sequence h(n) = [1 5 6 7]
Circular convolution in Time Domain =
33 28 19 34
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 24
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
OUTPUT:
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 25
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 26
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
x1=[1 3 5 7]
x2=[-1 1 2 3]
x3=[2 4 -1 3]
y1=conv(x2,x3)
y2=conv(y1,x1)
disp('x1(n)*(x2(n)*x3(n))=',y2)
n1=0:1:(length(x1)-1)
n2=0:1:(length(x2)-1)
n3=0:1:(length(x3)-1)
m1=0:1:(length(y2)-1)
subplot(2,3,1)
plot2d3(n1,x1)
xlabel('samples')
ylabel('magnitude')
title('x1(n)')
subplot(2,3,2)
plot2d3(n2,x2)
xlabel('samples')
ylabel('magnitude')
title('x2(n)')
subplot(2,3,3)
plot2d3(n3,x3)
xlabel('samples')
ylabel('magnitude')
title('x3(n)')
subplot(2,3,4)
plot2d3(m1,y2)
xlabel('samples')
ylabel('magnitude')
title('x1(n)*(x2(n)*x3(n))')
y3=conv(x1,x2)
y4=conv(y3,x3)
m4=0:1:(length(y4)-1)
subplot(2,3,5)
plot2d3(m4,y4)
title('(x1(n)*x2(n))*x3(n)')
disp('x1(n)*(x2(n)*x3(n))=(x1(n)*x2(n))*x3(n)')
x1(n)*(x2(n)*x3(n))=
x1(n)*(x2(n)*x3(n))=(x1(n)*x2(n))*x3(n)
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 27
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
b=[1 2 3 4]
n2=0:1:length(b)-1
subplot(4,2,2)
plot2d3(n2,b)
title('second input sequence')
xlabel('n2')
ylabel('b')
c=[1 2 3 4]
n3=0:1:length(c)-1
subplot(4,2,3)
plot2d3(n3,c)
title('third input sequence')
xlabel('n3')
ylabel('c')
y1=conv(b,c)
N1=0:1:length(y1)-1
subplot(4,2,4)
plot2d3(N1,y1)
title('y1=b*c')
xlabel('y1')
ylabel('N1')
disp('b*c')
disp(y1)
y2=conv(a,y1)
N2=0:1:length(y2)-1
subplot(4,2,5)
plot2d3(N2,y2)
title('y2=a*y1')
xlabel('y2')
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 28
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
ylabel('N2')
disp('a*(b*c)')
disp(y2)
y3=conv(a,b)
N3=0:1:length(y3)-1
subplot(4,2,6)
plot2d3(N3,y3)
title('y3=a*b')
xlabel('y3')
ylabel('N3')
disp('a*b')
disp(y3)
y4=conv(c,y3)
N4=0:1:length(y4)-1
subplot(4,2,7)
plot2d3(N4,y4)
title('y4=c*y3')
xlabel('y4')
ylabel('N4')
disp('(a*b)*c')
disp(y4)
disp('a*(b*c)=(a*b)*c')
disp('Hence Associative Property is Verified')
OUTPUT:
b*c
1. 4. 10. 20. 25. 24. 16.
a*(b*c)
a*b
(a*b)*c
a*(b*c)=(a*b)*c
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 29
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 30
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 31
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
2. 4. 6. 8.
2. 8. 20. 40. 50. 48. 32.
1. 4. 10. 20. 25. 24. 16.
1. 4. 10. 20. 25. 24. 16.
2. 8. 20. 40. 50. 48. 32.
OUTCOMES:
• To Study the importance of linear and circular convolution with its mathematical
expression.
• To calculate the output for any linear time invariant system given its input and its impulse
response linear convolution is used as basic operation.
Viva Questions:
1. What is the length of linearly convolved signals?
Length of linearly convolved signal is always equal to N = L + M - 1 where L is length of
first signal and M is length of second signal.
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 32
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
signals i.e., if H[a1x1(n) + a2x2(n)] = a1H[x1(n)] +a2H[x2(n)]. If the system does not satisfy the
above condition then it is non-linear.
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 33
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
periodic with period = N where N = max (L, M) where L is the length of first signal and M is
length of second signal.
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 34
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
THEORY: Correlation: Correlation determines the degree of similarity between two signals. If
the signals are identical, then the correlation coefficient is 1; if they are totally different, the
correlation coefficient is 0, and if they are identical except that the phase is shifted by exactly
1800(i.e. mirrored), then the correlation coefficient is -1.
Autocorrelation: The Autocorrelation of a sequence is correlation of a sequence with itself. The
autocorrelation of a sequence x(n) is defined by,
𝑅𝑥𝑥(𝑘) = ∑∞
𝑛=−∞ 𝑥(𝑛) 𝑥(𝑛 − 𝑘)k = 0, ±1, ±2, ±3…
Properties of Autocorrelation:
1. Periodicity: Rxx(k0) = Rxx(0) then Rxx(k) is periodic with period k0
2. Autocorrelation function is symmetric. i.e. Rxx(m) = Rxx(-m)
3. Mean square value: autocorrelation function at k=0, is equal to mean square value of the
process. Rxx(0) = E{|x(n)|2}≥0
ALGORITHM:
1. Input the sequence as x.
2. Use the ‘xcorr’ function to get auto correlated output r.
3. Plot the sequences.
PROGRAM LOGIC:
1. Read the input sequence x[n]
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 35
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
CALCULATION:
X(n) ={ 3, 4, 5, 6}
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 36
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
Rxx = [ 18 39 62 86 62 39 18]
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 37
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
Rxx_Right = Rxx(center_index:1:length(Rxx));
% take the right side values
Rxx_left = Rxx(center_index:-1:1);
% take the left side values
if Rxx_Right == Rxx_left
disp('Rxx is even');
% display the resultelse
disp('Rxx is not even'); % display the result
end
OUTPUT:
Enter the input signal x[n] [3 4 5 6]
Rxx = [ 18 39 62 86 62 39 18]
Rxx_0 = 30
Rxx(0) gives energy -- proved
Rxx is even
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 38
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
THEORY: When two independent signals are compared, the procedure is known as cross
correlation. It is given by,
∞
Rxy (k) = ∑𝑛=−∞ x(n) y(n − k) k = 0, ±1, ±2, ±3 …
Where k is the shift parameter
Or equivalently
∞
Comparing above two equations, we find that, Rxy (k) = Ryx (-k), Where Ryx (-k) is the folded
version of Rxy (k) about k = 0. So, we can write Cross correlation of the two sequences is given
by,
Equation (1) shows that cross correlation is the essentially the convolution of two sequences in
which one of the sequences has been reversed.
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 39
VTU Connect Android App Download Now On Google Play Store
DIGITAL SIGNAL PROCESSING LAB 18ECL57
CALCULATION:
VTU Connect
DEPT. OF ECE, Android App
ATMECE, MYSURU Download Now On Google Play Store
Page 40
VTU Connect Android App Download Now On Google Play Store
Rxy = [2 5 10 16 12 11 4]
xlabel('n');
ylabel('x(n)');
title('plot of x(n)');
n2 = length(y)-1; % graphical plot of second input sequence
title('cross correlation
output');x= input(“seq1’); % Property Rxy(-k) = Ryx(k)
y = input(‘seq2’);
Rxy = xcorr(x,y);
Ryx=xcorr(y,x);
Rxy1 = fliplr(Rxy);
if Rxy1 = Ryx
OUTPUT:
Enter the first sequence x(n) = [1 5 6 7]
Enter the second sequence y(n) = [3 4 2 1]
Cross Correlation Output = 1 7 20 42 53 46 21
Viva Questions:
1. What is correlation?
Correlation gives a measure of similarity between two data sequences. In this process, two
signals are compared and the degree to which the two signals are similar is computed.
Typical applications of correlation include speech processing, image processing and radar systems.
In a radar system, the transmitted signal is correlated with the echo signal to locate the position of the
target. Similarly, in speech processing systems, different waveforms are compared for voice
recognition.
1. To solve the given difference equation(response of the filter) by varying the input
sequences as “Impulse input, Exponential input and Sinusoidal input” with and without
initial conditions using an inbuilt SCILAB FILTER function.
THEORY: A General Nth order Difference equations looks like,y[n] + a1y[n-1] + a2y[n-2] + …+
aNy[n-N) = b0x[n] + b1x[n-1] + …. + bMx[n-M]. Here y[n] is “Most advanced” output sample and
y[n-m] is “Least advanced” output sample. The difference between these two index values is the
order of the difference equation. Here we have: n-(n-N) = N
We can rewrite the above equation as,
y[n] + ∑aiy[n-i] = ∑bi x[n-i]
y[n] becomes,
y[n] = -∑aiy[n-i] + ∑bi x[n-i]
EXAMPLE:
y[n+2] – 1.5y[n+1] + y[n] = 2x[n]
In general we start with the “Most advanced” output sample. Here it is y [n+2].
So, here we need to subtract 2 from each sample argument. Thus we get
y[n] – 1.5y[n-1] + y[n-2] = 2x[n-2]
y[n] = 1.5y[n-1] - y[n-2] + 2x[n-2]
Let us assume our input x[n] = u[n] = 0 x<0
1 x≥0
In our example we have taken x[n] = u[n] = 0 x<0
1 0 ≤ x < 10
We need N past values to solve Nth order difference equation.
y [-2] = 1
5. Find the response y[n] of the system defined by A and B coefficients to the input
excitation using filter command
6. Display and plot the impulse, step, exponential and steady state response y[n]
Step Response:
Enter the length of response = 10
Response of filter =
-1.0000 0.7500 0.8125 1.4844 1.6758 1.9756 2.1223 2.2714 2.3637 2.4427
OUTCOMES:
Acquire the knowledge of construction of different types of digital filters.
Viva Questions:
1. What is Infinite Impulse Response?
When length of h[n] is infinite it is called infinite impulse response. E.g. h[n] = ( ½ )n u[n]
The transfer function of an LTI system is defined as the ratio of Z transform of output to Z
transform of input.
Signal is processed with the same speed it is captured. Signal is captured, sampled and
processed with the same speed. Signal is not stored before processing. Entire input signal never
available before processing. Processed signal can be stored. For example, in digital telephone
system, Signal is captured, Sampled, Processed, and Transmitted and made it available to the end
user. Real Time Processing is Online Processing.
N-point DFT
AIM: To compute n-point DFT of a given sequence and to plot magnitude and phase spectrum.
OBJECTIVES:
After completion of this experiment the students are able to compute the N point DFT of a given sequence
and to plot magnitude and phase spectrum.
THEORY: Discrete Fourier Transform is a powerful computation tool which allows us to evaluate
the Fourier Transform X(ejω) on a digital computer or specially designed digital hardware. Since
X(ejω) is continuous and periodic, the DFT is obtained by sampling one period of the Fourier
Transform at a finite number of frequency points. Apart from determining the frequency content of
a signal, DFT is used to perform linear filtering operations in the frequency domain.The sequence
of N complex numbersx0,...,xN−1 is transformed into the sequence of N complex numbers X0, ...,
XN−1 by the DFT according to the formula:
𝑁−1
X(k) = ∑n=0 x(n)e − j2πnk/N k = 0,1, …. N-1
EXAMPLE:
Let us assume the input sequence x[n] = [1 1 0 0]
We have,
𝑁−1
X(k) = ∑n=0 x(n)e − j2πnk/N k = 0,1, …. N-1
For k = 0,
3
X(0) = ∑ x(n)
𝑛=0
𝑁−1
j2πnk
ImX(k) = − ∑ x(n)sin ( ) k = 0,1, …. N-1
n=0 N
Viva Questions:
y=
1. 2. 3. 4.
DFT(x(n)+y(n))=
16. - 3. + 3.i - 2. - 3. - 3.i
X(k)+Y(k)=
16. - 3. + 3.i - 2. - 3. - 3.i
DFT(x(n)+y(n))=X(k)+Y(k).Hence linearity property is verified.
//Verification of Parsevals theorem//
clc;
clf;
x=[1 1 2 2] ) ]//To verify the properties define 2 input sequence.
y=[1 2 3 4]
X=fft(x) )//Calculate the DFTs of the 2 defined Sequences.
sum (x(n).y*(n))=
17.
sum(X(k).Y*(k))/N=
17.
DFT(x(n).y*(n))=X(k).Y*(k).Hence,Parsevals theorem is verified
// circular convolution in time domain is same as multiplication in frequency domain
clc;
clf;
function [y]=circ(x1, x2)
N=max(length(x1),length(x2))
for n=0:1:N-1
y(n+1)=0
for m=0:1:N-1
i=pmodulo((n-m),N)
if i<0 then
i=i+N;
end
y(n+1)=y(n+1)+(x1(m+1)*x2(i+1));
end
end
endfunction
x=[1 1 2 2] ]//To verify the properties define 2 input sequence.
y=[1 2 3 4]
disp(x)
disp(y)
d1=circ(x,y)//Obtain the circular convolution of 2 sequences
d2=circ(y,x)
OUTPUT:
9.
1. 1. 1. 1. - 1. - 1. - 1. 1. 1.
column 1 to 9
column 1 to 9
OUTPUT:
50.
column 1 to 7
column 8 to 14
column 15 to 21
column 29 to 35
column 36 to 42
column 43 to 49
column 50
10.
column 1 to 7
column 8 to 14
column 15 to 21
column 22 to 28
column 29 to 35
column 36 to 42
column 43 to 49
column 50 162.50991
column 1 to 7
column 8 to 14
column 15 to 21
column 22 to 28
column 29 to 35
column 36 to 42
column 43 to 49
column 50
- 1.6336282
OUTCOMES:
OBJECTIVES:
After completing this lab, student will be able to Study the importance of windows to design FIR filter
THEORY: The FIR filters are of non-recursive type, whereby the present output sample is
depending on the present input sample and previous input samples. The transfer function of a FIR
causal filter is given by,
𝑁−1
𝐻(𝑍) = ∑𝑛=0 h(n)z-n
This is known as Fourier series coefficients having infinite length. One possible way of obtaining
FIR filter is to truncate the infinite Fourier series at n = ± [(N-1)/2] Where N is the length of the
desired sequence.
The Fourier coefficients of the filter are modified by multiplying the infinite impulse response with
a finite weighing sequence w(n) called a window.
Where w(n) = w(-n) ≠ 0 for |n| ≤ [(N-1)/2]
=0 for |n| > [(N-1)/2]
After multiplying w(n)with hd(n), we get a finite duration sequence h(n) that satisfies the desired
magnitude response,
EXAMPLE:
Here we design a low pass filter using hamming window. Hamming window function is given by,
wH(n) = 0.54 + 0.46 cos ((2πn)/(N-1)) ;–(N-1)/2 ≤ n ≤ (N-1)/2
=0 ; otherwise
The frequency response of Hamming window is,
WH(ejw) = 0.54[(sin(wN/2))/(sin(w/2)) + 0.23[sin (wN/2 – πN/N – 1)/sin (w/2 – π/N -1)]+ 0.23[sin
(wN/2 + πN/N – 1)/sin (w/2 + π/N – 1)]
ALGORITHM:
1. Input the Pass and Stop band edge in radians.
2. Compute N=order of the filter.
3. Obtain cutoff frequency of the filter.
4. Obtain Impulse response of FIR filter
5. Plot the Response of the filter.
OUTPUT:
enter the Pass band edge in radians = 0.375*pi
enter the stop band edge in radians = 0.5*pi
Order of the FIR filter N = 65
OUTCOME:
This experiment enables the students to acquire the knowledge of advantage and disadvantages of filter
design using various windows techniques..
Viva Questions:
7. How to find output of FIR filter for real time input signal?
10. What is the role of window in the design of FIR filter? Name the few types of windows.
FIR filter is designed by truncating infinite samples of hd[n] by using window function.
Examples of window function include, Hamming window, Bartlet Window, Hanning window,
Blackman window etc.
11. Why rectangular window is not preferred for FIR filter design?
Rectangular window function has As = 21 db which is very small compared to other
window function. Larger value of as desired.
12. Explain how to find output of digital FIR filter in real time application.
In real time applications, output of FIR filter is obtained using overlap add method /
overlap save method.
15. Explain how to find output of digital FIR filter in real time application.
In real time applications, output of FIR filter is obtained using overlap add method /
overlap save method.
OBJECTIVES:
After completing this lab, student will be able to Study the importance of Butterworth filter and
Chebyshev filter approximation to design IIR filter.
∑|h(n)| < ∞
𝑛=0
ALGORITHM:
1. From the given specifications find the order of the filter N.
2. Round off it to the next higher integer.
3. Find the transfer function H(s) for Ωc = 1rad/sec for the value of N.
4. calculate the value of cutoff frequency Ωc
5. find the transfer function Ha(s) for the above value of Ωc by substituting
s→ (s/ Ωc) in H(s).
6. Plot the frequency response of the filter.
OUTPUT:
enter the Pass band edge frequency in Hz = 500
enter the stop band frequency in Hz = 750
enter the sampling frequency in Hz = 2000
enter the pass band ripple n db = 3.01
enter the stop band attenuation in db = 15
order of the filter N = 2
Normalised cutoff frequency = 2.052
num/den = 0.30053 z^2 + 0.60106 z + 0.30053
---------------------------------
z^2 + 0.030385 z + 0.17174
OUTPUT:
enter the Pass band edge frequency in Hz = 100
enter the stop band frequency in Hz = 500
enter the sampling frequency in Hz = 4000
enter the pass band ripple n db = 2
enter the stop band attenuation in db = 20
order of the filter N = 2
Normalised cutoff frequency = 0.1574
num/den =
0.0037904 z^2 + 0.0075808 z + 0.0037904
---------------------------------------
OUTCOME:
This experiment enables students to design and implement various IIR filters using less memory
and calculations.
Viva Questions:
1. What is Infinite Impulse Response (IIR) filter?
If the impulse response of the system is of infinite duration, the system is said to be IIR
filter system.
2. How to find output of IIR filter for real time input signal?
In real time application entire input is not available and input signal has to be processed
online. Length of input signal depends on application. It can be long sequence also. In IIR filter
length of h[n] is infinite. Output of the filter is always Linear Convolution of impulse response
with the input of the signal. To find output of digital IIR filter, Overlap Add Method using FFT or
Overlap Save Method using FFT cannot be used. Output of digital IIR filter is calculated using
difference equation recursively.
4. Explain how to find output of digital IIR filter in real time application.
In real time applications, output of IIR filter can be obtained by evaluating difference
equation.
6. Explain how to find output of digital IIR filter in real time application.
In real time applications, output of IIR filter can be obtained byevaluating difference
equation.
PART-B
INTRODUCTION TO DSP PROCESSORS (TMS320C6743DSK)
The C6747™ DSK builds on TI's industry-leading line of low cost, easy-to-use DSP Starter
Kit (DSK) development boards. The high-performance board features the VSK-6747 floating-
point DSP. Capable of performing 1350 million floating-point operations per second (MFLOPS),
the VSK-6747 DSP makes the VSK-6747 DSK the most powerful DSK development board. The
DSK is USB port interfaced platform that allows efficiently developing and testing applications for
the VSK-6747. The DSK consists of a VSK-6747 -based printed circuit board that will serve as a
hardware reference design for TI’s customers’ products. With extensive host PC and target DSP
software support, including bundled TI tools, the DSK provides ease-of-use and capabilities that
are attractive to DSP engineers.
The VSK comes with a full complement of on board devices that suit a wide variety of
Application environments. Key features include:
• IDE
• Debug IDE
• Advanced watch windows
• Integrated editor
• File I/O, Probe Points, and graphical algorithm scope probes
• Advanced graphical signal analysis
• Interactive profiling
• Automated testing and customization via scripting
• Visual project management system
• Compile in the background while editing and debugging
• Multi-processor debugging
• Help on the target DSP
• Click Start Menu All Programs Texas Instruments Code Compos-er Studio3.3
Setup Code Composer Studio V3.3.
• Click Start Menu All Programs Texas Instruments Code Composer Studio
• Then switch ON the TMS320C6747 VSK module and plug the USB Emulator to
the module. Now press Debug option and then select the connect option.
• Now TMS320C6747 VSK module and CCS software will be connected. Then click
Project and select new. Now open the new project.
• Save the project in specific location and give Project Name. Then click finish but-
ton. Now project will be added in CCS work space.
• Select the File New Source File. Now new untitled window will be open.
• Next click File and select save option. Now give a name for opened file with dot C.
Copy the Linker cmd, ViDSKC6747-BSL-Lib file path and then paste the copied file into
our project folder.
• Now Right click the Source file in project window and select Add file to project.
• Then double click the debug option and click out file and select the Open button.
Now program will be loaded.
• Finally select the debug option and click Run (F5). Now run the program.
•
This is the basic procedure for create a project, build and executing methods.
Program Implementation and Input / Output View Procedure:
• Then click View option and select the Memory.
• Now enter the specific Memory address (like 0xc0000100) then press Enter
and Select a Particular Data type (Ex 32 bit signed integer).
• Now double click the data near the specific memory address and enter the
inputs.
• Now click Debug Halt. See the Output for the particular memory window.
OBJECTIVES: After completing this lab, student will be able to find the linear convolution and
the results can be verified by implementing the C-code on the TMS320 DSP processor.
THEORY: The linear convolution of two continuous time signals x(t) and h(t) is defined by
Where x(n) is the input signal and h(n) is the impulse response of the system. In linear convolution
length of output sequence is, Length (y(n)) = length(x(n)) + length(h(n)) – 1
int *Xn,*Hn,*Yout;
int *xnlen,*hnlen;
int i,k,n,l,m;
Xn=(int *)0xc0000100;//[1,2,1,1] reserve a memory location for input ,sequence length and output.
Hn=(int *)0xc0000200;//[1,1,1]
xnlen = (int *)0xc0000300;//[4]
l = *xnlen;
m = *hnlen;
for(i=0;i<50;i++)
{
Yout[i]=0;//Clear 50 memory locations to store the respective sequence.
Xn[l+i]=0;
Hn[m+i]=0;
xnlen[2+i]=0;
}
for(n=0;n<(l+m-1);n++)
{
for(k=0;k<=n;k++)
{
Yout[n]=Yout[n]+(Xn[k]*Hn[n-k]);//obtain a
linear convolution using formula.
}
}
OUTPUT:
1 3 4 4 2 1
OUTCOME:
CIRCULAR CONVOLUTION
OBJECTIVE: After completing this lab, student will be able to find the circular convolution of
the sequence using TMS320 DSP processor.
THEORY: Let x1(n) and x2(n) are finite duration sequences both of length N with DFT’s X1(k)
andX2(k). Convolution of two given sequences x1(n) and x2(n) is given by the equation,
x3(n) = IDFT[X3(k)]
X3(k) = X1(k) X2(k)
𝑁−1
Yn=(int *)0xc0000100;
// Vi_DSKC6747_init( );
for(i=0;i<xn+hn;i++)
Yn[i]=0;
for(n=0;n<xn;n++)
}
}
OUTPUT:
14 16 14 16
OUTCOME:
N-POINT DFT
AIM: To compute n-point DFT of a given sequence and to plot
OBJECTIVE: After completing this lab, student will be able to find the DFT of the sequence
using TMS320 DSP processor.
THEORY: The Discrete Fourier Transform is a powerful computation tool which allows us to
evaluate the Fourier Transform X(ejω) on a digital computer or specially designed digital
hardware. Since X(ejω) is continuous and periodic, the DFT is obtained by sampling one period of
the Fourier Transform at a finite number of frequency points. Apart from determining the
frequency content of a signal, DFT is used to perform linear filtering operations in the frequency
domain.
The sequence of N complex numbers x0,...,xN−1 is transformed into the sequence of N complex
numbers X0, ..., XN−1 by the DFT according to the formula:
𝑁−1
X(k) = ∑n=0 x(n)e − j2πnk/N k = 0,1, …. N-1
RealOut[k]= 0xc0000300
14.0000
-1.0000
-8.0000
-1.0000
ImagOut[k]= 0xc0000400
0.0000
3.0000
- 0.0000
- 3.0000
OUTCOME:
IMPULSE RESPONSE
AIM: To find Impulse response of a first order and second order system.
1) OBJECTIVE: After completing this lab, student will be able to find the impulse response
for the system using TMS320 DSP processor. To find the Impulse response of second order
systems.
2) To prove the results theoretical and implement the same using DSP Hardware module.
THEORY:
A discrete time system performs an operation on an input signal based on predefined criteria to
produce a modified output signal. The input signal x(n) is the system excitation, and y(n) is the
system response. The transform operation is shown as,
OUTPUT:
0.131100 0.360237 0.364799 0.174741 0.031373
OUTCOME:
Student can obtain dynamic system response to some external change.
FIR FILTER
AIM: Realization of fir filter (any type) to meet given specifications. The input can be a signal
from function generator/speech signal
OBJECTIVE: After completing this lab, student will be able to design FIR filter using CODEC
and TMS320 DSP processor.
THEORY: The FIR filters are of non-recursive type, whereby the present output sample is
depending on the present input sample and previous input samples. The transfer function of a FIR
causal filter is given by,
𝑁−1
𝐻(𝑍) = ∑𝑛=0 h(n)z-n
In the design of FIR filters most commonly used approach is using windows. The desired
frequency response Hd(ejw) of a filter is periodic in frequency and can be expanded in Fourier
series. The resultant series is given by,
𝜋
hd(n) = (1/2𝜋) ∫−𝜋 H(ejw)𝑒 𝑗𝑤𝑛 𝑑𝑤
This is known as Fourier series coefficients having infinite length. One possible way of obtaining
FIR filter is to truncate the infinite Fourier series at n = ± [(N-1)/2] Where N is the length of the
desired sequence.
The Fourier coefficients of the filter are modified by multiplying the infinite impulse response with
a finite weighing sequence w(n) called a window.
************************************************************************
************************************************************************
#include<fastmath67x.h>
#include<math.h>
#define PI 3.14
void Vi_DSKC6747_init( );
void main()
{
/* Inputs */
SocValue = (unsigned short *)0x60000558;
AdcValue = (unsigned short *)0x60000554;
Hd = (float *)0xc0010000;
Hm = (float *)0xc0020000;
AdcStore = (unsigned short *)0xc0030000;
/* Output */
{
if(Count == 0)
Hd[Count] = 2 * Fc;
else
{
Val = sin(Wc * Count);
Hd[Count] = Val / (Count * PI);
}
}
Inc=0;
for(Count = -N/2; Count < N/2; Count++)
{
*SocValue = 0x00;
for(Count = 0; Count < 100; Count++);
AdcOut = *AdcValue;
*AdcStore = AdcOut;
OutValue = 0;
OutValue |=0x1000;
*DacOut = OutValue;
Note 1: To increase the CUTOFF Freq means Sampling Freq also increase.
Note 2: The Length of the Filter N will be decrease
*/
************************************************************************
************************************************************************
#include<fastmath67x.h>
#include<math.h>
#define PI 3.14
void Vi_DSKC6747_init( );
void main()
{
/* Inputs */
Hd = (float *)0xc0010000;
Hm = (float *)0xc0020000;
/* Output */
{
if(Count == 0)
Hd[Count] = 1 - (2 * Fc);
else
{
Val = (-1) * sin(Wc * Count);
Hd[Count] = Val / (Count * PI);
}
}
Inc=0;
for(Count = -N/2; Count < N/2; Count++)
{
Hm[Inc] = Hd[Count];
Inc++;
}
while(1)
{
*SocValue = 0x00;
for(Count = 0; Count < 100; Count++);
OutValue = 0;
OutValue +=0x0800;
OutValue |=0x1000;
*DacOut = OutValue;
Note 1: To increase the CUTOFF Freq means Sampling Freq also increase.
Note 2: The Length of the Filter N will be decrease
*/
************************************************************************
************************************************************************
#include<fastmath67x.h>
#include<math.h>
#define PI 3.14
void Vi_DSKC6747_init( );
void main()
Hd = (float *)0xc0010000;
Hm = (float *)0xc0020000;
AdcStore = (unsigned short *)0xc0030000;
{
AdcStore[ Count ] = 0;
Hd[ Count ] = 0;
Hm[ Count ] = 0;
}
{
if(Count == 0)
Hd[Count] = 2 * (Fc2 - Fc1);
else
{
Val = sin(Wc2 * Count) - sin(Wc1 * Count);
Hd[Count] = Val / (Count * PI);
}
}
Inc=0;
for(Count = -N/2; Count < N/2; Count++)
{
Hm[Inc] = Hd[Count];
Inc++;
while(1)
{
*SocValue = 0x00;
for(Count = 0; Count < 100; Count++);
AdcOut = *AdcValue;
*AdcStore = AdcOut;
OutValue = 0;
OutValue +=0x0800;
OutValue |= 0x1000;
*DacOut = OutValue;
Note 1: To increase the CUTOFF Freq means Sampling Freq also increase.
Note 2: The Length of the Filter N will be decrease
*/
************************************************************************
************************************************************************
#include<fastmath67x.h>
Hd = (float *)0xc0010000;
Hm = (float *)0xc0020000;
AdcStore = (unsigned short *)0xc0030000;
{
if(Count == 0)
Hd[Count] = 1 - (2 * (Fc2 - Fc1));
else
{
Val = sin(Wc1 * Count) - sin(Wc2 * Count);
Hd[Count] = Val / (Count * PI);
}
}
Inc=0;
for(Count = -N/2; Count < N/2; Count++)
{
Hm[Inc] = Hd[Count];
Inc++;
}
while(1)
{
*SocValue = 0x00;
for(Count = 0; Count < 100; Count++);
AdcOut = *AdcValue;
*AdcStore = AdcOut;
OutValue = 0;
OutValue |= 0x1000;
*DacOut = OutValue;
Note 1: To increase the CUTOFF Freq means Sampling Freq also increase.
Note 2: The Length of the Filter N will be decrease
*/
OUTCOME:
FIR filter structure is used to implement almost any sort of frequency response digitally.