Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
16 views219 pages

DSP LAB Staff Manual 2

The document is a staff manual for the Digital Signal Processing Lab (ECE3492) at Meenakshi Sundararajan Engineering College, outlining the vision and mission of the institute and department, program specific outcomes, educational objectives, and program outcomes. It includes a syllabus detailing various experiments related to digital signal processing, including signal generation, convolution, filter design, and MATLAB programs. The manual emphasizes the importance of quality education, research, and ethical values in engineering.

Uploaded by

gokulsrikanthb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views219 pages

DSP LAB Staff Manual 2

The document is a staff manual for the Digital Signal Processing Lab (ECE3492) at Meenakshi Sundararajan Engineering College, outlining the vision and mission of the institute and department, program specific outcomes, educational objectives, and program outcomes. It includes a syllabus detailing various experiments related to digital signal processing, including signal generation, convolution, filter design, and MATLAB programs. The manual emphasizes the importance of quality education, research, and ethical values in engineering.

Uploaded by

gokulsrikanthb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 219

SUBJECT CODE – ECE3492

SUBJECT NAME- DIGITAL SIGNAL PROCESSING LAB


DEPARTMENT OF ECE
STAFF MANUAL

STAFF MANUAL

363, Arcot Road, Kodambakkam, Chennai - 600 024.


www. mec.edu.in
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

VISION AND MISSION OF THE INSTITUTE

Vision:
To impart state-of-the art technical education, including sterling values and shining character,
producing engineers who contribute to nation building thereby achieving our ultimate objective of
sustained development of an unparalleled society, nation and world at large.
Mission:

Meenakshi Sundararajan Engineering College, Chennai constantly strives to be a Centre of Excellence


with the singular aim of producing students of outstanding academic excellence and sterling character
to benefit the society, our nation and the world at large.
To achieve this, the college ensures
● Continuous upgradation of its teaching faculty to ensure a high standard of quality education and to
meet the ever-changing needs of the society.
● Constant interaction with its stakeholders.
● Linkage with other educational institutions and industries at the national and international level for
mutual benefit.
● Provision of research facilities and infrastructure in line with global trends.
● Adequate opportunities and exposure to the students through suitable programs, to mould their
character and to develop their personality with an emphasis on professional ethics and moral values
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

VISION AND MISSION OF THE DEPARTMENT

Vision

To emerge as a Centre of excellence in offering quality education to produce students technically


competent, socially responsible and industry ready graduates in electronics and communication
engineering.

Mission

The above vision will be achieved by,

 Ensuring effective teaching learning methodologies.

 Inculcating creative thinking through innovative and group work exercises.

 Developing and motivating research ability among students by establishing research linkage with
leading industries.

 Equipping faculty and students with the latest developments in Electronics and Communication and
to face the challenges.

PROGRAM SPECIFIC OUTCOMES (PSOs)

● PSO1: Learn discrete Fourier transform, properties of DFT and its application to linear filtering

● PSO2: Understand the characteristics of digital filters, design digital IIR and FIR filters and apply
these filters to filter undesirable signals in various frequency bands

● PSO3: Understand the effects of finite precision representation on digital filters and understand the
fundamental concepts of multi rate signal processing and its applications.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

PROGRAM EDUCATIONAL OBJECTIVES (PEOs)

 PEO1: To provide appropriate knowledge in applying the concepts and analysis of digital signals
and systems & communication engineering.
 PEO2: To be able to identify, analyse and solve engineering problems in the field of electronics &
communication engineering.
 PEO3: To provide an opportunity to work in multidisciplinary groups and research environments.
 PEO4: To educate and inculcate professional ethics, human values, self-confidence and awareness
of societal needs.
 PEO5: To motivate the students in intellectual pursuits, lifelong learning in order to develop
different perspectives of technological developments.

PROGRAM OUTCOMES (POs)

1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals,


and an engineering specialization to the solution of complex engineering problems.
2. Problem analysis: Identify, formulate, research literature, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences,
and engineering sciences.
3. 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.
4. Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of the
information to provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modelling to complex engineering activities with an
understanding of the limitations.
6. 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.
7. Environment and sustainability: Understand the impact of the professional engineering solutions
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

in societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of
the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the engineering
community and with society at large, such as, being able to comprehend and write
effective reports and design documentation, make effective presentations, and give and receive clear
instructions.
11. 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.
12. 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.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

SYLLABUS

S.No. Name of Experiment


1. Generation of elementary Discrete-Time sequences

2. Linear and Circular convolutions

3. Auto correlation and Cross Correlation

4. Frequency Analysis using DFT

5. Design of FIR filters (LPF/HPF/BPF/BSF) and demonstrates the filtering operation

6. Design of Butterworth and Chebyshev IIR filters (LPF/HPF/BPF/BSF) and

demonstrate the filtering operations

7. Study of architecture of Digital Signal Processor

8. Perform MAC operation using various addressing modes

9. Generation of various signals and random noise

10. Design and demonstration of FIR Filter for Low pass, High pass, Band pass and

Band stop filtering

11. Design and demonstration of Butter worth and Chebyshev IIR Filters for Low pass,

High pass, Band pass and Band stop filtering

12. Implement an Up-sampling and Down-sampling operation in DSP Processor


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

INDEX
MATLAB Programs
S.NO EXPERIMENT PAGE NO.

1 Generation of Signals

2 Computation of Linear convolution with


and without function

3 Computation of Circular convolution with


and without function

4 Computation of Auto correlation and


Cross correlation

5 Calculation of Fast Fourier Transform


(FFT) of a signal

6 Computation of linear convolution using


Fast Fourier Transform (FFT)

7 Computation of Circular convolution using


Fast Fourier transform (FFT)

8 Magnitude and Phase plot for Fast Fourier


Transform (FFT)

9 Verification of Sampling theorem

10 Design of Infinite Impulse Response (IIR)


filters

11 Design of Finite Impulse Response (FIR)


filters
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

DSP Processor programs

S.NO EXPERIMENT PAGE NO.

1 Study of the DSP processor

2 Addition of two 16-bit numbers

3 Subtraction of two 16-bit numbers

4 Multiplication of two 16-bit numbers

5 Exchange a block of data

6 Implementation of Linear convolution

7 Generation of Waveforms
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment
no:1 Generation of signals

Aim
To generate continuous and discrete-time signals for Digital Signal Processing (DSP)
applications using MATLAB
a) Unit impulse b) Unit step c) Unit ramp d) Parabolic e) Exponential f) Sine g)
Cosine h) Sinc I) Square

Mapping with theory


Basic signals and representations
Continuous time signals
Mathematical representations of physical phenomena that vary continuously over
time. They are defined for all real values of time within a certain interval.
a) Impulse signal (Unit Impulse):  denoted as δ(t)
b) Step signal (Unit Step):  A step signal, commonly denoted as u(t)
c) Ramp signal:  A ramp signal, denoted as r(t), is a signal that increases linearly
with time at a constant rate
d) Parabolic signal:  A parabolic signal is a signal that exhibits a quadratic
relationship with time.
e) Exponential signal:  A sine signal, denoted as x(t) = A * sin (2πft + φ), periodic
signal that oscillates sinusoidally with time.
'A' is the amplitude
'f' frequency in Hz,
't' time in seconds
'φ' phase angle in radians
f) Sine signal:  A sine signal, denoted as x(t) = A * sin(2πft + φ)
'A' is the amplitude
'f' frequency in Hz,
't' time in seconds
'φ' phase angle in radians
g) Cosine signal  A cosine signal, denoted as x(t) = A * cos(2πft + φ)
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

'A' is the amplitude


'f' frequency in Hz,
't’ time in seconds
'φ' phase angle in radians
h) Sinc signal  The sinc function, defined as sinc(x) = sin(πx)/(πx)  The sinc
function is characterized by its main lobe, which has a central peak and decays as 1/x
away from the peak
i) Square wave signal: a square wave signal can be represented as x(t) = A, for |t -
kT| < T/2, where 'A' is the amplitude, 'T' is the period (inverse of frequency), and 'k' is
an integer representing the number of periods.

Discrete time signals


Mathematical representations of phenomena that vary discretely over time, they are
defined only at discrete points in time.
a) Impulse signal (Unit Impulse):  Represented as δ[n], where 'n' is an integer
representing the sample index.
b) Step signal (Unit Step):  denoted as u[n]
c) Ramp signal:  Represented r[n] as a sequence of values that increase linearly
with time.
d) Parabolic signal:  Represented as sequences of values that exhibit a quadratic
relationship with time
e) Exponential signal: . Represented as sequences that exhibit exponential growth
or decay behaviour over time.
f) Sine signal: periodic sequences that oscillate sinusoidally with time
represented as sequences of the form x[n] = A * sin(2πfn + φ)
'A' Amplitude
'f' frequency in cycles per sample
'n' sample index
'φ' phase angle.
g) Cosine signal:  periodic sequences that oscillate sinusoidally with time. 
represented as sequences of the form x[n] = A * cos(2πfn + φ)
'A' Amplitude
'f' frequency in cycles per sample
'n' sample index
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

'φ' phase angle.


h) Sinc signal:  In discrete-time signals, the sinc function is represented as a
sequence that exhibits a main lobe with a central peak and decays as 1/n away from
the peak
i) Square wave signal: Discrete-time square wave signals are periodic sequences
that alternate between two discrete levels (usually high and low) at a fixed frequency.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Procedure
1. Launch MATLAB: Double-click the MATLAB icon or search for it in the
application launcher.
2. Create/Open Script:
o To create a new script: Go to the "Home" tab and click "New Script."
o To open an existing script: Go to the "Home" tab, click "Open," and select
the script.
3. Write/Paste Code: In the MATLAB Editor, write or paste your MATLAB code.
4. Save Script: Save the script with a meaningful name and ".m" extension (e.g.,
"my_script.m").
5. Run Script:
o Click the "Run" button in the Editor toolbar, or
o Type the script name (without ".m") in the Command Window and press
Enter.
6. View Output: MATLAB will display the results in the Command Window or
graphical output in figure windows.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Pseudocode: Program to Plot Continuous-Time and Discrete-Time


Signals

1. Initialize the time and discrete time vectors:


- Define continuous-time vector `t` with values from -5 to 5 with a step size of 0.01.
- Define discrete-time vector `n` with integer values from -5 to 5.

2. Define Continuous-Time Signals:


- Define the unit step function `u_t` as 1 when `t >= 0`, else 0.
- Define the ramp function `r_t` as `t` when `t >= 0`, else 0.
- Define the impulse function `delta_t` as 1 when `t == 0`, else 0 (approximated).
- Define the parabolic function `p_t` as `t^2` when `t >= 0`, else 0.
- Define the exponential function `e_t` as `exp(t)`.
- Define the sine function `sin_t` as `sin(t)`.
- Define the cosine function `cos_t` as `cos(t)`.
- Define the signum (square) function `sgn_t` as the sign of `t`.
- Define the sinc function `sinc_t` as `sin(pi * t) / (pi * t)` with special handling for
`t == 0`.

3. Plot Continuous-Time Signals:


- Create a figure window.
- For each signal (from step 2), plot the signal as a subplot in a 3x3 grid.
- For each subplot, set axis limits to [-5, 5] for `t` and [-2, 2] for amplitude.
- Add title for each plot and label axes as 't' for time and 'Amplitude'.
- Enable grid on each subplot.

4. Define Discrete-Time Signals:


- Define the unit step function `u_n` as 1 when `n >= 0`, else 0.
- Define the ramp function `r_n` as `n` when `n >= 0`, else 0.
- Define the impulse function `delta_n` as 1 when `n == 0`, else 0.
- Define the parabolic function `p_n` as `n^2` when `n >= 0`, else 0.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

- Define the exponential function `e_n` as `exp(n)`.


- Define the sine function `sin_n` as `sin(n)`.
- Define the cosine function `cos_n` as `cos(n)`.
- Define the signum (square) function `sgn_n` as the sign of `n`.
- Define the sinc function `sinc_n` as `sin(pi * n) / (pi * n)` with special handling
for `n == 0`.

5. Plot Discrete-Time Signals:


- Create a new figure window.
- For each signal (from step 4), plot the signal as a subplot in a 3x3 grid using the
`stem` function (discrete-time plot).
- For each subplot, set axis limits to [-5, 5] for `n` and [-2, 2] for amplitude.
- Add title for each plot and label axes as 'n' for discrete time and 'Amplitude'.
- Enable grid on each subplot.

6. End the program.

Program

% MATLAB Code for Plotting Continuous-Time and Discrete-Time Signals

% Continuous-Time Signals
t = -5:0.01:5; % Time vector for continuous signals

% Define the continuous-time signals


u_t = (t >= 0); % Step function
r_t = t .* (t >= 0); % Ramp function
delta_t = (t == 0); % Impulse function (approximated)
p_t = t.^2 .* (t >= 0); % Parabolic function
e_t = exp(t); % Exponential function
sin_t = sin(t); % Sine function
cos_t = cos(t); % Cosine function
sgn_t = sign(t); % Signum (square) function
sinc_t = sin(pi * t) ./ (pi * t); % Sinc function
sinc_t(t == 0) = 1; % Handle division by zero for sinc function

% Create a figure for continuous-time signals


figure;
subplot(3,3,1); plot(t, u_t, 'LineWidth', 2); title('Step Function (u(t))');
subplot(3,3,2); plot(t, r_t, 'LineWidth', 2); title('Ramp Function (r(t))');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

subplot(3,3,3); plot(t, delta_t, 'LineWidth', 2); title('Impulse Function


(\delta(t))');
subplot(3,3,4); plot(t, p_t, 'LineWidth', 2); title('Parabolic Function (p(t))');
subplot(3,3,5); plot(t, e_t, 'LineWidth', 2); title('Exponential Function (e^{at})');
subplot(3,3,6); plot(t, sin_t, 'LineWidth', 2); title('Sine Function (\sin(\omega
t))');
subplot(3,3,7); plot(t, cos_t, 'LineWidth', 2); title('Cosine Function (\cos(\omega
t))');
subplot(3,3,8); plot(t, sgn_t, 'LineWidth', 2); title('Signum Function (sgn(t))');
subplot(3,3,9); plot(t, sinc_t, 'LineWidth', 2); title('Sinc Function (sinc(t))');

% Set axis limits and labels


for i = 1:9
subplot(3,3,i);
axis([-5 5 -2 2]);
grid on;
xlabel('t');
ylabel('Amplitude');
end

% Discrete-Time Signals
n = -5:5; % Discrete time vector

% Define the discrete-time signals


u_n = (n >= 0); % Step function
r_n = n .* (n >= 0); % Ramp function
delta_n = (n == 0); % Impulse function
p_n = n.^2 .* (n >= 0); % Parabolic function
e_n = exp(n); % Exponential function
sin_n = sin(n); % Sine function
cos_n = cos(n); % Cosine function
sgn_n = sign(n); % Signum (square) function
sinc_n = sin(pi * n) ./ (pi * n); % Sinc function
sinc_n(n == 0) = 1; % Handle division by zero for sinc function

% Create a figure for discrete-time signals


figure;
subplot(3,3,1); stem(n, u_n, 'LineWidth', 2); title('Step Function (u[n])');
subplot(3,3,2); stem(n, r_n, 'LineWidth', 2); title('Ramp Function (r[n])');
subplot(3,3,3); stem(n, delta_n, 'LineWidth', 2); title('Impulse Function
(\delta[n])');
subplot(3,3,4); stem(n, p_n, 'LineWidth', 2); title('Parabolic Function (p[n])');
subplot(3,3,5); stem(n, e_n, 'LineWidth', 2); title('Exponential Function (e^{an})');
subplot(3,3,6); stem(n, sin_n, 'LineWidth', 2); title('Sine Function (\sin(\omega
n))');
subplot(3,3,7); stem(n, cos_n, 'LineWidth', 2); title('Cosine Function (\cos(\omega
n))');
subplot(3,3,8); stem(n, sgn_n, 'LineWidth', 2); title('Signum Function (sgn[n])');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

subplot(3,3,9); stem(n, sinc_n, 'LineWidth', 2); title('Sinc Function (sinc[n])');

% Set axis limits and labels for discrete-time signals


for i = 1:9
subplot(3,3,i);
axis([-5 5 -2 2]);
grid on;
xlabel('n');
ylabel('Amplitude');
end
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Outputs
Continuous time signals

Discrete time signals


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Industrial Applications

1. Unit Impulse:
o Used in system identification and characterization, particularly for
determining the impulse response of a system or analyzing transient
behavior.
2. Unit Step:
o Applied in industrial control systems, especially for modelling and
simulating the response of systems to step inputs (e.g., PID controllers for
regulating temperature or pressure in industrial processes).
3. Unit Ramp:
o Useful in modelling linear growth or accumulation processes over time,
such as in sensor calibration or tracking systems.
4. Parabolic:
o Used for modelling physical phenomena with quadratic relationships,
including projectile motion in aerospace engineering or certain types of
vibrations in mechanical systems.
5. Exponential:
o Commonly applied for modelling exponential growth or decay processes,
such as radioactive decay, charging and discharging of capacitors, or
population growth models.
6. Sine and Cosine:
o Applied for modelling periodic phenomena, such as alternating current
(AC) signals in electrical systems, vibrations in mechanical systems, or
oscillations in control systems.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

7. Sinc:
o Important in digital signal processing (DSP), telecommunications, and
audio processing, particularly in interpolation, filtering, and spectral
analysis.
8. Square:
o Used for representing binary data or digital signals in systems like digital
communication, pulse-width modulation (PWM) for motor control, and
digital control systems.

Viva Question and Answers

1. Define discrete-time and digital signals.

 Discrete-Time Signal: A discrete-time signal is a signal defined only at discrete


points in time, typically represented as a sequence of values indexed by integers
(e.g., x[n]), where nnn is the discrete time index. These signals are often the result
of sampling a continuous-time signal at regular intervals.
 Digital Signal: A digital signal is a signal that takes discrete values at discrete
time intervals. It is typically represented by binary numbers (0s and 1s) and is
used in digital systems like computers, digital communication, and control
systems. Digital signals can be the output of a discrete-time signal that has been
quantized into finite levels.

2. When is a discrete-time signal considered periodic?

A discrete-time signal x[n] is considered periodic if there exists a positive integer N


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

(called the period) such that the signal repeats itself after every N samples.
Mathematically, this is expressed as:

x[n]=x[n+N],∀n∈Z

where N is the smallest positive integer that satisfies the above equation. If such an N
exists, the signal is periodic with period N

3. What is impulse response? Explain its significance.

 Impulse Response: The impulse response of a system is the output of the system
when the input is a unit impulse signal (denoted by δ[n] for discrete-time or δ(t)
for continuous-time). It characterizes the system's reaction to a brief input at a
specific time instant.
 Significance: The impulse response is crucial because it completely describes the
linear time-invariant (LTI) system's behavior. Once the impulse response is
known, the output for any arbitrary input can be determined through convolution
(discrete-time) or integration (continuous-time). It serves as a fundamental tool in
system analysis and design.

4. What is the importance of causality?

 Causality: A system is said to be causal if its output at any time t (or n in discrete
time) depends only on current and past inputs, not on future inputs.
Mathematically, for a continuous-time system, this means that the system's output
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

y(t) at time t is influenced by the input x(t) only for t≥0 t (or for n≥0 n in discrete
time).
 Importance: Causality is important because in physical systems, future values
cannot affect present or past behavior. Causal systems are realizable in practice
since the output depends only on available or past inputs. Non-causal systems, on
the other hand, are theoretical and cannot be physically realized.

5. How would you classify discrete-time signals?

Discrete-time signals can be classified based on various characteristics, including:

1. Periodicity:
o Periodic: A signal that repeats at regular intervals (e.g., sine wave).
o Aperiodic: A signal that does not repeat (e.g., step function).
2. Energy and Power:
o Energy Signals: Signals with finite energy and zero average power. The
energy is calculated as the sum of the squared values of the signal.
o Power Signals: Signals with infinite energy but finite average power,
typically periodic signals.
3. Deterministic and Random:
o Deterministic: Signals that can be precisely described by a mathematical
expression (e.g., sine wave).
o Random: Signals that are described by probabilistic models and cannot be
predicted exactly (e.g., noise).
4. Even and Odd Signals:
o Even Signal: A signal that satisfies x[n]=x[−n] for all n
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

o Odd Signal: A signal that satisfies x[n]=−x[−n] for all n.


5. Continuous and Discrete:
o Continuous Signals: Signals that are defined for every value of n (e.g., a
sinusoidal signal).
o Discrete Signals: Signals defined only at discrete time instances (e.g.,
sequences of numbers).

Result
Thus, the MATLAB program to generate signals was simulated and the waveforms are
Plotted.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment
no:2 Computation of Linear convolution with and without function

Aim
To learn about the manual computation and application of MATLAB's built-in
functions for linear convolution of two finite length sequences.

Mapping with theory


Linear Convolution
Linear convolution is a key operation in Digital Signal Processing (DSP) that combines
two discrete-time signals to produce a third signal. It is a fundamental tool for analyzing
the behavior of Linear Time-Invariant (LTI) systems.
In mathematical terms, the convolution operation is denoted by the symbol "*", and it
represents the response of an LTI system to an input signal.
The response y[n] of an LTI system to an input signal x[n] is given by the
convolution sum:

Alternatively, the convolution sum can also be written as:

Where:
 x[n] is the input signal,

 h[n] is the system's impulse response, and


 y[n] is the output signal.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

This operation is referred to as the convolution sum of the sequences x[n] and
h[n]and it is represented as:

The result of convolving two sequences depends on their lengths. If the length of
sequence x[n] is M and the length of sequence h[n] is N, then the length of the resulting
sequence y[n] will be M+N−1.

MATLAB Implementation:
In MATLAB, the convolution of two finite-length sequences a and b is implemented
using the conv function. The command:
c=conv(a,b)
computes the convolution of sequences a and b, producing the resulting sequence c,
which has a length of M+N−1, where Mand N are the lengths of a and b, respectively.
Procedure
 Launch MATLAB:
Open MATLAB by double-clicking on the MATLAB icon on your desktop or by
searching for MATLAB in your computer's application launcher and selecting it.
 Create or Open a Script:
In MATLAB, you can either create a new script or open an existing one.
To create a new script:
Go to the "Home" tab in the toolbar.
Click on "New Script". This will open a new script file in the MATLAB
Editor.
To open an existing script:
Go to the "Home" tab.
Click on "Open" and select the script file you want to open from your
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

directories.
 Write or paste the MATLAB Code:
In the MATLAB Editor, paste or write your MATLAB code into the script file.
Ensure that the code includes all necessary commands, functions, variable
assignments, and plot commands.
 Save the Script File:
Save your script with a meaningful name and the extension .m (e.g.,
convolution_script.m).
To save, click on "Save" or "Save As" in the toolbar, or use the keyboard
shortcut Ctrl + S (Windows) or Command + S (Mac).
 Run the Script:
To run the entire script, click on the "Run" button in the Editor's toolbar, or:
Type the name of the script (without the .m extension) in the Command
Window and press Enter.
For example, type convolution_script and press Enter.
 MATLAB Executes the Code:
After running the script, MATLAB will execute the code and display the results in
the Command Window or other MATLAB windows.
If your script generates plots or figures, they will be displayed in separate figure
windows.
 View the Output:
The script should plot:
The input sequence x[n]
The impulse response h[n]
The output sequence after manual convolution
The output sequence from the built-in conv function
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

The results will appear in subplot windows for easy comparison.


 Interact with the Plot:
If the script generates plots, you can zoom in, out, or pan across the figure to
examine the signals in more detail.
You can also save the plot as an image file using the "Save As" option in the
figure window.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Pseudocode

BEGIN
// Step 1: Initialize environment
Close any open figure windows
Clear workspace variables

// Step 2: Input Sequences


Prompt user to enter the input sequence x[n]
Prompt user to enter the impulse response h[n]

// Step 3: Compute Convolution using built-in function


Call conv() function to perform convolution of x[n] and h[n]
Store the result in variable 'g'

// Step 4: Compute the length of the output sequence


Calculate the length of x[n], store in variable 'a'
Calculate the length of h[n], store in variable 'b'
Calculate the length of the resulting sequence, 'c' = a + b - 1

// Step 5: Zero-padding
Calculate the padding needed for x[n] and h[n]
Calculate the difference 'd' = c - a
Calculate the difference 'e' = c - b

Zero-pad x[n] by appending 'd' zeros


Zero-pad h[n] by appending 'e' zeros

// Step 6: Manual Convolution Calculation


Initialize an empty array 'z' to store the convolution result with length 'c'

FOR n = 1 to c
Set z[n] = 0

FOR i = 1 to c
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Set j = n - i + 1
IF j <= 0 THEN
Adjust 'j' by wrapping around (j = j + c)
END IF

Calculate z[n] = z[n] + x_padded[i] * h_padded[j]


END FOR
END FOR

// Step 7: Display Results


Display the result of manual convolution 'z'
Display the result of built-in convolution 'g'

// Step 8: Plotting
Create a figure window for displaying plots

Subplot 1: Plot the input sequence x[n]


Label the x-axis as 'n' and y-axis as 'x(n)'
Set title as 'Input Sequence x(n)'

Subplot 2: Plot the impulse response h[n]


Label the x-axis as 'n' and y-axis as 'h(n)'
Set title as 'Impulse Response h(n)'

Subplot 3: Plot the manual convolution result z[n]


Label the x-axis as 'n' and y-axis as 'y(n)'
Set title as 'Output Response (Manual Convolution)'

Subplot 4: Plot the built-in convolution result g[n]


Label the x-axis as 'n' and y-axis as 'y(n)'
Set title as 'Output Response (Built-in Convolution)'

END
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Program
% MATLAB Code for Convolution of Sequences (Manual & Built-in Function)

close all; % Close all figure windows


clear; % Clear workspace variables

% Get input sequence and impulse response


x = input('Enter the input sequence x(n): ');
y = input('Enter the impulse response h(n): ');

% Perform Convolution using built-in conv function


g = conv(x, y);

% Compute lengths of the sequences


a = length(x);
b = length(y);
c = a + b - 1; % Length of the resulting sequence after convolution

% Calculate padding needed for zero-padding the sequences


d = c - a;
e = c - b;

% Zero-pad the input sequences


x_padded = [x, zeros(1, d)]; % Zero-padding for input sequence
y_padded = [y, zeros(1, e)]; % Zero-padding for impulse response

% Convolution calculation (manual approach)


z = zeros(1, c); % Initialize output sequence
for n = 1:c
for i = 1:c
j = n - i + 1;
if j <= 0
j = j + c; % Wrap around for circular convolution behavior
end
z(n) = z(n) + x_padded(i) * y_padded(j); % Convolution sum
end
end

% Display results
disp('Manual Convolution Output (z):');
disp(z);
disp('Built-in Convolution Output (g):');
disp(g);

% Plotting the sequences and results


figure;
subplot(2, 2, 1);
stem(x, 'LineWidth', 1.5);
xlabel('n');
ylabel('x(n)');
title('Input Sequence x(n)');

subplot(2, 2, 2);
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

stem(y, 'LineWidth', 1.5);


xlabel('n');
ylabel('h(n)');
title('Impulse Response h(n)');

subplot(2, 2, 3);
stem(z, 'LineWidth', 1.5);
xlabel('n');
ylabel('y(n) - Manual Convolution');
title('Output Response (Manual Convolution)');

subplot(2, 2, 4);
stem(g, 'LineWidth', 1.5);
xlabel('n');
ylabel('y(n) - Built-in Convolution');
title('Output Response (Built-in Convolution)');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Output
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Industrial Applications

 Communication Systems: Linear convolution is utilized for tasks like channel


equalization, modulation and demodulation, error correction coding, and
synchronization.
 Image Processing: Linear convolution is extensively used in image filtering,
edge detection, image enhancement, and feature extraction.
 Speech Processing: In speech processing, linear convolution is used for tasks
such as speech recognition, speech synthesis, and speech enhancement.
VIVA Questions and answers

1. Define discrete-time and digital signals:


 Discrete-Time Signal: A discrete-time signal is a sequence of values defined
at discrete instants in time. It is usually represented as x[n], where n is an
integer index that represents the time index. Discrete-time signals can be
obtained from continuous-time signals by sampling at regular intervals.

 Digital Signal: A digital signal is a type of discrete-time signal whose values


are quantized, typically in terms of binary digits (0s and 1s). A digital signal is
used in digital systems and can be represented by finite sequences of numbers,
often resulting from the digitization process.

2. When is a discrete-time signal called periodic?


A discrete-time signal x[n] is called periodic if there exists a positive integer N such
that:
x[n+N]=x[n]for all n∈Z
The smallest such N is called the period of the signal. This means the signal repeats
itself after every N samples.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

 Example: x[n]=sin(52πn) is periodic with period N=5

3. What is impulse response? Explain its significance:


 Impulse Response: The impulse response of a system, denoted h[n](for
discrete-time systems), is the output of the system when the input is a unit
impulse δ[n], i.e., when the system is given an impulse as input at n=0

 Significance:

o The impulse response is fundamental in understanding the behavior of


linear time-invariant (LTI) systems.

o It completely characterizes the system. By using the convolution sum


(or integral in continuous systems), the output for any arbitrary input
signal can be computed if the impulse response is known.

o It is used for system analysis, filtering, and designing systems like FIR
and IIR filters.

4. What is the importance of causality?


 Causality refers to the property of a system where the output at any time n
depends only on the values of the input at the current or previous times. A
system is causal if, for any time n. the output y[n] depends only on
x[n],x[n−1],… and not on future values of x[n]

 Importance:

o Causal systems are realizable in physical systems because we cannot use


future inputs to generate current outputs.

o Most real-time systems, like controllers or filters, are designed to be


causal.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

 Example: A system where y[n]=x[n−1]+x[n−2] is causal, as the output


depends only on past inputs.

5. How will you classify the discrete-time signals?


Discrete-time signals can be classified into the following categories based on various
properties:
 Based on Time:

o Aperiodic Signals: Signals that are not periodic (e.g., exponential


signals, pulses).

o Periodic Signals: Signals that repeat at regular intervals (e.g., sinusoidal


signals).

 Based on Symmetry:

o Even Signals: Signals that satisfy x[n]=x[−n]

o Odd Signals: Signals that satisfy x[n]=−x[−n]

 Based on Duration:

o Finite-Length Signals: Signals that have a finite number of non-zero


values (e.g., a pulse).

o Infinite-Length Signals: Signals that have an infinite number of values


(e.g., e−n)

 Based on Behavior:

o Deterministic Signals: Signals that can be exactly described (e.g.,


sinusoidal or exponential signals).

o Random Signals: Signals whose values cannot be exactly predicted


(e.g., noise).
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

RESULT
Thus, the convolution of two finite length sequences was simulated using MATLAB
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment
no:3 Computation of Circular convolution with and without function

Aim
To learn about the manual computation and application of MATLAB's built-in
functions for circular convolution of two finite length sequences.
Mapping with theory
Circular Convolution
Circular convolution is a fundamental operation in Digital Signal Processing (DSP)
used primarily to process finite-length sequences, especially in the context of
periodic signals or systems.
 Definition: Circular convolution is a mathematical operation performed on two
finite-length sequences to obtain a third sequence. Unlike linear convolution,
circular convolution assumes that the sequences are periodic, meaning they
"wrap around" at their boundaries.

 Circular Convolution Formula:


The circular convolution of two N-point periodic sequences, x(n) and y(n), is
an N-point sequence a(m), which is defined by:

Here, the sequence a(m) represents the result of the circular convolution of x(n) and
y(n), where the indices are wrapped around at the boundaries.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Procedure
Launch MATLAB:
 Double-click on the MATLAB icon on your desktop or search for MATLAB in
your computer's application launcher and open it.

Create a New Script or Open an Existing Script:


 In MATLAB's Command Window or Editor, you can either create a new script
or open an existing one.

 To create a new script, go to the "Home" tab, click on "New Script", and a new
script file will open in the Editor.

 To open an existing script, go to the "Home" tab, click on "Open", and select
the script file you want to open.

Write or Paste Your MATLAB Code:


 In the MATLAB Editor, write or paste your MATLAB code into the script file.
MATLAB code can include commands, functions, variable assignments, etc.

Save the Script File:


 Save the script file with a meaningful name and the extension ".m" (e.g.,
"my_script.m").

 To save, click on "Save" or "Save As" in the MATLAB Editor's toolbar, or use
the keyboard shortcut (Ctrl + S on Windows).

Run the Script:


 To run the entire script, click on the "Run" button in the Editor's toolbar, or you
can simply type the name of the script (without the ".m" extension) in the
Command Window and press Enter.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Execute and Display the Output:After running the script, MATLAB will execute
the code and display the output in the Command Window or other MATLAB
windows (e.g., figure windows for plots).
Plotting Output (For Graphical Results):
 If your code generates plots, figures, or other graphical outputs, they will be
displayed in separate windows.

Pseudocode
1. Start
2. Initialize MATLAB environment (clear previous variables, close plots)
3. Prompt user to input the sequence 'x' (input sequence)
- Input: x = [user-provided sequence]
4. Prompt user to input the sequence 'y' (impulse response)
- Input: y = [user-provided sequence]

5. Compute the lengths of sequences x and y:


- a = length of x
- b = length of y
6. Calculate the necessary zero-padding:
- c = a - b (difference between lengths)
- f = max(a, b) (length of the output sequence)

7. Perform circular convolution using the built-in MATLAB function:


- g = cconv(x, y, f) (built-in circular convolution)

8. Apply zero-padding to the sequences if necessary:


- If c < 0, then pad x with zeros
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

- Else, pad y with zeros


- Modify x or y by appending zeros to match the length f

9. Initialize an empty array for manual convolution result: d = []

10. For each value of n from 1 to f (the length of the result):


- Initialize d[n] = 0
- For each value of i from 1 to f:
- Compute j = n - i + 1 (index for circular wraparound)
- If j <= 0, adjust j to wrap around: j = j + f
- Update the convolution sum: d[n] = d[n] + x[i] * y[j]

11. Display the manual convolution result 'd' and the built-in convolution result 'g'

12. Plot the sequences and results:


- Subplot 1: Plot input sequence x[n]
- Subplot 2: Plot impulse response y[n]
- Subplot 3: Plot manual convolution result d[n]
- Subplot 4: Plot built-in convolution result g[n]
13. End
Program
close(); % Close all figures
clear(); % Clear all variables

% Step 1: Get input sequence


x = input('Enter the input sequence: ');

% Step 2: Get impulse response


y = input('Enter the impulse response: ');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

% Step 3: Calculate lengths of input and impulse response


a = length(x); % Length of input sequence
b = length(y); % Length of impulse response

% Step 4: Calculate the difference in lengths and the maximum length


c = a - b; % Length difference
f = max(a, b); % Maximum length between input and impulse response

% Step 5: Perform circular convolution using the built-in MATLAB function


g = cconv(x, y, f);

% Step 6: Zero-pad the shorter sequence


if (c < 0)
x = [x, zeros(1, -c)]; % Zero-pad input sequence if needed
else
y = [y, zeros(1, c)]; % Zero-pad impulse response if needed
end

% Step 7: Perform circular convolution manually (without built-in function)


for n = 1:f
d(n) = 0; % Initialize output sequence
for i = 1:f
j = n - i + 1; % Calculate the index for circular convolution
if (j <= 0)
j = j + f; % Wrap around for circular indexing
end
d(n) = d(n) + x(i) * y(j); % Calculate the sum for convolution
end
end

% Step 8: Display results


disp('Manual Circular Convolution Result:');
disp(d); % Display the manually computed convolution
disp('Built-in Circular Convolution Result:');
disp(g); % Display the result from the built-in MATLAB function
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

% Step 9: Plotting the sequences and results


figure; % Create a new figure window

subplot(2, 2, 1);
stem(x);
title('Input Sequence');
xlabel('n');
ylabel('x(n)');

subplot(2, 2, 2);
stem(y);
title('Impulse Response');
xlabel('n');
ylabel('h(n)');

subplot(2, 2, 3);
stem(d);
title('Output Response (Manual Convolution)');
xlabel('n');
ylabel('y(n)');

subplot(2, 2, 4);
stem(g);
title('Output Response (Built-in Function)');
xlabel('n');
ylabel('y(n)');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Output
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Industrial applications
 Communication Systems: Circular convolution plays a significant role in
communication systems for tasks such as channel equalization, modulation,
and demodulation processes.

 Image Processing: Circular convolution is applied in image processing for


tasks such as image filtering, edge detection, and image restoration.

 Audio Applications: Circular convolution is used for implementing audio


effects such as reverb, echo, and chorus in digital audio processing systems.

VIVA Questions & Answers


1. How to calculate the output length of linear and circular convolution?
 Linear Convolution: The output length of linear convolution is the sum of the
lengths of the two input sequences minus one:

Lout=M+N-1
where M and N are the lengths of the two sequences.
 Circular Convolution: The output length of circular convolution is the length
of the larger sequence (usually the length of the sequence after zero-padding to
make both sequences of equal length).

 Lout=max(M,N)

where M and N are the lengths of the two sequences, and padding is used to make the
lengths equal if needed.

2. What is the mathematical formula for convolution?


The mathematical formula for convolution in discrete-time is given by the
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

convolution sum:

where x[k] is the input sequence, h[n-k] is the impulse response, and y[n] is the
output sequence. This formula is used for linear convolution.

3. Why is circular convolution important in DSP?


Circular convolution is important in Digital Signal Processing (DSP) because:
 It is used for processing periodic signals, such as those encountered in
applications like communication systems, image processing, and audio
systems.

 Circular convolution is computationally efficient when implemented in systems


like Fast Fourier Transform (FFT), which allows for faster convolution
operations by converting to the frequency domain and then performing
multiplication.

 It is widely used in periodic systems where the signals wrap around, such as
wireless communication and multimedia applications.

4. What is the difference between periodic and circular convolution?


 Periodic Convolution refers to the convolution of periodic sequences, where
the sequences repeat after a certain period. In periodic convolution, the
sequences are assumed to be periodic with a specific period, and the result is
also periodic.

 Circular Convolution is a special case of periodic convolution where the


signals are assumed to wrap around after the period of the sequence. Circular
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

convolution involves performing convolution in a manner where the sequence


"wraps" around at the boundaries, commonly used when handling sequences in
a circular buffer or FFT-based processing.

The primary difference is that circular convolution works on sequences of finite


length and assumes they are periodic, while periodic convolution can be applied to
truly periodic signals.

5. What is the formula for circular convolution of two sequences?


The formula for the circular convolution of two sequences x(n)x(n)x(n) and
h(n)h(n)h(n) of length NNN is given by:

where x(n) and h(n) are the two input sequences, and y(m) is the output of the
convolution. The term (m-n) mod N ensures that the indices wrap around in a
circular manner.

RESULT
Thus, the convolution of two finite length sequences was simulated using MATLAB.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment
no:4 Computation of Auto correlation and cross correlation

Aim
To gain a thorough understanding of auto-correlation and cross-correlation functions
and their significance in signal processing and communication systems.
Mapping with Theory
Auto correlation & Cross correlation
a) Auto-correlation:
Auto-correlation is a measure of similarity between a signal and a delayed version of
itself. It quantifies how much a signal correlates with itself at different time lags.
Auto-correlation is useful in identifying patterns such as periodicity or self-similarity
in signals.

b) Cross-correlation:
Cross-correlation measures the similarity between two different signals as a function
of the displacement of one relative to the other. It determines how much one signal
resembles another when one is shifted in time. Cross-correlation is used to detect
similarities and alignment between two signals.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Procedure

1. Launch MATLAB: Double-click the MATLAB icon or search for it in the


application launcher.
2. Create/Open Script:
o To create a new script: Go to the "Home" tab and click "New Script."
o To open an existing script: Go to the "Home" tab, click "Open," and
select the script.
3. Write/Paste Code: In the MATLAB Editor, write or paste your MATLAB
code.
4. Save Script: Save the script with a meaningful name and ".m" extension (e.g.,
"my_script.m").
5. Run Script:
o Click the "Run" button in the Editor toolbar, or
o Type the script name (without ".m") in the Command Window and press
Enter.
6. View Output: MATLAB will display the results in the Command Window or
graphical output in figure windows.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Pseudocode
1. Start
2. Clear the workspace and close any open figures:
- Call the command 'close'
- Call the command 'clear'
3. Prompt the user to input the first sequence (for auto-correlation):
- Display the message: "Enter the input sequence for Auto-correlation"
- Store the input in variable 'x'
4. Compute the auto-correlation of sequence 'x':
- Use the function 'xcorr(x)' to compute the auto-correlation and store the result in
variable 'z_auto'
5. Prompt the user to input the second sequence (for cross-correlation):
- Display the message: "Enter the input sequence for Cross-correlation"
- Store the input in variable 'y'
6. Compute the cross-correlation of sequences 'x' and 'y':
- Use the function 'xcorr(x, y)' to compute the cross-correlation and store the result
in variable 'z_cross'
7. Display the auto-correlation and cross-correlation results:
- Display 'z_auto' in the Command Window
- Display 'z_cross' in the Command Window
8. Create a new figure for plotting:
9. Create the first subplot for the input sequence of auto-correlation:
- Plot 'x' using 'stem' function with thick black lines ('LineWidth' = 2, 'Color' = [0 0
0])
- Set the title: "Input Sequence for Auto-correlation"
- Label the x-axis as "n"
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

- Label the y-axis as "x(n)"


- Add a grid for better visibility
10. Create the second subplot for the auto-correlation result:
- Plot 'z_auto' using 'stem' function with thick black lines ('LineWidth' = 2, 'Color'
= [0 0 0])
- Set the title: "Auto-correlation Output"
- Label the x-axis as "n"
- Label the y-axis as "z(n)"
- Add a grid for better visibility
11. Create the third subplot for the input sequence of cross-correlation:
- Plot 'y' using 'stem' function with thick black lines ('LineWidth' = 2, 'Color' = [0 0
0])
- Set the title: "Input Sequence for Cross-correlation"
- Label the x-axis as "n"
- Label the y-axis as "y(n)"
- Add a grid for better visibility
12. Create the fourth subplot for the cross-correlation result:
- Plot 'z_cross' using 'stem' function with thick black lines ('LineWidth' = 2, 'Color'
= [0 0 0])
- Set the title: "Cross-correlation Output"
- Label the x-axis as "n"
- Label the y-axis as "z(n)"
- Add a grid for better visibility
13.end
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Program
close;
clear;

% Auto-correlation
x = input('Enter the input sequence for Auto-correlation: '); % Input sequence
z_auto = xcorr(x); % Auto-correlation calculation

% Cross-correlation
y = input('Enter the input sequence for Cross-correlation: '); % Input sequence 2
z_cross = xcorr(x, y); % Cross-correlation calculation

% Displaying results in Command Window


disp('Auto-correlation result:');
disp(z_auto);

disp('Cross-correlation result:');
disp(z_cross);

% Plotting the results


figure;

% Plot for Auto-correlation


subplot(2, 2, 1);
stem(x, 'LineWidth', 2, 'Color', [0 0 0]); % Thicker dark line for input sequence
title('Input Sequence for Auto-correlation');
xlabel('n');
ylabel('x(n)');
grid on;

subplot(2, 2, 2);
stem(z_auto, 'LineWidth', 2, 'Color', [0 0 0]); % Thicker dark line for auto-
correlation
title('Auto-correlation Output');
xlabel('n');
ylabel('z(n)');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

grid on;

% Plot for Cross-correlation


subplot(2, 2, 3);
stem(y, 'LineWidth', 2, 'Color', [0 0 0]); % Thicker dark line for input sequence
title('Input Sequence for Cross-correlation');
xlabel('n');
ylabel('y(n)');
grid on;

subplot(2, 2, 4);
stem(z_cross, 'LineWidth', 2, 'Color', [0 0 0]); % Thicker dark line for cross-
correlation
title('Cross-correlation Output');
xlabel('n');
ylabel('z(n)');
grid on;
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Outputs

Real Time Applications


Auto-correlation:
 Speech Recognition Systems: Auto-correlation is used in real-time speech
recognition systems to identify repeating patterns or phonemes in speech
signals. This helps in the accurate transcription and interpretation of spoken
language.

 Electrocardiography (ECG) Monitoring Systems: Auto-correlation is


applied in ECG systems to detect heartbeats, analyze heart rate variability, and
identify cardiac abnormalities. This enables timely diagnosis and treatment of
cardiovascular diseases.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Cross-correlation:
 Motion Tracking Systems: Cross-correlation is used in real-time motion
tracking systems for object detection, tracking, and localization in video
surveillance, autonomous vehicles, and robotics. This helps in enabling
accurate and robust motion analysis and control.

 Audio Processing Applications: In real-time audio processing, such as


microphone arrays and beamforming systems, cross-correlation is employed to
estimate time delays between microphone signals. This facilitates spatial
filtering and noise suppression during audio capture and playback.

VIVA Questions and answers

1. What is the difference between correlation and autocorrelation?


 Correlation refers to the relationship or similarity between two different
signals. It measures how one signal is related to another when one is shifted in
time.

 Autocorrelation refers to the correlation of a signal with itself at different time


shifts or lags. It helps identify repeating patterns or periodicity within the same
signal.

2. What do you mean by Autocorrelation and Cross-correlation sequences?


 Autocorrelation Sequence: This is the sequence obtained by computing the
correlation of a signal with itself over different time shifts or lags. It is used to
measure the similarity between the signal and a delayed version of itself.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

 Cross-correlation Sequence: This is the sequence obtained by computing the


correlation between two different signals over different time shifts. It helps
determine how one signal resembles another when one is shifted in time.

3. List all the properties of autocorrelation and Cross-correlation sequences.


Properties of Autocorrelation:
 Symmetry: Rx(τ)=Rx(−τ) (Auto-correlation is symmetric).

 Maximum Value at Zero Lag: The maximum value of the auto-correlation


occurs when the time shift (lag) is zero.

 Even Function: Auto-correlation is an even function, meaning the correlation


is the same whether the signal is shifted forward or backward in time.

Properties of Cross-correlation:
 Commutative: Rxy(τ)=Ryx(−τ)

 Shifting Property: Cross-correlation shifts by the same amount as the signal


shift.

 Maximum Value: The maximum value of the cross-correlation occurs when


the two signals are best aligned in time.

4. What is the use of correlation?


Correlation is used in signal processing to measure the similarity between two signals
or between a signal and a delayed version of itself. It is useful for:
 Identifying patterns or trends within signals.

 Estimating time delays between signals.


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

 Feature detection in various applications such as audio processing, image


recognition, and time series analysis.

5. What are the advantages of using autocorrelation and cross-correlation


properties in signal processing fields?
 Autocorrelation:

o Helps in detecting periodicity and repetitive patterns in a signal.

o Useful in identifying the fundamental frequency in signals like speech,


audio, and communications.

o Provides a means to analyze the power spectrum of a signal and its


energy distribution.

 Cross-correlation:

o Useful in detecting the similarity between two signals, especially when


they are offset in time.

o Helps in applications such as signal alignment, object detection, and


localization (e.g., in radar systems, video tracking).

o Can be used for noise reduction and enhancing signal quality by


estimating time shifts and compensating for them.

Both autocorrelation and cross-correlation are vital for identifying features,


enhancing signal quality, detecting patterns, and performing time-shifted analysis in
real-time signal processing applications like speech recognition, motion tracking, and
ECG monitoring.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Results
Thus, the autocorrelation and cross correlation for the given sequence is simulated
using MATLAB.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment
no:5 Calculation of Fast Fourier Transform of a signal

Aim
To write a MATLAB program to compute the Discrete Fourier Transform (DFT) of
finite length sequence x[n]and Inverse Discrete Fourier Transform (IDFT) of a
sequence x(k).
Mapping with Theory
FFT and IFFT
The FFT (Fast Fourier Transform) and its inverse, IFFT (Inverse Fast Fourier
Transform), are fundamental tools in digital signal processing (DSP) for analyzing
and synthesizing signals in the frequency domain.

i) Fast Fourier Transform (FFT)


The FFT is an algorithm used to compute the Discrete Fourier Transform (DFT) of
a sequence or array of data points.
It efficiently calculates the frequency components of a signal by decomposing it
into its constituent sinusoidal components of different frequencies.
The FFT algorithm reduces the computational complexity of the DFT from O(N^2)
to O(N log N), making it much faster for practical implementation, especially for
large datasets.

X[k] = ∑x[n] * e^(-j2πkn/N)


[n=0 to N-1]
Where;
X[k] is the frequency-domain representation of the signal.
x[n] is the time-domain signal.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

N is the number of samples in the sequence.


e^(-j2πkn/N) is the twiddle factor.

a) Decimation in Time (DIT) FFT


The DIT FFT algorithm recursively divides the DFT into smaller DFTs.
FFT formula for the butterfly operation (a basic operation in FFT) is as follows:
X[k] = E[k] + e^(-j2πk/N) * O[k]
X[k+N/2] = E[k] - e^(-j2πk/N) * O[k]
Where;
X[k] and X[k+N/2] are the output DFT coefficients.
E[k], O[k] are the even-indexed and odd-indexed input DFT coefficients
N is the length of the input sequence.
e^(-j2πk/N) is the twiddle factor

b) Decimation in Frequency (DIF) FFT


The DIF FFT algorithm recursively combines smaller DFTs into larger DFTs. The
DIF FFT formula for the butterfly operation is as follows:
E[k] = X[k] + X[k+N/2]
O[k] = (X[k] - X[k+N/2]) * e^(j2πk/N)
Where;
X[k] and X[k+N/2] are the output DFT coefficients.
E[k], O[k] are the even-indexed and odd-indexed input DFT coefficients
N is the length of the input sequence.
e^(-j2πk/N) is the twiddle factor

ii) Inverse Fast Fourier Transform (IFFT)


The IFFT is the inverse operation of the FFT. It synthesizes a time-domain signal
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

from its
frequency-domain representation.
Given the frequency components obtained from the FFT, the IFFT reconstructs the
original signal by summing up the sinusoidal components at their respective
frequencies.
Like the FFT, the IFFT algorithm is also efficient, with a computational
complexity of O(N log N).
x[n] = (1/N) * ∑[k=0 to N-1] X[k] * e^(j2πkn/N)

Procedure

1. Launch MATLAB: Double-click the MATLAB icon or search for it in the


application launcher.
2. Create/Open Script:
o To create a new script: Go to the "Home" tab and click "New Script."
o To open an existing script: Go to the "Home" tab, click "Open," and
select the script.
3. Write/Paste Code: In the MATLAB Editor, write or paste your MATLAB
code.
4. Save Script: Save the script with a meaningful name and ".m" extension (e.g.,
"my_script.m").
5. Run Script:
o Click the "Run" button in the Editor toolbar, or
o Type the script name (without ".m") in the Command Window and press
Enter.
6. View Output: MATLAB will display the results in the Command Window or
graphical output in figure windows.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Pseudocode

FFT&IFFT-WITH FUNCTION

START

1. Close all open figures.

2. Clear all workspace variables and command window.

3. Prompt user for input sequence `x`.

4. Compute FFT:

- Set `y = FFT(x)`.

5. Compute IFFT:

- Set `z = IFFT(y)`.

6. Display Results:

- Print `y` (FFT result).

- Print `z` (IFFT result).

7. Plot Results:

- Create a figure window.

- Plot Input Sequence:

- Use a stem plot for `x`.

- Add labels and title: "Input Sequence".

- Plot Real Part of FFT:

- Use a stem plot for `Real(y)`.

- Add labels and title: "FFT Sequence - Real Part".


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

- Plot Imaginary Part of FFT:

- Use a stem plot for `Imag(y)`.

- Add labels and title: "FFT Sequence - Imaginary Part".

- Plot IFFT Sequence:

- Use a stem plot for `Real(z)`.

- Add labels and title: "IFFT Sequence".

END

4 point DIT-FFT & IFFT


START

1. Close all open figures.

2. Clear all workspace variables and command window.

3. Prompt user for input sequence `x`.

- If length of `x` is not 4, display "Input sequence must be of length 4." and
terminate.

4. Stage 1 of DIT-FFT:

- a(1) = x(1) + x(3)

- a(2) = x(1) - x(3)

- b(1) = x(2) + x(4)

- b(2) = x(2) - x(4)

5. Compute FFT:

- For j = 1 to n/2:

- y(j) = a(j) + (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n))


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

- y(j + 2) = a(j) - (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n))

6. Compute IFFT:

- q = conj(y)

- a(1) = q(1) + q(3)

- a(2) = q(1) - q(3)

- b(1) = q(2) + q(4)

- b(2) = q(2) - q(4)

7. Compute IFFT:

- For j = 1 to n/2:

- z(j) = a(j) + (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n))

- z(j + 2) = a(j) - (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n))

8. Normalize and conjugate:

- s = conj(z)

-w=s/4

9. Display results:

- Print y (FFT result)

- Print w (IFFT result)

10. Plot Results:

- Create a figure window.

- Plot Input Sequence: stem(x)

- Plot Real Part of FFT: stem(real(y))


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

- Plot Imaginary Part of FFT: stem(imag(y))

- Plot IFFT Sequence: stem(real(w))

END

8 POINT DIT-FFT&IFFT

START

1. Close all open figures.

2. Clear all workspace variables and the command window.

3. Prompt user for input sequence `x`.

- If length of `x` is not 8, display "Input sequence must be of length 8." and
terminate.

4. Stage 1 of DIT-FFT:

- Initialize arrays `a` and `b` with size 4.

- Compute `a(1) = x(1) + x(5)`, `a(2) = x(1) - x(5)`, `b(1) = x(3) + x(7)`, `b(2) =
x(3) - x(7)`, `a(3) = x(2) + x(6)`, `a(4) = x(2) - x(6)`, `b(3) = x(4) + x(8)`, `b(4) = x(4)
- x(8)`.

5. Compute FFT for Stage 1:

- For `j = 1` to `n/2`:

- `y(j) = a(j) + (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / c))`

- `y(j + 2) = a(j) - (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / c))`

- `z(j) = a(j + 2) + (b(j + 2) * exp((-1 * 2 * pi * 1i * (j - 1)) / c))`

- `z(j + 2) = a(j + 2) - (b(j + 2) * exp((-1 * 2 * pi * 1i * (j - 1)) / c))`

6. Stage 2 of DIT-FFT:

- Initialize array `w` with size 8.


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

- For `j = 1` to `n/2`:

- `w(j) = y(j) + (z(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n))`

- `w(j + 4) = y(j) - (z(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n))`

7. IFFT Process:

- Compute conjugate `q = conj(w)`.

- Compute `a(1) = q(1) + q(5)`, `a(2) = q(1) - q(5)`, `b(1) = q(3) + q(7)`, `b(2) =
q(3) - q(7)`, `a(3) = q(2) + q(6)`, `a(4) = q(2) - q(6)`, `b(3) = q(4) + q(8)`, `b(4) = q(4)
- q(8)`.

8. Compute IFFT:

- For `j = 1` to `n/2`:

- `y(j) = a(j) + (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / c))`

- `y(j + 2) = a(j) - (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / c))`

- `z(j) = a(j + 2) + (b(j + 2) * exp((-1 * 2 * pi * 1i * (j - 1)) / c))`

- `z(j + 2) = a(j + 2) - (b(j + 2) * exp((-1 * 2 * pi * 1i * (j - 1)) / c))`

9. Final IFFT Processing:

- For `j = 1` to `n/2`:

- `k(j) = y(j) + (z(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n))`

- `k(j + 4) = y(j) - (z(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n))`

10. Normalize and conjugate for IFFT:

- `s = conj(k)`

- `l = s / n`
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

11. Display results:

- Print `w` (FFT result)

- Print `l` (IFFT result)

12. Plot results:

- Create a figure window.

- Plot Input Sequence: `stem(x)`

- Plot Real Part of FFT: `stem(real(w))`

- Plot Imaginary Part of FFT: `stem(imag(w))`

- Plot IFFT Sequence: `stem(real(l))`

END

4 POINT DIF-FFT&IFFT

START

1. Close all open figures.

2. Clear all workspace variables and the command window.

3. Prompt user for input sequence `x`.

- If length of `x` is not 4, display "Input sequence must be of length 4." and
terminate.

4. Stage 1: DIF-FFT:

- Initialize arrays `a` and `b` with size 2 (half of sequence length).

- For `j = 1` to `n/2`:

- Compute `a(j) = x(j) + x(j + c)`

- Compute `b(j) = (x(j) - x(j + c)) * exp((-1 * 2 * pi * 1i * (j - 1)) / n)`


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

5. Compute FFT for Stage 1:

- Initialize `y` array with size `n`.

- Compute `y(1) = a(1) + a(2)`, `y(3) = a(1) - a(2)`, `y(2) = b(1) + b(2)`, `y(4) = b(1)
- b(2)`.

6. Stage 2: IFFT:

- Compute conjugate of `y`: `g = conj(y)`.

- For `j = 1` to `n/2`:

- Compute `a(j) = g(j) + g(j + c)`

- Compute `b(j) = (g(j) - g(j + c)) * exp((-1 * 2 * pi * 1i * (j - 1)) / n)`

7. Compute IFFT:

- Initialize array `h` with size `n`.

- Compute `h(1) = a(1) + a(2)`, `h(3) = a(1) - a(2)`, `h(2) = b(1) + b(2)`, `h(4) = b(1)
- b(2)`.

8. Final IFFT Processing:

- Compute conjugate again: `m = conj(h)`.

- Normalize the result: `l = m / n`.

9. Display results:

- Print `y` (FFT result).

- Print `l` (IFFT result).

10. Plot results:

- Create a figure window.

- Plot Input Sequence: `stem(x)`.


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

- Plot Real Part of FFT: `stem(real(y))`.

- Plot Imaginary Part of FFT: `stem(imag(y))`.

- Plot IFFT Sequence: `stem(real(l))`.

END

8-Point DIF-FFT & IFFT

START

1. Close all open figures.

2. Clear all workspace variables.

3. Prompt user for input sequence `x`.

- If length of `x` is not 8, terminate with an error message.

4. Define `n` as length of `x` and `c` as `n/2`.

5. First stage: Split and combine:

- For `j = 1` to `n/2`:

- Compute `a(j) = x(j) + x(j + 4)`

- Compute `b(j) = (x(j) - x(j + 4)) * exp((-1 * 2 * pi * i * (j - 1)) / n)`

- Compute `a(j + 2) = x(j + 2) + x(j + 6)`

- Compute `b(j + 2) = (x(j + 2) - x(j + 6)) * exp((-1 * 2 * pi * i * (j + 1)) / n)`

6. Second stage: FFT calculations:

- For `j = 1` to `n/2`:

- Compute `y(j) = a(j) + a(j + 2)`

- Compute `y(j + 2) = (a(j) - a(j + 2)) * exp((-1 * 2 * pi * i * (j - 1)) / c)`


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

- Compute `z(j) = b(j) + b(j + 2)`

- Compute `z(j + 2) = (b(j) - b(j + 2)) * exp((-1 * 2 * pi * i * (j - 1)) / c)`

7. Compute FFT results:

- Compute `w(1) = y(1) + y(2)`

- Compute `w(5) = y(1) - y(2)`

- Compute `w(3) = y(3) + y(4)`

- Compute `w(7) = y(3) - y(4)`

- Compute `w(2) = z(1) + z(2)`

- Compute `w(6) = z(1) - z(2)`

- Compute `w(4) = z(3) + z(4)`

- Compute `w(8) = z(3) - z(4)`

8. Inverse FFT:

- Compute conjugate of `w`: `s = conj(w)`

- For `j = 1` to `n/2`:

- Compute `a(j) = s(j) + s(j + 4)`

- Compute `b(j) = (s(j) - s(j + 4)) * exp((-1 * 2 * pi * i * (j - 1)) / n)`

- Compute `a(j + 2) = s(j + 2) + s(j + 6)`

- Compute `b(j + 2) = (s(j + 2) - s(j + 6)) * exp((-1 * 2 * pi * i * (j + 1)) / n)`

9. Compute second stage of IFFT:

- For `j = 1` to `n/2`:

- Compute `y(j) = a(j) + a(j + 2)`


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

- Compute `y(j + 2) = (a(j) - a(j + 2)) * exp((-1 * 2 * pi * i * (j - 1)) / c)`

- Compute `z(j) = b(j) + b(j + 2)`

- Compute `z(j + 2) = (b(j) - b(j + 2)) * exp((-1 * 2 * pi * i * (j - 1)) / c)`

10. Final results of IFFT:

- Compute `q(1) = y(1) + y(2)`

- Compute `q(5) = y(1) - y(2)`

- Compute `q(3) = y(3) + y(4)`

- Compute `q(7) = y(3) - y(4)`

- Compute `q(2) = z(1) + z(2)`

- Compute `q(6) = z(1) - z(2)`

- Compute `q(4) = z(3) + z(4)`

- Compute `q(8) = z(3) - z(4)`

11. Normalize and compute final IFFT result:

- Compute conjugate: `p = conj(q)`

- Normalize: `r = p / n`

12. Display results:

- Print `w` (FFT result)

- Print `r` (IFFT result)

13. Plot results:

- Plot Input Sequence: `stem(x)`

- Plot Real Part of FFT: `stem(real(w))`


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

- Plot Imaginary Part of FFT: `stem(imag(w))`

- Plot IFFT Sequence: `stem(real(r))`

END

Programs
FFT&IFFT-WITH FUNCTION

close all;
clear;
clc;

% Input sequence
x = input('Enter the input sequence (e.g., [1 2 3 4]): ');

% Perform FFT and IFFT


y = fft(x);
z = ifft(y);

% Display results
disp('FFT of the input sequence:');
disp(y);
disp('IFFT of the sequence (should match input):');
disp(z);

% Plotting the results


figure;

% Plot Input sequence


subplot(2, 2, 1);
stem(x, 'filled');
title('Input sequence');
xlabel('n');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

ylabel('x(n)');

% Plot Real part of FFT


subplot(2, 2, 2);
stem(real(y), 'filled');
title('FFT sequence - Real Part');
xlabel('k');
ylabel('Re(x(k))');

% Plot Imaginary part of FFT


subplot(2, 2, 3);
stem(imag(y), 'filled');
title('FFT sequence - Imaginary Part');
xlabel('k');
ylabel('Im(x(k))');

% Plot IFFT sequence


subplot(2, 2, 4);
stem(real(z), 'filled'); % Only plotting the real part for visualization
title('IFFT sequence');
xlabel('n');
ylabel('x(n)');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

4 point DIT-FFT & IFFT


close all;
clear;
clc;

% Input 4-point sequence


x = input('Enter the input sequence (length must be 4): ');

if length(x) ~= 4
error('Input sequence must be of length 4.');
end

n = length(x); % Sequence length


c = n / 2; % Half-length for computation

% Stage 1 of DIT-FFT
a(1) = x(1) + x(3);
a(2) = x(1) - x(3);
b(1) = x(2) + x(4);
b(2) = x(2) - x(4);
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

% Compute FFT
for j = 1:c
y(j) = a(j) + (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n));
y(j + 2) = a(j) - (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n));
end

% Compute IFFT
q = conj(y); % Take conjugate of FFT
a(1) = q(1) + q(3);
a(2) = q(1) - q(3);
b(1) = q(2) + q(4);
b(2) = q(2) - q(4);

for j = 1:c
z(j) = a(j) + (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n));
z(j + 2) = a(j) - (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n));
end

s = conj(z); % Take conjugate again


w = s / 4; % Normalize by dividing by sequence length

% Display results
disp('FFT of the input sequence:');
disp(y);
disp('IFFT of the sequence (should match input):');
disp(w);

% Plot results
figure;

% Input sequence
subplot(2, 2, 1);
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

stem(x, 'filled');
title('Input sequence');
xlabel('n');
ylabel('x(n)');

% FFT - Real part


subplot(2, 2, 2);
stem(real(y), 'filled');
title('FFT sequence - Real Part');
xlabel('k');
ylabel('Re(x(k))');

% FFT - Imaginary part


subplot(2, 2, 3);
stem(imag(y), 'filled');
title('FFT sequence - Imaginary Part');
xlabel('k');
ylabel('Im(x(k))');

% IFFT sequence
subplot(2, 2, 4);
stem(real(w), 'filled'); % Only plot real part
title('IFFT sequence');
xlabel('n');
ylabel('x(n)');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

8 Point DIT – FFT & IFFT


close all;
clear;
clc;

% Input sequence
x = input('Enter the input sequence (length must be 8): ');

if length(x) ~= 8
error('Input sequence must be of length 8.');
end

n = length(x); % Sequence length


c = n / 2; % Half-length for stage 1 and 2

% Stage 1
a = zeros(4, 1);
b = zeros(4, 1);

a(1) = x(1) + x(5);


a(2) = x(1) - x(5);
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

b(1) = x(3) + x(7);


b(2) = x(3) - x(7);
a(3) = x(2) + x(6);
a(4) = x(2) - x(6);
b(3) = x(4) + x(8);
b(4) = x(4) - x(8);

y = zeros(4, 1);
z = zeros(4, 1);
for j = 1:c/2
y(j) = a(j) + (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / c));
y(j + 2) = a(j) - (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / c));
z(j) = a(j + 2) + (b(j + 2) * exp((-1 * 2 * pi * 1i * (j - 1)) / c));
z(j + 2) = a(j + 2) - (b(j + 2) * exp((-1 * 2 * pi * 1i * (j - 1)) / c));
end

% Stage 2
w = zeros(8, 1);
for j = 1:c
w(j) = y(j) + (z(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n));
w(j + 4) = y(j) - (z(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n));
end

% IFFT Process
q = conj(w); % Conjugate of FFT result

a(1) = q(1) + q(5);


a(2) = q(1) - q(5);
b(1) = q(3) + q(7);
b(2) = q(3) - q(7);
a(3) = q(2) + q(6);
a(4) = q(2) - q(6);
b(3) = q(4) + q(8);
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

b(4) = q(4) - q(8);

for j = 1:c/2
y(j) = a(j) + (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / c));
y(j + 2) = a(j) - (b(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / c));
z(j) = a(j + 2) + (b(j + 2) * exp((-1 * 2 * pi * 1i * (j - 1)) / c));
z(j + 2) = a(j + 2) - (b(j + 2) * exp((-1 * 2 * pi * 1i * (j - 1)) / c));
end

k = zeros(8, 1);
for j = 1:c
k(j) = y(j) + (z(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n));
k(j + 4) = y(j) - (z(j) * exp((-1 * 2 * pi * 1i * (j - 1)) / n));
end

s = conj(k); % Conjugate again


l = s / n; % Normalize for IFFT

% Display results
disp('FFT of the input sequence:');
disp(w);
disp('IFFT of the sequence (should match input):');
disp(l);

% Plot results
figure;

% Input sequence
subplot(2, 2, 1);
stem(x, 'filled');
title('Input Sequence');
xlabel('n');
ylabel('x(n)');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

% FFT - Real Part


subplot(2, 2, 2);
stem(real(w), 'filled');
title('FFT Sequence - Real Part');
xlabel('k');
ylabel('Re(x(k))');

% FFT - Imaginary Part


subplot(2, 2, 3);
stem(imag(w), 'filled');
title('FFT Sequence - Imaginary Part');
xlabel('k');
ylabel('Im(x(k))');

% IFFT Sequence
subplot(2, 2, 4);
stem(real(l), 'filled'); % Only plot real part
title('IFFT Sequence');
xlabel('n');
ylabel('x(n)');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

4 Point DIF – FFT & IFFT


close all;
clear;
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

clc;

% Input sequence
x = input('Enter the input sequence (length must be 4): ');

if length(x) ~= 4
error('Input sequence must be of length 4.');
end

n = length(x); % Sequence length


c = n / 2; % Half-length

% Stage 1: DIF-FFT
a = zeros(c, 1);
b = zeros(c, 1);
for j = 1:c
a(j) = x(j) + x(j + c);
b(j) = (x(j) - x(j + c)) * exp((-1 * 2 * pi * 1i * (j - 1)) / n);
end

y = zeros(n, 1);
y(1) = a(1) + a(2);
y(3) = a(1) - a(2);
y(2) = b(1) + b(2);
y(4) = b(1) - b(2);

% Stage 2: IFFT
g = conj(y); % Conjugate for IFFT
for j = 1:c
a(j) = g(j) + g(j + c);
b(j) = (g(j) - g(j + c)) * exp((-1 * 2 * pi * 1i * (j - 1)) / n);
end
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

h = zeros(n, 1);
h(1) = a(1) + a(2);
h(3) = a(1) - a(2);
h(2) = b(1) + b(2);
h(4) = b(1) - b(2);

m = conj(h); % Take conjugate


l = m / n; % Normalize

% Display results
disp('FFT of the input sequence:');
disp(y);
disp('IFFT of the sequence (should match input):');
disp(l);

% Plot results
figure;

% Input sequence
subplot(2, 2, 1);
stem(x, 'filled');
title('Input Sequence');
xlabel('n');
ylabel('x(n)');

% FFT - Real Part


subplot(2, 2, 2);
stem(real(y), 'filled');
title('FFT Sequence - Real Part');
xlabel('k');
ylabel('Re(x(k))');

% FFT - Imaginary Part


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

subplot(2, 2, 3);
stem(imag(y), 'filled');
title('FFT Sequence - Imaginary Part');
xlabel('k');
ylabel('Im(x(k))');

% IFFT Sequence
subplot(2, 2, 4);
stem(real(l), 'filled'); % Only plot real part
title('IFFT Sequence');
xlabel('n');
ylabel('x(n)');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

8 Point DIF-FFT&IFFT
close()
clear()

% Input sequence
x = input('Enter the input sequence: ');
n = length(x);
c = n / 2;

% First stage: Split and combine


for j = 1:c/2
a(j) = x(j) + x(j + 4);
b(j) = (x(j) - x(j + 4)) * exp((-1 * 2 * pi * i * (j - 1)) / n);
a(j + 2) = x(j + 2) + x(j + 6);
b(j + 2) = (x(j + 2) - x(j + 6)) * exp((-1 * 2 * pi * i * (j + 1)) / n);
end

% Second stage: FFT calculations


for j = 1:c/2
y(j) = a(j) + a(j + 2);
y(j + 2) = (a(j) - a(j + 2)) * exp((-1 * 2 * pi * i * (j - 1)) / c);
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

z(j) = b(j) + b(j + 2);


z(j + 2) = (b(j) - b(j + 2)) * exp((-1 * 2 * pi * i * (j - 1)) / c);
end

% FFT results
w(1) = y(1) + y(2);
w(5) = y(1) - y(2);
w(3) = y(3) + y(4);
w(7) = y(3) - y(4);
w(2) = z(1) + z(2);
w(6) = z(1) - z(2);
w(4) = z(3) + z(4);
w(8) = z(3) - z(4);

% Inverse FFT
s = conj(w);
for j = 1:c/2
a(j) = s(j) + s(j + 4);
b(j) = (s(j) - s(j + 4)) * exp((-1 * 2 * pi * i * (j - 1)) / n);
a(j + 2) = s(j + 2) + s(j + 6);
b(j + 2) = (s(j + 2) - s(j + 6)) * exp((-1 * 2 * pi * i * (j + 1)) / n);
end

for j = 1:c/2
y(j) = a(j) + a(j + 2);
y(j + 2) = (a(j) - a(j + 2)) * exp((-1 * 2 * pi * i * (j - 1)) / c);
z(j) = b(j) + b(j + 2);
z(j + 2) = (b(j) - b(j + 2)) * exp((-1 * 2 * pi * i * (j - 1)) / c);
end

% Final results of IFFT


q(1) = y(1) + y(2);
q(5) = y(1) - y(2);
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

q(3) = y(3) + y(4);


q(7) = y(3) - y(4);
q(2) = z(1) + z(2);
q(6) = z(1) - z(2);
q(4) = z(3) + z(4);
q(8) = z(3) - z(4);

% Normalization and display


p = conj(q);
r = p / n;

% Display results
disp('FFT sequence:');
disp(w);
disp('IFFT sequence:');
disp(r);

% Plotting results
subplot(2, 2, 1);
stem(x);
title('Input sequence');
xlabel('n');
ylabel('x(n)');

subplot(2, 2, 2);
stem(real(w));
title('FFT sequence (Real part)');
xlabel('k');
ylabel('Re{x(k)}');

subplot(2, 2, 3);
stem(imag(w));
title('FFT sequence (Imaginary part)');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

xlabel('k');
ylabel('Im{x(k)}');

subplot(2, 2, 4);
stem(real(r));
title('IFFT sequence');
xlabel('n');
ylabel('x(n)');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

INDUSTRIAL APPLICATIONS:
FFT is employed for efficient implementation of digital filters, including low-pass,
high pass, band-pass, and notch filters
Magnitude plots help in designing filters by identifying the frequency components
to be attenuated or preserved.
In communication systems, phase plots aid in equalizing channel distortions by
compensating for phase shifts introduced during transmission.

Viva Question and Answers

1. What is phase and magnitude of FFT?


The Fast Fourier Transform (FFT) decomposes a signal into its constituent
frequencies. The magnitude represents the amplitude of each frequency component,
while the phase represents the relative timing or phase shift of each component.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

2. What does an FFT plot show?


An FFT plot visually represents the frequency spectrum of a signal. It displays the
magnitude of each frequency component on the y-axis and the frequency on the x-
axis.
3. What is FFT phase factor?
The FFT phase factor indicates the phase shift of each frequency component relative
to a reference point. It's crucial for reconstructing the original signal accurately.
4. What is FFT size?
FFT size refers to the number of data points used in the FFT calculation. A larger
FFT size provides better frequency resolution but requires more computational
resources.
5. How do you Analyze a FFT plot?
To analyze an FFT plot, look for prominent peaks, which indicate the dominant
frequencies in the signal. The height of the peak corresponds to the magnitude of that
frequency component. The phase information can be used to identify phase shifts and
delays in the signal.

1. Linearity of Fourier Transform: The Fourier Transform is a linear operation.


This means that the Fourier Transform of a linear combination of signals is equal
to the linear combination of the Fourier Transforms of the individual signals.
2. Time-Domain to Frequency-Domain Conversion: The Fourier Transform
converts a time-domain signal into its frequency-domain representation by
decomposing the signal into its constituent sinusoidal components. The amplitude
and phase of each sinusoidal component represent the magnitude and phase of the
corresponding frequency component.
3. Inverse Fourier Transform Non-Existence: An inverse Fourier Transform may
not exist for functions that are not absolutely integrable. In such cases, techniques
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

like the Laplace Transform or the Z-Transform can be used to analyze the system.
4. Real-world Applications of Fourier Transform: Fourier Transforms are widely
used in various fields:
 Signal Processing: Filtering, noise reduction, and feature extraction.
 Image Processing: Image compression, edge detection, and noise reduction.
 Communication Systems: Modulation, demodulation, and channel equalization.
 Spectroscopy: Analyzing the spectral composition of materials.
5. Fast Fourier Transform (FFT): FFT is an efficient algorithm for computing the
Discrete Fourier Transform (DFT). It reduces the computational complexity from
O(N^2) to O(N log N), making it suitable for large datasets. FFT works by
recursively dividing the input signal into smaller sub-signals and combining their
DFTs to obtain the DFT of the original signal.

RESULT
Thus the magnitude and phase plot for FFT was simulated using MATLAB.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment Computation of Linear Convolution using FAST FOURIER


no:6 TRANSFORM (FFT)

Aim
To write a MATLAB program to compute the Linear convolution of two finite length
sequences using FFT

Mapping With Theory


Linear convolution
Linear convolution is a fundamental operation in Digital Signal Processing
(DSP) used to combine two discrete-time signals to produce a third signal. This
operation is often denoted by the symbol '*', and it represents a linear and time-invariant
(LTI) system's response to an input signal.
The response of the LTI discrete time system to x[n](input) is given by
y[n] = x[k].h[n-k]
alternatively
y[n] = x[n-k].h[k]
The above sum is called convolution sum of the sequence’s x[n]and h[n] and
represented as y[n]=x[n]*h[n] where * denotes the convolution sum. If the length of
the two sequences being convolved is M and N, then the resulting sequence of the
convolution is of length M+N-1.
FFT (Fast Fourier Transform)
The Fast Fourier Transform (FFT) is an efficient algorithm used to compute the
Discrete Fourier Transform (DFT) and its inverse. It significantly reduces the
computational complexity of calculating the DFT, making it practical for real-world
applications.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

N-1
X[k] = ∑ x[n] * e^(-2πikn/N)
n=0
X[k]: Represents the kth frequency component in the frequency domain.
x[n]: Represents the nth sample of the sequence in the time domain.
N: Represents the length of the sequence.
k: Is an index ranging from 0 to N-1.
e: Is the base of the natural logarithm.
i: Is the imaginary unit.

Procedure

1. Launch MATLAB: Double-click the MATLAB icon or search for it in the


application launcher.
2. Create/Open Script:
o To create a new script: Go to the "Home" tab and click "New Script."
o To open an existing script: Go to the "Home" tab, click "Open," and
select the script.
3. Write/Paste Code: In the MATLAB Editor, write or paste your MATLAB
code.
4. Save Script: Save the script with a meaningful name and ".m" extension (e.g.,
"my_script.m").
5. Run Script:
o Click the "Run" button in the Editor toolbar, or
o Type the script name (without ".m") in the Command Window and press
Enter.
6. View Output: MATLAB will display the results in the Command Window or
graphical output in figure windows.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Pseudocode
1. **Input:**
- Get the first sequence `a` from the user.
- Get the second sequence `b` from the user.

2. **Calculate Output Length:**


- Determine the length of the output sequence `M`:
```
M = length(a) + length(b) - 1
```

3. **Create Time Index Vector:**


- Create a time index vector `N` of length `M`:
```
N = 0, 1, ..., M-1
```

4. **Compute DFT:**
- Calculate the Discrete Fourier Transform (DFT) of `a` and `b`, padding with zeros
to length `M`:
```
X = DFT(a, M)
Y = DFT(b, M)
```

5. **Multiply DFT Coefficients:**


- Multiply the corresponding DFT coefficients element-wise:
```
C = X * Y (element-wise multiplication)
```

6. **Compute IDFT:**
- Calculate the Inverse Discrete Fourier Transform (IDFT) of `C` to obtain the linear
convolution result `c`:
```
c = IDFT(C)
```
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

7. **Display Output:**
- Print the output sequence `c` to the console.
8. **Plot Sequences:**
- **Plot Input Sequence 1:**
- Plot `a` against the first `length(a)` elements of `N`.
- Label the x-axis as "n".
- Label the y-axis as "x(n)".
- Title the plot "Input sequence 1".
- **Plot Input Sequence 2:**
- Plot `b` against the first `length(b)` elements of `N`.
- Label the x-axis as "n".
- Label the y-axis as "x(n)".
- Title the plot "Input sequence 2".
- **Plot Output Sequence:**
- Plot `c` against the entire `N` vector.
- Label the x-axis as "n".
- Label the y-axis as "c(n)".
- Title the plot "Output sequence"

Program
a = input('Enter the first sequence=');
b = input('Enter the second sequence=');

% Determine the length of the output sequence


M = length(a) + length(b) - 1;

% Create a time index vector N with the same length as M


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

N = 0:M-1;

% Calculate the linear convolution using FFT


X = fft(a, M);
Y = fft(b, M);
C = ifft(X.*Y);

% Display the output sequence


disp('Output sequence=');
disp(C)

% Plot the input and output sequences


subplot(2,2,1);
stem(N(1:length(a)), a); % Adjust N to match the length of a
xlabel('n');
ylabel('x(n)');
title('Input sequence 1');

subplot(2,2,2);
stem(N(1:length(b)), b); % Adjust N to match the length of b
xlabel('n');
ylabel('x(n)');
title('Input sequence 2');

subplot(2,2,3);
stem(N, C);
xlabel('n');
ylabel('c(n)');
title('Output sequence');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Output

INDUSTRIAL APPLICATIONS
In industries such as telecommunications, audio processing, and radar systems, DSP
plays a critical role. Linear convolution using FFT is extensively used in DSP systems
for tasks such as filtering, equalization, and signal analysis
In industries such as multimedia, linear convolution using FFT finds applications in
image and video processing tasks such as edge detection, image enhancement, and
motion estimation. By convolving images or video frames with appropriate filters, FFT
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

based linear convolution allows for efficient feature extraction and manipulation.

Viva Question and answers


1. Why Zero-Padding Used in Linear Convolution?
Zero-padding is a technique used in linear convolution to avoid circular convolution
artifacts. By appending zeros to the input sequences, we ensure that the linear
convolution operation is performed without the time-domain wrap-around effect. This
is crucial for accurately representing the true linear convolution of the signals.
2. What are the Properties of Linear Convolution?
 Commutative Property: The order of convolution does not affect the result:
x[n] * h[n] = h[n] * x[n]
 Associative Property: The order of multiple convolutions does not matter:
(x[n] * h1[n]) * h2[n] = x[n] * (h1[n] * h2[n])
 Distributive Property: Convolution distributes over addition:
x[n] * (h1[n] + h2[n]) = x[n] * h1[n] + x[n] * h2[n]

3. Write the Expansion of Discrete Convolution


The discrete convolution of two sequences x[n] and h[n] is defined as:
y[n] = x[n] * h[n] = Σ(x[k] * h[n-k])
where the summation is over all values of k for which the product x[k] * h[n-k] is non-
zero.
4. What are the Methods to Compute the Convolution Sum of Two Sequences?
 Direct Convolution: This method involves directly applying the convolution sum
formula. It is computationally expensive, especially for long sequences.
 Overlap-Save Method: This method divides the input signal into smaller blocks,
computes the convolution of each block with the impulse response, and overlaps and
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

adds the results.


 Overlap-Add Method: This method is similar to the overlap-save method, but
instead of overlapping the output blocks, they are added.
 Fast Convolution: This method uses the Fast Fourier Transform (FFT) to efficiently
compute the convolution. By converting the convolution operation into multiplication
in the frequency domain, it significantly reduces computational complexity.
5. Write the Expressions for Convolution Sum of Causal and Non-Causal Systems
Excited by Causal and Non-Causal Inputs.
 Causal System, Causal Input:
y[n] = Σ(x[k] * h[n-k]), k = 0 to n
 Causal System, Non-Causal Input:
y[n] = Σ(x[k] * h[n-k]), k = -∞ to n
 Non-Causal System, Causal Input:
y[n] = Σ(x[k] * h[n-k]), k = 0 to ∞
 Non-Causal System, Non-Causal Input:
y[n] = Σ(x[k] * h[n-k]), k = -∞ to ∞

RESULT
Thus,the Linear convolution of two finite length sequences was simulated using FFT.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment Computation of Circular Convolution using FAST FOURIER


no:7 TRANSFORM (FFT)

Aim
To write a MATLAB program to compute the Circular convolution of two finite
length sequences using FFT

Mapping with theory


Circular convolution
Circular convolution is a fundamental operation in Digital Signal Processing (DSP) used
to process finite-length sequences, especially when dealing with periodic signals or
systems. Circular convolution is a mathematical operation performed on two finite-
length sequences to obtain a third sequence. It differs from linear convolution in that it
assumes the sequences are periodic and wraps around at the boundaries.
The circular convolution of two N-point periodic sequences x(n) and y(n) are the N-
point sequence a(m) = x(n)* y(n),
defined by
n=0
a(m) = x(m)* y(m)= x(n) y(m-n); m=0,1, 2 , ..N-1
N-1
FFT
The Fast Fourier Transform (FFT) is an efficient algorithm used to compute the Discrete
Fourier Transform (DFT) and its inverse. It significantly reduces the computational
complexity of calculating the DFT, making it practical for real-world applications.
N-1
X[k] = ∑ x[n] * e^(-2πikn/N)
n=0
X[k]: Represents the kth frequency component in the frequency domain.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

x[n]: Represents the nth sample of the sequence in the time domain.
N: Represents the length of the sequence.
k: Is an index ranging from 0 to N-1.

Procedure

1. Launch MATLAB: Double-click the MATLAB icon or search for it in the


application launcher.
2. Create/Open Script:
1. To create a new script: Go to the "Home" tab and click "New Script."
2. To open an existing script: Go to the "Home" tab, click "Open," and
select the script.
3. Write/Paste Code: In the MATLAB Editor, write or paste your MATLAB code.
4. Save Script: Save the script with a meaningful name and ".m" extension (e.g.,
"my_script.m").
5. Run Script:
1. Click the "Run" button in the Editor toolbar, or
2. Type the script name (without ".m") in the Command Window and
press Enter.
6. View Output: MATLAB will display the results in the Command Window or
graphical output in figure windows.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Pseudocode for Circular Convolution Program


1. Start
2. Prompt the user to input the first sequence a.
3. Prompt the user to input the second sequence b.
4. Determine the lengths:
o Let M1 be the length of sequence a.
o Let M2 be the length of sequence b.
5. Compute the length of the output sequence:
o Let M = max(M1, M2).
6. Zero-pad both sequences to length M:
o Extend a by appending zeros to make its length equal to M.
o Extend b by appending zeros to make its length equal to M.
7. Perform the FFT of both sequences:
o X = FFT(a)
o Y = FFT(b)
8. Multiply the FFT results element-wise:
o Z = X .* Y
9. Perform the IFFT to get the circular convolution result:
o C = IFFT(Z)
10. Display the output sequence C.
11. Plot the sequences:
o Plot a against its indices N1 = 0:M1-1 (Input Sequence 1).
o Plot b against its indices N2 = 0:M2-1 (Input Sequence 2).
o Plot C against its indices N = 0:M-1 (Output Sequence).
12. End
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Program

% Illustration of circular convolution


a = input('Enter the first sequence: ');
b = input('Enter the second sequence: ');

% Determine lengths of the sequences


M1 = length(a);
M2 = length(b);
M = max(M1, M2); % Length of the output sequence

% Zero-padding to make both sequences of length M


a = [a, zeros(1, M - M1)];
b = [b, zeros(1, M - M2)];

% Perform FFT of both sequences


X = fft(a);
Y = fft(b);

% Circular convolution using IFFT


C = ifft(X .* Y);

% Display the output sequence


disp('Output sequence:');
disp(C);

% Time indices
N1 = 0:M1-1;
N2 = 0:M2-1;
N = 0:M-1;

% Plot input and output sequences


figure;
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

% Input sequence 1
subplot(2, 2, 1);
stem(N1, a(1:M1), 'filled');
xlabel('n');
ylabel('x(n)');
title('Input Sequence 1');

% Input sequence 2
subplot(2, 2, 2);
stem(N2, b(1:M2), 'filled');
xlabel('n');
ylabel('x(n)');
title('Input Sequence 2');

% Output sequence
subplot(2, 2, 3);
stem(N, C, 'filled');
xlabel('Time Index n');
ylabel('Amplitude');
title('Output Sequence (Circular Convolution)');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

INDUSTRIAL APPLICATIONS
In wireless communication systems, circular convolution using FFT plays a crucial
role in channel equalization, synchronization, and symbol detection.
By convolving transmitted signals with channel impulse responses or modulation
waveforms, FFT-based circular convolution helps compensate for channel distortion,
multipath fading, and interference, thereby improving data transmission reliability
and spectral efficiency.
In industries related to audio and music production, circular convolution using FFT
is utilized for tasks such as reverberation effects, echo generation, and convolution
reverb processing.

VIVA Questions and Answers: Circular Convolution


1. What is the purpose of circular convolution?
o Circular convolution is used to analyze periodic signals in systems where
inputs and outputs are periodic. It is particularly useful in digital signal
processing (DSP) to simplify the implementation of filtering in the frequency
domain.
2. What are the real-time applications of circular convolution?
o Applications include:
 Fast filtering in DSP, especially in audio processing.
 Fast Fourier Transform (FFT)-based convolution for efficient
computation.
 Image processing for periodic patterns.
 Communication systems for analyzing periodic signals in channels.
3. What is circular convolution also called?
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

o Circular convolution is also called cyclic convolution because it assumes


periodic extension of the input sequences.
4. What is sectioned convolution? Why is it performed?
o Sectioned convolution divides a long input sequence into smaller sections to
perform convolution efficiently. There are two main techniques:
 Overlap-Add Method
 Overlap-Save Method
o It is performed to handle long input signals that cannot be processed in a
single step due to memory or computational constraints.
5. How will you perform linear convolution via circular convolution?
o Linear convolution can be performed using circular convolution by zero-
padding both sequences to a length equal to at least (length of sequence 1 +
length of sequence 2 - 1). This ensures the circular wrap-around does not
interfere, and the result is equivalent to linear convolution.

RESULT
Thus, the Circular convolution of two finite length sequences was simulated using
FFT.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment Magnitude and Phase plot for FAST FOURIER TRANSFORM


no:8 (FFT)

Aim
To write a MATLAB program to obtain the magnitude and phase plot for FFT.

Mapping with Theory


FFT (Fast Fourier Transform)
The Fast Fourier Transform (FFT) is an efficient algorithm used to compute the
Discrete Fourier Transform (DFT) and its inverse. It significantly reduces the
computational complexity of calculating the DFT, making it practical for real-world
applications.
N-1
X[k] = ∑ x[n] * e^(-2πikn/N)
n=0
X[k]: Represents the kth frequency component in the frequency domain.
x[n]: Represents the nth sample of the sequence in the time domain.
N: Represents the length of the sequence.
k: Is an index ranging from 0 to N-1.
e: Is the base of the natural logarithm.
i: Is the imaginary unit.

Procedure

1. Launch MATLAB: Double-click the MATLAB icon or search for it in the


application launcher.
2. Create/Open Script:
1. To create a new script: Go to the "Home" tab and click "New Script."
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

2. To open an existing script: Go to the "Home" tab, click "Open," and


select the script.
3. Write/Paste Code: In the MATLAB Editor, write or paste your MATLAB code.
4. Save Script: Save the script with a meaningful name and ".m" extension (e.g.,
"my_script.m").
5. Run Script:
1. Click the "Run" button in the Editor toolbar, or
2. Type the script name (without ".m") in the Command Window and
press Enter.
6. View Output: MATLAB will display the results in the Command Window or
graphical output in figure windows.

Pseudocode
START
1. INPUT the length of the sequence, N.
2. INPUT the length of the DFT/IDFT, M.
3. INPUT the sequence, u.
4. IF computing DFT:
U = fft(u, M) // Perform Discrete Fourier Transform
ELSE IF computing IDFT:
U = ifft(u, M) // Perform Inverse Discrete Fourier Transform
END IF
5. DEFINE time index: t = 0 to N-1
6. DEFINE frequency index: k = 0 to M-1
7. PLOT:
- Subplot 1: Original sequence u
Title: "Original Time Domain Sequence"
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

X-axis: "Time Index"


Y-axis: "Amplitude"
- Subplot 2: Magnitude of U
Title: "Magnitude of DFT/IDFT Samples"
X-axis: "Frequency Index k"
Y-axis: "Magnitude"

- Subplot 3: Phase of U
Title: "Phase of DFT/IDFT Samples"
X-axis: "Frequency Index k"
Y-axis: "Phase"
8. DISPLAY:
- Magnitude of U: abs(U)
- Phase of U: angle(U)
- Transformation result: U
END

Key Differences:
 Transformation Function:
o For DFT: Use fft(u, M).
o For IDFT: Use ifft(u, M).
 Interpretation of Results:
o For DFT: The output represents the frequency-domain representation of the
sequence.
o For IDFT: The output represents the reconstructed time-domain sequence.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Program
FFT
% Illustration of DFT Computation
% Prompt the user for input values
N = input('Enter the length of the sequence: ');
M = input('Enter the length of the DFT: ');

% Input the sequence


u = input('Enter the sequence: ');

% Compute the DFT using FFT


U = fft(u, M);

% Define time index for the input sequence


t = 0:N-1;

% Plot the original time-domain sequence


subplot(3, 1, 1);
stem(t, u, 'filled');
title('Original Time Domain Sequence');
xlabel('Time Index');
ylabel('Amplitude');

% Define frequency index


k = 0:M-1;

% Plot the magnitude of the DFT samples


subplot(3, 1, 2);
stem(k, abs(U), 'filled');
title('Magnitude of the DFT Samples');
xlabel('Frequency Index k');
ylabel('Magnitude');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

% Plot the phase of the DFT samples


subplot(3, 1, 3);
stem(k, angle(U), 'filled');
title('Phase of the DFT Samples');
xlabel('Frequency Index k');
ylabel('Phase');

% Display the results in the command window


disp('Magnitude of DFT:');
disp(abs(U));
disp('Phase of DFT:');
disp(angle(U));
disp('DFT Values:');
disp(U);

IFFT
% Illustration of IDFT computation
% Prompt user inputs
N = input('Enter the length of the sequence: ');
M = input('Enter the length of the DFT: ');
u = input('Enter the sequence: ');

% Compute the Inverse Discrete Fourier Transform


U = ifft(u, M);
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

% Define time and frequency indices


timeIndex = 0:N-1; % Time index for the input sequence
freqIndex = 0:M-1; % Frequency index for the DFT/IDFT results

% Plot the original sequence


subplot(3, 1, 1);
stem(timeIndex, u, 'filled');
title('Original Time Domain Sequence');
xlabel('Time Index');
ylabel('Amplitude');

% Plot the magnitude of the IDFT samples


subplot(3, 1, 2);
stem(freqIndex, abs(U), 'filled');
title('Magnitude of IDFT Samples');
xlabel('Frequency Index (k)');
ylabel('Magnitude');

% Plot the phase of the IDFT samples


subplot(3, 1, 3);
stem(freqIndex, angle(U), 'filled');
title('Phase of IDFT Samples');
xlabel('Frequency Index (k)');
ylabel('Phase');

% Display results in the console


disp('Magnitude of IDFT:');
disp(abs(U));
disp('Phase of IDFT:');
disp(angle(U));
disp('IDFT Result:');
disp(U);
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Output
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

INDUSTRIAL APPLICATIONS
FFT is employed for efficient implementation of digital filters, including low-pass,
high pass, band-pass, and notch filters
Magnitude plots help in designing filters by identifying the frequency components to
be attenuated or preserved.
In communication systems, phase plots aid in equalizing channel distortions by
compensating for phase shifts introduced during transmission.

VIVA Questions and Answers

1. What is phase and magnitude of FFT?


 Magnitude: Represents the amplitude of the frequency components present in the
signal. It indicates the strength of each frequency in the signal.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

 Phase: Represents the angular displacement of the frequency components relative


to a reference point. It shows the time shift of the frequencies.

2. What does an FFT plot show?


An FFT (Fast Fourier Transform) plot shows the frequency domain representation
of a time-domain signal. It typically consists of:
 Magnitude plot: Indicates the amplitude of the frequency components.
 Phase plot: Shows the phase shift of the frequency components.
The plot helps in analyzing the spectral composition, including identifying
dominant frequencies and their amplitudes in the signal.

3. What is FFT phase factor?


The FFT phase factor, often denoted as W_N^k, is a complex exponential term
used in the FFT computation:
W_N^k=e−2πikNW_N^k
 W_N^k introduces phase shifts during the transformation.
 It plays a crucial role in converting the time-domain signal into the frequency
domain by accounting for the periodicity and symmetry of the signal.

4. What is FFT size?


The FFT size refers to the number of points used in the FFT computation. It
determines the resolution of the frequency domain analysis:
 Larger FFT size provides better frequency resolution but requires more
computation.
 Typical FFT sizes are powers of 2 (e.g., 256, 512, 1024), as it optimizes
computational efficiency.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

5. How do you analyze an FFT plot?


To analyze an FFT plot:
1. Inspect the Magnitude Plot:
o Identify the dominant frequency peaks.
o Analyze the amplitudes of different frequency components to determine
their contributions to the signal.
2. Check the Phase Plot:
o Use the phase information to understand time shifts or delays of frequency
components.
3. Frequency Range:
o Consider the frequency range and ensure it matches the signal's expected
components.
o Look for aliasing or spurious peaks if the range is incorrect.
4. Compare Input and Output:
o Verify if the FFT results align with the expected signal characteristics (e.g.,
periodicity and dominant frequencies).
5. Noise Analysis:
o Assess the noise floor and check for unwanted frequencies or distortions.

RESULT
Thus, the magnitude and phase plot for FFT was simulated using MATLAB
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment Verification of Sampling Theorem


no:9

Aim
To write a MATLAB program to verify sampling theorem.

Mapping with Theory


Sampling Theorem
The Sampling Theorem, also known as the Nyquist-Shannon Sampling Theorem, is
a fundamental concept in signal processing and communication theory.
It provides guidelines for accurately reconstructing a continuous-time signal from its
sampled version.
Sampling involves converting a continuous-time signal into a discrete-time signal by
measuring its amplitude at uniformly spaced time instants.
Nyquist Sampling Theorem:
The Nyquist Sampling Theorem states that to accurately reconstruct a continuous-time
signal from its samples, the sampling rate (fs) must be at least twice the maximum
frequency (fmax)present in the signal.
Mathematically, the Nyquist criterion can be expressed as:
fs>=2.fmax

Procedure

1. Launch MATLAB: Double-click the MATLAB icon or search for it in the


application launcher.
2. Create/Open Script:
1. To create a new script: Go to the "Home" tab and click "New Script."
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

2. To open an existing script: Go to the "Home" tab, click "Open," and


select the script.
3. Write/Paste Code: In the MATLAB Editor, write or paste your MATLAB code.
4. Save Script: Save the script with a meaningful name and ".m" extension (e.g.,
"my_script.m").
5. Run Script:
1. Click the "Run" button in the Editor toolbar, or
2. Type the script name (without ".m") in the Command Window and
press Enter.
6. View Output: MATLAB will display the results in the Command Window or
graphical output in figure windows.

Pseudocode
BEGIN
% Close all figures and clear workspace
CLOSE all figures
CLEAR workspace

% Input parameters
PRINT "Enter the sampling frequency: "
fs = USER input for sampling frequency
T = 1 / fs % Sampling period

PRINT "Enter the first input frequency: "


f1 = USER input for first frequency

PRINT "Enter the second input frequency: "


f2 = USER input for second frequency

PRINT "Enter the third input frequency: "


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

f3 = USER input for third frequency


L = 1000 % Signal length
t = (0 to L-1) * T % Time vector

% Generate signals
x1 = COSINE wave with frequency f1 at time vector t
x2 = COSINE wave with frequency f2 at time vector t
x3 = COSINE wave with frequency f3 at time vector t

% Plot individual signals


CREATE subplot 4x1 grid

% Plot x1
PLOT first 100 samples of x1
TITLE "Signal with Frequency f1"
LABEL x-axis as "Sample Index"
LABEL y-axis as "Amplitude"

% Plot x2
PLOT first 100 samples of x2
TITLE "Signal with Frequency f2"
LABEL x-axis as "Sample Index"
LABEL y-axis as "Amplitude"

% Plot x3
PLOT first 100 samples of x3
TITLE "Signal with Frequency f3"
LABEL x-axis as "Sample Index"
LABEL y-axis as "Amplitude"

% Combine the signals


x = x1 + x2 + x3 % Combined signal
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

% Compute FFT
nfft = NEXT power of 2 greater than or equal to length of x
s = FFT of x with length nfft % Compute FFT
f = FREQUENCY vector from 0 to fs/2 with nfft/2 + 1 points

% Plot the magnitude spectrum


PLOT magnitude of s for frequencies f (from 0 to fs/2)
TITLE "Magnitude Spectrum of Combined Signal"
LABEL x-axis as "Frequency (Hz)"
LABEL y-axis as "Magnitude"

END

Program

% Illustration of FFT Analysis with Multiple Frequencies


close all; % Close all figures
clear; % Clear workspace

% Input Parameters
fs = input('Enter the sampling frequency: '); % Sampling frequency
T = 1 / fs; % Sampling period
f1 = input('Enter the first input frequency: '); % Frequency 1
f2 = input('Enter the second input frequency: '); % Frequency 2
f3 = input('Enter the third input frequency: '); % Frequency 3
L = 1000; % Signal length
t = (0:L-1) * T; % Time vector

% Generate Signals
x1 = cos(2 * pi * f1 * t); % Signal with frequency f1
x2 = cos(2 * pi * f2 * t); % Signal with frequency f2
x3 = cos(2 * pi * f3 * t); % Signal with frequency f3
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

% Plot Individual Signals


subplot(4, 1, 1);
plot(x1(1:100)); % Plot first 100 samples of x1
title('Signal with Frequency f1');
xlabel('Sample Index');
ylabel('Amplitude');

subplot(4, 1, 2);
plot(x2(1:100)); % Plot first 100 samples of x2
title('Signal with Frequency f2');
xlabel('Sample Index');
ylabel('Amplitude');

subplot(4, 1, 3);
plot(x3(1:100)); % Plot first 100 samples of x3
title('Signal with Frequency f3');
xlabel('Sample Index');
ylabel('Amplitude');

% Combine Signals
x = x1 + x2 + x3; % Combined signal

% Compute FFT
nfft = 2^nextpow2(length(x)); % Next power of 2 for FFT
s = fft(x, nfft); % FFT computation
f = fs / 2 * linspace(0, 1, (nfft / 2) + 1); % Frequency vector

% Plot Magnitude Spectrum


subplot(4, 1, 4);
plot(f, abs(s(1:(nfft / 2) + 1))); % Plot single-sided magnitude spectrum
title('Magnitude Spectrum of Combined Signal');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Output

INDUSTRIAL APPLICATIONS
In telecommunications and multimedia applications, the Sampling Theorem
ensures accurate digitization and processing of audio and speech signals for tasks
such as speech recognition, compression, and enhancement.
Sampling is crucial for digitizing and processing images and videos in
applications like digital cameras, video surveillance, and medical imaging
systems.
The Sampling Theorem guides the design and operation of RF communication
systems by ensuring accurate sampling of baseband and modulated signals,
enabling reliable transmission and reception of data in wireless networks.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

VIVA Questions and Answers


1. What is the objective of the sampling theorem?
The objective of the sampling theorem is to ensure that a continuous-time signal can
be accurately reconstructed from its discrete samples, provided the sampling
frequency is at least twice the maximum frequency of the signal (Nyquist rate). This
avoids information loss during the conversion from continuous to discrete form.

2. Why is sampling needed?


Sampling is needed to convert a continuous-time signal into a discrete-time signal so
that it can be processed, stored, and transmitted using digital systems. This is
essential for digital communication, digital signal processing, and applications like
audio, video processing, and telecommunications.

3. What is sampling and its advantages?


Sampling is the process of converting a continuous-time signal into a sequence of
discrete-time values by measuring the signal at regular intervals (sampling period).
Advantages:
 Enables digital processing of signals.
 Reduces the amount of data compared to continuous signals.
 Allows easy storage, transmission, and manipulation using digital systems.
 Offers immunity to noise compared to analog signals.

4. What does sampling mean? Name the various sampling techniques.


Sampling means selecting discrete points from a continuous signal to represent it in a
digital form.
Sampling Techniques:
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

1. Ideal Sampling: An impulse train is used to sample the signal.


2. Natural Sampling: The signal is multiplied with a train of rectangular pulses.
3. Flat-top Sampling: The sampled signal maintains a constant amplitude during
the sampling interval.

5. Explain about aliasing effect.


Aliasing is a distortion that occurs when a signal is sampled at a rate less than the
Nyquist rate (less than twice its highest frequency). Higher frequency components in
the original signal get folded into lower frequencies, leading to a misrepresentation of
the signal in the discrete domain.
Prevention of Aliasing:
 Use a sampling frequency greater than twice the maximum frequency of the
signal.
 Apply an anti-aliasing low-pass filter before sampling to remove high-
frequency components.

RESULT
Thus, the Sampling theorem was verified using MATLAB and waveforms are plotted
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Experiment
Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

no:10
Design of INFINITE IMPULSE RESPONSE (IIR) FILTER

Aim
To write various MATLAB programs to implement different Infinite Impulse
response (IIR) filters
Mapping with Theory
i)BUTTERWORTH FILTER
The Butterworth filter is a type of signal processing filter designed to have a
frequency response as flat as possible in the passband while rolling off smoothly into
the stopband
The Butterworth filter is a type of maximally flat filter, meaning that it provides
the maximum possible flatness in the passband while meeting the desired cutoff
frequency and attenuation requirements in the stopband.
Unlike other filter types such as Chebyshev or elliptic filters, the Butterworth filter
does not have ripples in the passband or stopband.

Where
H(s) is the transfer function.
s is the Laplace variable.
ω_c is the cutoff frequency.
N is the order of the filter
ii) CHEBYSHEV TYPE 1 FILTER
Chebyshev Type I filters are a type of analog or digital filter characterized by
allowing ripples in the passband while providing a steeper roll-off in the transition
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

between the passband and the stopband


The key parameter that governs the behavior of Chebyshev Type I filters is the
ripple factor or passband ripple, denoted by ε.
This parameter controls the amount of ripple allowed in the passband, and higher
values of ε result in greater passband ripple but steeper roll-off in the transition
region.

Where:
H(s) is the transfer function.
s is the Laplace variable.
ω_c is the cutoff frequency.
T_N(x) is the Chebyshev polynomial of order N.
ε is the ripple factor, controlling the amount of passband ripple.
iii) CHEBYSHEV TYPE 2 FILTER
Chebyshev Type II filters are designed to achieve a sharper transition between the
passband and stopband by allowing controlled ripples in the stopband while
maintaining a flat response in the passband.
Unlike Chebyshev Type I filters, which allow ripples in the passband, Chebyshev
Type II filters exhibit ripples in the stopband to achieve the desired trade-off between
the sharpness of the transition region and the stopband attenuation.
The key parameter that governs the behavior of Chebyshev Type II filters is the
ripple factor or stopband ripple, denoted by ε.
This parameter controls the amount of ripple allowed in the stopband, and higher
values of ε result in greater stopband ripple but steeper roll-off in the transition
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

region.
Where

H(s) is the transfer function.


s is the Laplace variable.
ω_c is the cutoff frequency.
U_N(x) is the Chebyshev polynomial of the second kind of order N.
ε is the ripple factor, controlling the amount of stopband ripple.
In the above formula, U_N(x) is a polynomial defined recursively as follows:
U_0(x) = 1
U_1(x) = 2 * x
U_{n+1}(x) = 2 * x * U_n(x) - U_{n-1}(x)

Procedure

1. Launch MATLAB: Double-click the MATLAB icon or search for it in the


application launcher.
2. Create/Open Script:
1. To create a new script: Go to the "Home" tab and click "New Script."
2. To open an existing script: Go to the "Home" tab, click "Open," and
select the script.
3. Write/Paste Code: In the MATLAB Editor, write or paste your MATLAB code.
4. Save Script: Save the script with a meaningful name and ".m" extension (e.g.,
"my_script.m").
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

5. Run Script:
1. Click the "Run" button in the Editor toolbar, or
2. Type the script name (without ".m") in the Command Window and
press Enter.
6. View Output: MATLAB will display the results in the Command Window or
graphical output in figure windows.

Pseudocode
i) BUTTERWORTH FILTER:
a) Low pass filter:
1. Close all open figures and clear workspace:
close();
clear();
2. Input parameters:
2.1. Prompt user to enter the sampling frequency (Fs)
2.2. Prompt user to enter the passband frequency (wp)
2.3. Prompt user to enter the stopband frequency (ws)
2.4. Prompt user to enter the passband attenuation (ap)
2.5. Prompt user to enter the stopband attenuation (as)
2.6. Calculate the normalized passband frequency (w1) as (2 * wp) / Fs
2.7. Calculate the normalized stopband frequency (w2) as (2 * ws) / Fs
3. Design the Butterworth filter:
3.1. Determine the filter order (n) and normalized cutoff frequency (wn)
using the buttord function:
n, wn = buttord(w1, w2, ap, as)
3.2. Display the filter order (n) and normalized cutoff frequency (wn).
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

4. Generate the filter coefficients:


4.1. Use the butter function to design the Butterworth filter:
b, a = butter(n, wn)
5. Plot the frequency response:
5.1. Use the frequency function to plot the frequency response of the
designed filter: freqz(b, a, [], Fs)
b) High pass filter:
1. Close all open figures and clear workspace:
close();
clear();
2. Input parameters:
2.1. Prompt user to enter the sampling frequency (Fs)
2.2. Prompt user to enter the passband frequency (wp)
2.3. Prompt user to enter the stopband frequency (ws)
2.4. Prompt user to enter the passband attenuation (ap)
2.5. Prompt user to enter the stopband attenuation (as)
2.6. Calculate the normalized passband frequency (w1) as (2 * wp) / Fs
2.7. Calculate the normalized stopband frequency (w2) as (2 * ws) / Fs
3. Design the Butterworth highpass filter:
3.1. Determine the filter order (n) and normalized cutoff frequency (wn) using
the buttord function:
n, wn = buttord(w1, w2, ap, as)
3.2. Display the filter order (n) and normalized cutoff frequency (wn).
4. Generate the filter coefficients:
4.1. Use the butter function to design the Butterworth highpass filter:
b, a = butter(n, wn, 'high')
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

5. Plot the frequency response:


5.1. Use the freqz function to plot the frequency response of the designed
highpass filter:
freqz(b, a, [], Fs)
5.2. Set the title of the plot to 'BUTTERWORTH HIGHPASS FILTER'
c) Band pass:
1. Close all open figures and clear workspace:
close();
clear();
2. Input parameters:
2.1. Prompt user to enter the sampling frequency (Fs)
2.2. Prompt user to enter the passband frequency (wp)
2.3. Prompt user to enter the stopband frequency (ws)
2.4. Prompt user to enter the passband attenuation (ap)
2.5. Prompt user to enter the stopband attenuation (as)
2.6. Calculate the normalized passband frequency (w1) as (2 * wp) / Fs
2.7. Calculate the normalized stopband frequency (w2) as (2 * ws) / Fs
3. Design the Butterworth bandpass filter:
3.1. Determine the filter order (n) and normalized cutoff frequency (wn) using
the buttord function:
n, wn = buttord(w1, w2, ap, as)
3.2. Display the filter order (n) and normalized cutoff frequency (wn).
4. Generate the filter coefficients:
4.1. Use the butter function to design the Butterworth bandpass filter:
b, a = butter(n, wn)
5. Plot the frequency response:
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

5.1. Use the freqz function to plot the frequency response of the designed
filter: freqz(b, a, [], Fs)
5.2. Set the title of the plot to 'BUTTERWORTH BANDPASS FILTER'
d) Band stop filter:
1. Close all open figures and clear workspace:
close();
clear();
2. Input parameters:
2.1. Prompt user to enter the sampling frequency (Fs)
2.2. Prompt user to enter the passband frequency (wp)
2.3. Prompt user to enter the stopband frequency (ws)
2.4. Prompt user to enter the passband attenuation (ap)
2.5. Prompt user to enter the stopband attenuation (as)
2.6. Calculate the normalized passband frequency (w1) as (2 * wp) / Fs
2.7. Calculate the normalized stopband frequency (w2) as (2 * ws) / Fs
3. Design the Butterworth bandstop filter:
3.1. Determine the filter order (n) and normalized cutoff frequency (wn) using
the buttord function:
n, wn = buttord(w1, w2, ap, as)
3.2. Display the filter order (n) and normalized cutoff frequency (wn).
4. Generate the filter coefficients:
4.1. Use the butter function to design the Butterworth bandstop filter:
b, a = butter(n, wn, 'stop')
5. Plot the frequency response:
5.1. Use the freqz function to plot the frequency response of the designed
filter: freqz(b, a, [], Fs)
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

5.2. Set the title of the plot to 'BUTTERWORTH BANDSTOP FILTER'


ii) CHEBYSHEV TYPE 1 FILTER:
The above same steps can be followed, just by changing the function name
cheb1ord(),
cheby1().
iii) CHEBYSHEV TYPE 2 FILTER:
The above same steps can be followed, just by changing the function name
cheb2ord(),
cheby2().

Program
i) BUTTERWORTH FILTER:
a) Low pass filter
close();
clear();
fs=input('Enter the frequency Fs:');
wp=input('Enter the pass band freq:');
ws=input('Enter the stop band freq:');
ap=input('Enter the pass band attenaution:');
as=input('Enter the stop band attenaution:');
w1=(2*wp)/fs;
w2=(2*ws)/fs;
[n,wn]=buttord(w1,w2,ap,as);
disp('order');
disp(n);
disp('Normalized cut-off freq');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

disp(wn);
[b,a]=butter(n,wn);
freqz(b,a,[],fs);

b)High pass filter


close();
clear();
fs=input('Enter the frequency Fs:');
wp=input('Enter the pass band freq:');
ws=input('Enter the stop band freq:');
ap=input('Enter the pass band attenaution:');
as=input('Enter the stop band attenaution:');
w1=(2*wp)/fs;
w2=(2*ws)/fs;
[n,wn]=buttord(w1,w2,ap,as);
disp('order');
disp(n);
disp('Normalized cut-off freq');
disp(wn);
[b,a]=butter(n,wn,'high');
freqz(b,a,[],fs);
title('BUTTERWORTH HIGHPASS FILTER');
c)Band pass filter
close();
clear();
fs=input('Enter the frequency Fs:');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

wp=input('Enter the pass band freq:');


ws=input('Enter the stop band freq:');
ap=input('Enter the pass band attenaution:');
as=input('Enter the stop band attenaution:');
w1=(2*wp)/fs;
w2=(2*ws)/fs;
[n,wn]=buttord(w1,w2,ap,as);
disp('order');
disp(n);
disp('Normalized cut-off freq');
disp(wn);
[b,a]=butter(n,wn);
freqz(b,a,[],fs);
title('BUTTERWORTH BANDPASS FILTER')
d) Band stop filter
close();
clear();
fs=input('Enter the frequency Fs:');
wp=input('Enter the pass band freq:');
ws=input('Enter the stop band freq:');
ap=input('Enter the pass band attenaution:');
as=input('Enter the stop band attenaution:');
w1=(2*wp)/fs;
w2=(2*ws)/fs;
[n,wn]=buttord(w1,w2,ap,as);
disp('order');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

disp(n);
disp('Normalized cut-off freq');
disp(wn);
[b,a]=butter(n,wn,'stop');
freqz(b,a,[],fs);
title('BUTTERWORTH BANDSTOP FILTER');

ii) CHEBYSHEV TYPE 1 FILTER:


a) Low pass filter
close();
clear();
fs=input('Enter the frequency Fs:');
wp=input('Enter the pass band freq:');
ws=input('Enter the stop band freq:');
ap=input('Enter the pass band attenaution:');
as=input('Enter the stop band attenaution:');
w1=(2*wp)/fs;
w2=(2*ws)/fs;
[n,wn]=cheb1ord(w1,w2,ap,as);
disp('order');
disp(n);
disp('Normalized cut-off freq');
disp(wn);
[b,a]=cheby1(n,ap,wn);
freqz(b,a,[],fs);
title('CHEBYSHEV ORDER 1 FILTER');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

b)High pass filter


close();
clear();
fs=input('Enter the frequency Fs:');
wp=input('Enter the pass band freq:');
ws=input('Enter the stop band freq:');
ap=input('Enter the pass band attenaution:');
as=input('Enter the stop band attenaution:');
w1=(2*wp)/fs;
w2=(2*ws)/fs;
[n,wn]=cheb1ord(w1,w2,ap,as);
disp('order');
disp(n);
disp('Normalized cut-off freq');
disp(wn);
[b,a]=cheby1(n,ap,wn,'high');
freqz(b,a,[],fs);
title('CHEBYSHEV ORDER 1 HIGHPASS FILTER');

c)Band pass filter


close();
clear();
fs=input('Enter the frequency Fs:');
wp=input('Enter the pass band freq:');
ws=input('Enter the stop band freq:');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

ap=input('Enter the pass band attenaution:');


as=input('Enter the stop band attenaution:');
w1=(2*wp)/fs;
w2=(2*ws)/fs;
[n,wn]=cheb1ord(w1,w2,ap,as);
disp('order');
disp(n);
disp('Normalized cut-off freq');
disp(wn);
[b,a]=cheby1(n,ap,wn);
freqz(b,a,[],fs);
title('CHEBYSHEV ORDER 1 BANDPASS FILTER');

d)Band stop filter


close();
clear();
fs=input('Enter the frequency Fs:');
wp=input('Enter the pass band freq:');
ws=input('Enter the stop band freq:');
ap=input('Enter the pass band attenaution:');
as=input('Enter the stop band attenaution:');
w1=(2*wp)/fs;
w2=(2*ws)/fs;
[n,wn]=cheb1ord(w1,w2,ap,as);
disp('order');
disp(n);
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

disp('Normalized cut-off freq');


disp(wn);
[b,a]=cheby1(n,ap,wn,'stop');
freqz(b,a,[],fs);
title('CHEBYSHEV ORDER 1 BANDSTOP FILTER');

ii)CHEBYSHEV TYPE 2 FILTER:


a)Low pass filter
close();
clear();
fs=input('Enter the frequency Fs:');

wp=input('Enter the pass band freq:');


ws=input('Enter the stop band freq:');
ap=input('Enter the pass band attenaution:');
as=input('Enter the stop band attenaution:');
w1=(2*wp)/fs;
w2=(2*ws)/fs;
[n,wn]=cheb2ord(w1,w2,ap,as);
disp('order');
disp(n);
disp('Normalized cut-off freq');
disp(wn);
[b,a]=cheby2(n,as,wn);
freqz(b,a,[],fs);
title('CHEBYSHEV ORDER 2 LOWPASS FILTER');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

b)High pass filter


close();
clear();
fs=input('Enter the frequency Fs:');
wp=input('Enter the pass band freq:');
ws=input('Enter the stop band freq:');
ap=input('Enter the pass band attenaution:');
as=input('Enter the stop band attenaution:');
w1=(2*wp)/fs;
w2=(2*ws)/fs;
[n,wn]=cheb2ord(w1,w2,ap,as);
disp('order');
disp(n);
disp('Normalized cut-off freq');
disp(wn);
[b,a]=cheby2(n,as,wn,'high');
freqz(b,a,[],fs);
title('CHEBYSHEV ORDER 2 HIGHPASS FILTER');

c)Band pass filter


close();
clear();
fs=input('Enter the frequency Fs:');
wp=input('Enter the pass band freq:');
ws=input('Enter the stop band freq:');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

ap=input('Enter the pass band attenaution:');


as=input('Enter the stop band attenaution:');
w1=(2*wp)/fs;
w2=(2*ws)/fs;
[n,wn]=cheb2ord(w1,w2,ap,as);
disp('order');
disp(n);
disp('Normalized cut-off freq');
disp(wn);
[b,a]=cheby2(n,as,wn);
freqz(b,a,[],fs);
title('CHEBYSHEV ORDER 2 BANDPASS FILTER');
d)Band stop filter
close();
clear();
fs=input('Enter the frequency Fs:');
wp=input('Enter the pass band freq:');
ws=input('Enter the stop band freq:');
ap=input('Enter the pass band attenaution:');
as=input('Enter the stop band attenaution:');
w1=(2*wp)/fs;
w2=(2*ws)/fs;
[n,wn]=cheb2ord(w1,w2,ap,as);
disp('order');
disp(n);
disp('Normalized cut-off freq');
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

disp(wn);
[b,a]=cheby2(n,as,wn,'stop');
freqz(b,a,[],fs);
title('CHEBYSHEV ORDER 2 BANDSTOP FILTER');

Output

BUTTERWORTH FILTER
LPF:
Enter the frequency Fs:1000
Enter the pass band freq:40
Enter the stop band freq:150
Enter the pass band attenaution:3
Enter the stop band attenaution:60
Order 5
Normalized cut-off freq 0.0810

HPF:
Enter the frequency Fs:1000
Enter the pass band freq:40
Enter the stop band freq:150
Enter the pass band attenaution:3
Enter the stop band attenaution:60
Order 5
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Normalized cut-off freq 0.0810

BPF:
Enter the frequency Fs:1000
Enter the pass band freq:[60 200]
Enter the stop band freq:[50 250]
Enter the pass band attenaution:3
Enter the stop band attenaution:40
Order 16
Normalized cut-off freq 0.1198 0.4005
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

BSF:
Enter the frequency Fs:1000
Enter the pass band freq:[60 200]
Enter the stop band freq:[50 250]
Enter the pass band attenaution:3
Enter the stop band attenaution:40
Order 16
Normalized cut-off freq 0.1198 0.4005
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

CHEBYSHEV TYPE 1 FILTER

LPF:
Enter the frequency Fs:1000
Enter the pass band freq:40
Enter the stop band freq:150
Enter the pass band attenaution:3
Enter the stop band attenaution:60
Order 5
Normalized cut-off freq 0.0810

HPF:
Enter the frequency Fs:1000
Enter the pass band freq:40
Enter the stop band freq:150
Enter the pass band attenaution:3
Enter the stop band attenaution:60
order 5
Normalized cut-off freq 0.0810
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

BPF:
Enter the frequency Fs:1000
Enter the pass band freq:[60 200]
Enter the stop band freq:[50 250]
Enter the pass band attenaution:3
Enter the stop band attenaution:40
Order 16
Normalized cut-off freq 0.1198 0.4005

BSF:
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Enter the frequency Fs:1000


Enter the pass band freq:[60 200]
Enter the stop band freq:[50 250]
Enter the pass band attenaution:3
Enter the stop band attenaution:40
Order 16
Normalized cut-off freq 0.1198 0.4005

Industrial applications
a) Butterworth filter:
Butterworth filters are commonly used in audio equalization and crossover networks
to ensure a smooth frequency response and minimal phase distortion, providing high
quality sound reproduction in speakers, headphones, and audio amplifiers.
Butterworth filters are used in instrumentation systems for signal conditioning, data
acquisition, and noise reduction, ensuring accurate measurement and analysis of sensor
signals in industrial processes, automotive systems, and scientific instruments
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

b)Chebyshev type-1 filter


Chebyshev Type I filters are used in signal processing applications such as audio
and video processing, radar systems, and digital communications for achieving sharper
roll off and better stopband rejection
Chebyshev Type I filters are used in antenna design and RF front-end circuits for
frequency tuning, impedance matching, and signal rejection, enabling improved
antenna performance and communication system efficiency in wireless networks and
satellite communications.
c) Chebyshev type-2 filter
Chebyshev Type II filters are used in digital signal processing applications such as
audio equalization, image processing, and biomedical signal analysis for achieving
sharp stopband attenuation and improved noise rejection, ensuring high-fidelity signal
processing and accurate data analysis
Chebyshev Type II filters are used in control systems and feedback loops for filtering
out noise and disturbances, ensuring stable and precise control of industrial processes,
robotics, and automation systems in manufacturing, automotive, and aerospace
industries.
VIVA Question and answers
1. Why are IIR filters unstable?
IIR (Infinite Impulse Response) filters can be unstable due to their feedback nature.
The filter’s output depends not only on the current and past input samples but also on
past output samples. If the feedback coefficients are not chosen properly, the output
can grow without bound, leading to instability. Mathematically, this happens when the
poles of the filter (which are derived from the transfer function) are outside the unit
circle in the z-plane, causing the system to have an unbounded response over time.
2. What is the condition for linear phase?
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

For a filter to have linear phase, its impulse response must be symmetric or anti-
symmetric. This ensures that all frequency components of the signal are delayed by the
same amount, resulting in no distortion of the signal's waveform. Specifically:
 FIR filters can have linear phase because their impulse response is symmetric
(or anti-symmetric).
 IIR filters, however, generally do not have linear phase because their impulse
response is not symmetric due to the feedback structure. Therefore, it is difficult
(or impossible) to achieve linear phase in IIR filters.
3. Why is the impulse response "infinite"?
The impulse response of IIR filters is infinite because of the recursive nature of their
structure. IIR filters are characterized by feedback, where the output depends on past
outputs as well as the current and past inputs. As a result, even after the impulse input
(which is a "1" at time 0 and "0" at all other times) is applied, the output continues
indefinitely due to the recursive feedback. Thus, the impulse response is infinite, unlike
FIR filters, where the impulse response is finite and typically ends after a certain
number of samples.
4. What are the disadvantages of IIR filters (compared to FIR filters)?
Some disadvantages of IIR filters compared to FIR filters include:
 Non-linear phase response: IIR filters generally do not have linear phase,
which can cause distortion in phase-sensitive applications.
 Stability issues: IIR filters can become unstable if the poles are not properly
placed inside the unit circle in the z-plane.
 Design complexity: IIR filters are more difficult to design compared to FIR
filters, especially when achieving specific phase and stability requirements.
 Sensitivity to coefficient quantization: IIR filters can be more sensitive to
quantization errors in filter coefficients, leading to performance degradation in
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

fixed-point implementations.
5. List out the properties of IIR filters:
IIR filters have several key properties:
 Recursive structure: IIR filters use feedback, meaning that past output values
affect current outputs.
 Infinite impulse response: The impulse response of an IIR filter theoretically
lasts forever due to the feedback.
 More efficient than FIR: IIR filters can achieve a desired filtering effect (e.g.,
a lowpass or bandpass response) with fewer coefficients compared to FIR filters,
making them computationally more efficient.
 Can have poles and zeros: IIR filters can have both poles (feedback) and zeros
(feedforward), allowing more flexibility in shaping the frequency response.
 Stability concerns: IIR filters can become unstable if the poles lie outside the
unit circle in the z-plane.
 Non-linear phase: IIR filters generally do not have linear phase, leading to
phase distortion in the filtered signal.
 Frequency selectivity: IIR filters are capable of implementing sharp frequency
responses (e.g., lowpass, highpass) with relatively few coefficients compared to
FIR filters.

RESULT
Thus, the MATLAB program for IIR filters was implemented and the responses are
plotted.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Experiment
Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

no:11
Design of FINITE IMPULSE RESPONSE (FIR) FILTER

Aim
To write a MATLAB program for Finite Impulse Response (FIR) filter using window
technique.
Mapping with theory
BARTLETT WINDOW:
The Bartlett window is characterized by its triangular shape, with tapering ends
that smoothly reduce the amplitude towards the edges of the window.
This tapering reduces spectral leakage compared to rectangular windows, which
abruptly cut off at the edges.
The triangular shape of the Bartlett window ensures that the Fourier transform of
the window function exhibits a sinc-like main lobe with relatively low sidelobes,
resulting in improved frequency resolution.
HAMMING WINDOW:
The Hamming window is characterized by its raised cosine shape, with tapering
ends that smoothly reduce the amplitude towards the edges of the window.
This tapering reduces spectral leakage compared to rectangular windows, resulting
in a narrower main lobe and lower sidelobes in the frequency domain.
HANNING WINDOW:
The Hanning window is characterized by its raised cosine shape, similar to the
Hamming window. It smoothly tapers towards the edges, reducing spectral leakage
and sidelobes in the frequency domain.
BLACKMAN WINDOW:
The Blackman window is characterized by its three-term cosine shape, which
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

provides a good balance between main lobe width and sidelobe suppression. It
smoothly tapers towards the edges, reducing spectral leakage and sidelobes in the
frequency domain.
KAISER WINDOW:
It is a variable-parameter window function that offers greater control over the
trade-off between main lobe width and sidelobe levels compared to other window
functions.
The Kaiser window is particularly useful when precise control over spectral
characteristics is required.
The Kaiser window is defined by a parameter β, also known as the shape parameter
or beta parameter, which controls the trade-off between main lobe width and sidelobe
levels
RECTANGULAR WINDOW:
It is characterized by a constant value of one across its entire length and abruptly
drops to zero at the edges.
While the rectangular window has some drawbacks compared to other window
functions, such as high sidelobe levels and poor frequency resolution, it is still useful
in certain applications where simplicity and minimal processing are desired.
Procedure

1. Launch MATLAB: Double-click the MATLAB icon or search for it in the


application launcher.
2. Create/Open Script:
1. To create a new script: Go to the "Home" tab and click "New
Script."
2. To open an existing script: Go to the "Home" tab, click "Open,"
and select the script.
3. Write/Paste Code: In the MATLAB Editor, write or paste your MATLAB
code.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

4. Save Script: Save the script with a meaningful name and ".m" extension (e.g.,
"my_script.m").
5. Run Script:
1. Click the "Run" button in the Editor toolbar, or
2. Type the script name (without ".m") in the Command Window
and press Enter.
6. View Output: MATLAB will display the results in the Command Window or
graphical output in figure windows.

Pseudocode
Main Function: window_design
1. Initialize Program:
o Clear previous variables, close all figures, and clear the command
window.
2. Input Parameters:
o Prompt the user for:
 rp = Passband ripple.
 rs = Stopband ripple.
 fp = Passband frequency.
 fs = Stopband frequency.
 f = Sampling frequency.
3. Calculate Normalized Frequencies:
o Compute wp = 2 * (fp / f) (normalized passband frequency).
o Compute ws = 2 * (fs / f) (normalized stopband frequency).
4. Calculate Filter Order:
o Use the formula:
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

o Add 1 to the order if necessary to ensure proper filter design.


5. Define Window Types:
o Create a list of window names: ['bartlett', 'hamming', 'hann', 'blackman',
'rectwin', 'kaiser'].
6. Iterate Over Window Types:
For each window type:
1. Open a new figure.
2. Set the title as "{WINDOW_NAME} WINDOW FILTER
RESPONSES".
3. Call the function design_and_plot_filter for each filter type:
 Pass the filter order, cutoff frequencies, window
name, sampling frequency, and filter type (lowpass,
highpass, bandpass, bandstop).

Function: design_and_plot_filter
1. Inputs:
o Filter order n.
o Passband frequency wp.
o Stopband frequency ws.
o Window type.
o Sampling frequency f.
o Filter type (lowpass, highpass, bandpass, or bandstop).
2. Determine Cutoff Frequencies:
o If filter type is bandpass or bandstop:
 Set wn = [wp, ws].
o Else:
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

 Set wn = wp.
3. Design Filter:
o Try designing the filter using:
b = fir1(n, wn, filter_type, window_function);
4. Validate and Adjust Window Length:
 Compute the actual filter order, n_actual = length(b) - 1.
 Regenerate the window with n_actual + 1 length if the initial window length
doesn’t match.
5. Redesign Filter with Adjusted Window:
 Use the adjusted window to redesign the filter:
b = fir1(n_actual, wn, filter_type, adjusted_window);
6. Plot Frequency Response:
 Use freqz to compute the frequency response.
 Plot the magnitude response on a shared subplot grid.
 Annotate the title with the filter type and order.
7. Error Handling:
 If any error occurs during filter design, catch it and:
o Display a warning message with the window type and filter type.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Program
function window_design()
% Clear and reset
close all;
clear;
clc;

% Get filter parameters from the user


rp = input('Enter the passband ripple (e.g., 0.01): ');
rs = input('Enter the stopband ripple (e.g., 0.001): ');
fp = input('Enter the passband frequency (Hz): ');
fs = input('Enter the stopband frequency (Hz): ');
f = input('Enter the sampling frequency (Hz): ');

% Normalized frequencies
wp = 2 * (fp / f);
ws = 2 * (fs / f);

% Filter order calculation


num = (-10 * log10(rp * rs)) - 13;
den = 14.6 * (fs - fp) / f;
n = ceil(num / den);

% Window types
windows = {'bartlett', 'hamming', 'hann', 'blackman', 'rectwin', 'kaiser'};
for i = 1:length(windows)
window_name = windows{i};

% Plot all filters on one figure for the current window


figure;
sgtitle([upper(window_name) ' WINDOW FILTER RESPONSES']); % Title for
the entire figure
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

% Lowpass filter
subplot(2, 2, 1);
design_and_plot_filter(n, wp, ws, f, window_name, 'low', 'Lowpass');

% Highpass filter
subplot(2, 2, 2);
design_and_plot_filter(n, wp, ws, f, window_name, 'high', 'Highpass');

% Bandpass filter
subplot(2, 2, 3);
design_and_plot_filter(n, wp, ws, f, window_name, 'bandpass',
'Bandpass');

% Bandstop filter
subplot(2, 2, 4);
design_and_plot_filter(n, wp, ws, f, window_name, 'stop', 'Bandstop');
end
end

function design_and_plot_filter(n, wp, ws, f, window_name, filter_type,


plot_title)
% Adjust frequency parameters for bandpass and bandstop filters
if strcmp(filter_type, 'bandpass') || strcmp(filter_type, 'stop')
wn = [wp, ws]; % Two cutoff frequencies for band filters
else
wn = wp; % Single cutoff frequency for low/highpass filters
end

% Recompute window based on filter length


try
% Design the filter
[b, ~] = fir1(n, wn, filter_type); % Get coefficients
n_actual = length(b) - 1; % Actual filter order
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

switch window_name
case 'bartlett'
win = bartlett(n_actual + 1);
case 'hamming'
win = hamming(n_actual + 1);
case 'hann'
win = hann(n_actual + 1);
case 'blackman'
win = blackman(n_actual + 1);
case 'rectwin'
win = rectwin(n_actual + 1);
case 'kaiser'
win = kaiser(n_actual + 1, 1.5);
end

% Reapply filter design with updated window


b = fir1(n_actual, wn, filter_type, win);

% Plot the frequency response


[h, w] = freqz(b, 1, 256, f);
plot(w, 20 * log10(abs(h)));
grid on;
title([plot_title, ' (Order: ', num2str(n_actual), ')']);
xlabel('Frequency (Hz)');
ylabel('Magnitude (dB)');
catch ME
warning('Error in designing %s %s filter: %s', window_name,
filter_type, ME.message);
end
end
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Output
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Industrial Applications
BARTLETT WINDOW:
Acoustic Signal Processing: Bartlett windows are used in acoustic signal
processing applications such as noise reduction, echo cancellation, and beamforming.
Sonar Systems: Bartlett windows are employed in sonar systems for underwater
signal processing to improve range resolution and reduce sidelobe interference.
HAMMING WINDOW:
Speech Processing: Hamming windows are widely used in speech processing
applications such as speech recognition, voice activity detection, and speaker
identification to improve spectral analysis and feature extraction.
Telecommunications: Hamming windows are employed in digital communication
systems for channel equalization, pulse shaping, and signal detection to reduce
intersymbol interference and improve signal-to-noise ratio.
HANNING WINDOW:
Spectrum Analysis: Hanning windows are commonly used in spectrum analysis
applications such as Fourier analysis, power spectral density estimation, and
frequency domain filtering to reduce spectral leakage and improve frequency
resolution.
RECTANGULAR WINDOW BANDSTOP FILTER
Medical Imaging: Hanning windows are applied in medical imaging modalities
such as MRI and CT scans for image reconstruction and artifact reduction, leading to
improved image quality and diagnostic accuracy.
BLACKMAN WINDOW:
Signal Processing: Blackman windows are widely used in signal processing
applications such as filtering, spectral analysis, and modulation to reduce spectral
leakage and
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

sidelobes, particularly in non-stationary signal analysis.


Wireless Communications: Blackman windows are employed in wireless
communication systems for channel estimation, equalization, and interference
suppression to improve signal quality and system performance in fading channels.
KAISER WINDOW:
Digital Filters: Kaiser windows are commonly used in digital filter design for finite
impulse response (FIR) filters, particularly in applications where precise control over
passband ripple, stopband attenuation, and transition width is required.
Biomedical Signal Processing: Kaiser windows are applied in biomedical signal
processing for electrocardiography (ECG), electroencephalography (EEG), and other
physiological signal analysis tasks to achieve accurate spectral analysis and feature
extraction.
RECTANGULAR WINDOW
Simple Data Analysis: Rectangular windows are often used in basic data analysis
tasks where simplicity and minimal processing are desired, such as simple frequency
analysis or data visualization.
Educational Purposes: Rectangular windows are commonly used in educational
settings to introduce students to the concept of windowing and its effects on spectral
analysis.
VIVA Question and answers
1. What is the Z-transform of a FIR filter?
The Z-transform of a FIR filter is given by:
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

where:
 h[n] are the filter coefficients (impulse response of the FIR filter).
 N is the length of the filter.
Since FIR filters have a finite number of non-zero coefficients, the Z-transform is a
polynomial in z−1.

2. What is the frequency response formula for a FIR filter?


The frequency response H(e^jω) of a FIR filter is the Z-transform evaluated on the
unit circle (z=e^jω):

where:
 h[n] are the FIR filter coefficients.
 ω is the angular frequency in radians/second.

3. Why is the impulse response "finite"?


The impulse response of an FIR filter is "finite" because:
1. FIR filters are designed with a limited number of coefficients (N).
2. After N samples, the impulse response becomes zero (no further contributions
to the output).
This is in contrast to IIR filters, where the impulse response can theoretically
continue indefinitely due to feedback.

4. Can I calculate the frequency response of a FIR using the Discrete Fourier
Transform (DFT)?
Yes, the frequency response of a FIR filter can be calculated using the Discrete
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Fourier Transform (DFT). The steps are:


1. Take the FIR filter coefficients h[n] as the input sequence.
2. Compute the DFT of h[n] using:

3. The result H[k] gives the frequency response at discrete frequency points.
This method is computationally efficient and widely used in practical applications.

5. Why are FIR filters generally preferred over IIR filters in multirate
(decimating and interpolating) systems?
FIR filters are preferred over IIR filters in multirate systems because:
1. Linear Phase: FIR filters can be designed to have a linear phase response,
ensuring no phase distortion during decimation or interpolation.
2. Stability: FIR filters are inherently stable since they do not have feedback.
3. Efficient Implementation: In multirate systems, FIR filters can be optimized
using polyphase decomposition, reducing computational complexity.
4. Anti-Aliasing: FIR filters provide better control over the stopband attenuation,
making them suitable for anti-aliasing and anti-imaging operations in multirate
processing.
5. No Recursive Artifacts: IIR filters, due to their feedback, can produce
artifacts that are undesirable in systems where the sampling rate changes.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Result
Thus, the FIR filters using window technique was implemented using MATLAB.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

DSP Processor programs


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment
no:1 Study of Architecture of Digital Signal Processor
Aim
To study the Architecture of TMS320VC67XX DSP processor.
Introduction
The hardware experiments in the DSP lab are carried out on the Texas Instruments
TMS320C6713 DSP Starter Kit (DSK), based on the TMS320C6713 floating point
DSP running at 225MHz. The basic clock cycle instruction time is 1/ (225 MHz) = 4.44
nanoseconds. During each clock cycle, up to eight instructions can be carried out in
parallel, achieving up to 8×225 = 1800 million instructions per second (MIPS). The
DSK board includes a 16MB SDRAM memory and a 512KB Flash ROM. It has an on-
board 16-bit audio stereo codec (the Texas Instruments AIC23B) that serves both as an
A/D and a D/A converter. There are four 3.5 mm audio jacks for microphone and stereo
line input, and speaker and headphone outputs. The AIC23 codec can be programmed
to sample audio inputs at the following sampling rates: fs = 8, 16, 24, 32, 44.1, 48, 96
kHz.
The ADC part of the codec is implemented as a multi-bit third-order noise-shaping
delta-sigma converter) that allows a variety of oversampling ratios that can realize the
above choices of fs. The corresponding oversampling decimation filters act as anti-
aliasing pre- filters that limit the spectrum of the input analog signals effectively to the
Nyquist interval [−fs/2, fs/2]. The DAC part is similarly implemented as a multi-bit
second-order noise- shaping delta-sigma converter whose oversampling interpolation
filters act as almost ideal reconstruction filters with the Nyquist interval as their pass
band.
The DSK also has four user-programmable DIP switches and four LEDs that can be
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

used to control and monitor programs running on the DSP. All features of the DSK are
managed by the Code Composer Studio (CCS). The CCS is a complete integrated
development environment (IDE) that includes an optimizing C/C++ compiler,
assembler, linker, debugger, and program loader. The CCS communicates with the
DSK via a USB connection to a PC. In addition to facilitating all programming aspects
of the C6713 DSP, the CCS can also read signals stored on the DSP‟s memory, or the
SDRAM, and plot them in the time or frequency domains. The following block diagram
depicts the overall operations involved in all of the hardware experiments in the DSP
lab. Processing is interrupt-driven at the sampling rate fs, as explained below.
TMS320C6713 floating point DSP

The AIC23 codec is configured (through CCS) to operate at one of the above
sampling rates fs. Each collected sample is converted to a 16-bit two’s complement
integer (a short data type in C). The codec actually samples the audio input in stereo,
that is, it collects two samples for the left and right channels
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Architecture
The 67XX DSPs use an advanced, modified Harvard architecture that maximizes
processing power by maintaining one program memory bus and three data memory
buses. These processors also provide an arithmetic logic unit (ALU) that has a high
degree of parallelism, application-specific hardware logic, on-chip memory, and
additional on-chip peripherals. These DSP families also provide a highly specialized
instruction set, which is the basis of the operational flexibility and speed of these DSPs.
Separate program and data spaces allow simultaneous access to program instructions
and data, providing the high degree of parallelism. Two reads and one write operation
can be performed in a single cycle. Instructions with parallel store and application-
specific instructions can fully utilize this architecture. In addition, data can be
transferred between data and program spaces. Such parallelism supports a powerful set
of arithmetic, logic, and bit-manipulation operations that can all be performed in a
single machine cycle. Also included are the control mechanisms to manage interrupts,
repeated operations, and function calls.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Detailed Explanation
Central Processing Unit (CPU)

The CPU of the 67XX devices contains:


 A 40-bit arithmetic logic unit (ALU)
 Two 40-bit accumulators
 A barrel shifter
 A 17 -bit multiplier/adder
 A compare, select, and store unit (CSSU)
Arithmetic Logic Unit (ALU)
The ‟67XX devices perform 2s-complement arithmetic using a 40-bit ALU and two
40-bit accumulators (ACCA and ACCB). The ALU also can perform Boolean
operations. The ALU can function as two 16-bit ALUs and perform two 16-bit
operations simultaneously when the C16 bit in status register 1 (ST1) is set.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Accumulators
The accumulators, ACCA and ACCB, store the output from the ALU or the multiplier
/ adder block; the accumulators can also provide a second input to the ALU or the
multiplier / adder. The bits in each accumulator are grouped as follows:
 Guard bits (bits 32–39)
 A high-order word (bits 16–31)
 A low-order word (bits 0–15)
Instructions are provided for storing the guard bits, the high-order and the low- order
accumulator words in data memory, and for manipulating 32-bit accumulator words in
or out of data memory. Also, any of the accumulators can be used as temporary storage
for the other.
Barrel Shifter
The barrel shifter has a 40-bit input connected to the accumulator or data memory
(CB, DB) and a 40-bit output connected to the ALU or data memory (EB). The barrel
shifter produces a left shift of 0 to 31 bits and a right shift of 0 to 16 bits on the input
data. The shift requirements are defined in the shift-count field (ASM) of ST1 or
defined in the temporary register (TREG), which is designated as a shift-count register.
This shifter and the exponent detector normalize the values in an accumulator in a
single cycle. The least significant bits (LSBs) of the output are filled with 0s and the
most significant bits (MSBs) can be either zero-filled or sign- extended, depending on
the state of the sign-extended mode bit (SXM) of ST1
Multiplier/Adder
The multiplier / adder performs 17-bit 2s-complement multiplication with a 40- bit
accumulation in a single instruction cycle. The multiplier / adder block consists of
several elements: a multiplier, adder, signed/unsigned input control, fractional control,
a zero detector, a rounder (2s-complement), overflow/saturation logic, and TREG.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

The multiplier has two inputs: one input is selected from the TREG, a data memory
operand, or an accumulator; the other is selected from the program memory, the data
memory, an accumulator, or an immediate value. The fast on-chip multiplier allows
the C67XX to perform operations such as convolution, correlation, and filtering
efficiently. In addition, the multiplier and ALU together execute multiply/accumulate
(MAC) computations and ALU operations in parallel in a single instruction cycle. This
function is used in determining the Euclid distance, and in implementing symmetrical
and least mean square (LMS) filters, which are required for complex DSP algorithms.
Compare, Select, and Store Unit (CSSU)
The compare, select, and store unit (CSSU) performs maximum comparisons between
the accumulator’s high and low words, allows the test/control (TC) flag bit of status
register 0 (ST0) and the transition (TRN) register to keep their transition histories, and
selects the larger word in the accumulator to be stored in data memory. The CSSU also
accelerates Viterbi-type butterfly computation with optimized on-chip hardware.
Program Control
Program control is provided by several hardware and software mechanisms:
The program controller decodes instructions, manages the pipeline, stores the status of
operations, and decodes conditional operations. Some of the hardware elements
included in the program controller are the program counter, the status and control
register, the stack, and the address-generation logic.
Some of the software mechanisms used for program control includes branches, calls,
and conditional instructions, are peat instruction, reset, and interrupt.
The C67XX supports both the use of hardware and software interrupts for program
control. Interrupt service routines are vectored through a re-locatable interrupt vector
table. Interrupts can be globally enabled / disabled and can be individually masked
through the interrupt mask register (IMR). Pending interrupts are indicated in the
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

interrupt flag register (IFR). For detailed information on the structure of the interrupt
vector table, the IMR and the IFR, see the device-specific data sheets.
Status Registers (ST0, ST1)
The status registers, ST0 and ST1, contain the status of the various conditions and
modes for the ‟67XX devices. ST0 contains the flags (OV, C, and TC) produced
by arithmetic operations and bit manipulations in addition to the data page pointer
(DP) and the auxiliary register pointer (ARP) fields. ST1 contains the various modes
and instructions that the processor operates on and executes.
Auxiliary Registers (AR0–AR7)
The eight 16-bit auxiliary registers (AR0–AR7) can be accessed by the central
arithmetic logic unit (CALU) and modified by the auxiliary register arithmetic units
(ARAUs). The primary function of the auxiliary registers is generating 16-bit
addresses for data space. However, these registers also can act as general-purpose
registers or counters.
Temporary Register (TREG)
The TREG is used to hold one of the multiplicands for multiply and
multiply/accumulate instructions. It can hold a dynamic (execution-time
programmable) shift count for instructions with a shift operation such as ADD, LD,
and SUB. It also can hold a dynamic bit address for the BITT instruction. The EXP
instruction stores the exponent value computed into the TREG, while the NORM
instruction uses the TREG value to normalize the number. For ACS operation of
Viterbi decoding, TREG holds branch metrics used by the DADST and DSADT
instructions.
Transition Register (TRN)
The TRN is a 16-bit register that is used to hold the transition decision for the path to
new metrics to perform the Viterbi algorithm. The CMPS (compare, select, max, and
store) instruction updates the contents of the TRN based on the comparison between
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

the accumulator high word and the accumulator low word.


Stack-Pointer Register (SP)
The SP is a 16-bit register that contains the address at the top of the system stack. The
SP always points to the last element pushed onto the stack. The stack is manipulated
by interrupts, traps, calls, returns, and the PUSHD, PSHM, POPD, and POPM
instructions. Pushes and pops of the stack pre decrement and post increment,
respectively, all 16 bits of the SP.
Auxiliary Registers (AR0–AR7)
The eight 16-bit auxiliary registers (AR0–AR7) can be accessed by the central
arithmetic logic unit (CALU) and modified by the auxiliary register arithmetic units
(ARAUs). The primary function of the auxiliary registers is generating 16-bit addresses
for data space. However, these registers also can act as general-purpose registers or
counters.

Temporary Register (TREG)


The TREG is used to hold one of the multiplicands for multiply and
multiply/accumulate instructions. It can hold a dynamic (execution-time
programmable) shift count for instructions with a shift operation such as ADD, LD,
and SUB. It also can hold a dynamic bit address for the BITT instruction. The EXP
instruction stores the exponent value computed into the TREG, while the NORM
instruction uses the TREG value to normalize the number. For ACS operation of
Viterbi decoding, TREG holds branch metrics used by the DADST and DSADT
instructions.
Transition Register (TRN)
The TRN is a 16-bit register that is used to hold the transition decision for the path to
new metrics to perform the Viterbi algorithm. The CMPS (compare, select, max, and
store) instruction updates the contents of the TRN based on the comparison between
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

the accumulator high word and the accumulator low word.


Stack-Pointer Register (SP)
The SP is a 16-bit register that contains the address at the top of the system stack. The
SP always points to the last element pushed onto the stack. The stack is manipulated
by interrupts, traps, calls, returns, and the PUSHD, PSHM, POPD, and POPM
instructions. Pushes and pops of the stack pre decrement and post increment,
respectively, all 16 bits of the SP.
Circular-Buffer-Size Register (BK)
The 16-bit BK is used by the ARAUs in circular addressing to specify the data block
size.
Block-Repeat Registers (BRC, RSA, REA)
The block-repeat counter (BRC) is a 16-bit register used to specify the number of times
a block of code is to be repeated when performing a block repeat. The block- repeat
start address (RSA) is a 16-bit register containing the starting address of the block of
program memory to be repeated when operating in the repeat mode. The 16- bit block-
repeat end address (REA) contains the ending address if the block of program memory
is to be repeated when operating in the repeat mode.
Interrupt Registers (IMR, IFR)
The interrupt-mask register (IMR) is used to mask off specific interrupts individually
at required times. The interrupt-flag register (IFR) indicates the current status of the
interrupts.
Processor-Mode Status Register (PMST)
The processor-mode status registers (PMST) controls memory configurations of the
67XX devices.
Power-Down Modes
There are three power-down modes, activated by the IDLE1, IDLE2, and IDLE3
instructions. In these modes, the 67XX devices enter a dormant state and dissipate


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

considerably less power than in normal operation. The IDLE1instruction is used to shut
down the CPU. The IDLE2 instruction is used to shut down the CPU and on-chip
peripherals. The IDLE3 instruction is used to shut down the 67XX processor
completely. This instruction stops the PLL circuitry as well as the CPU and peripherals.

RESULT
Thus, the study of architecture TMS320VC67XX and its functionalities has been
identified.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment
no:2 Addition of two numbers

Aim
To perform addition of two 16-bit numbers using TMS320C50 processor, by
writing an assembly language program (ALP). This operation demonstrates basic
arithmetic functionality using the TMS320C50 processor.

Mapping with theory

In the DSP processor various addressing modes are studied. ALP for
understanding different modes this program has been done.

Addressing Modes the TMS320C67XX DSP supports three types of addressing modes
that enable flexible access to data memory, to memory-mapped registers, to register
bits, and to I/O space:

The absolute addressing mode allows you to reference a location by supplying all or
part of an address as a constant in an instruction.

The direct addressing mode allows you to reference a location using an address offset.
The indirect addressing mode allows you to reference a location using a pointer.

Each addressing mode provides one or more types of operands. An instruction that
supports an addressing-mode operand has one of the following syntax elements listed
below.

Baddr
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

When an instruction contains Baddr, that instruction can access one or two bits in an
accumulator (AC0–AC3), an auxiliary register (AR0–AR7), or a temporary register
(T0–T3). Only the register bit test/set/clear/complement instructions support Baddr.
As you write one of these instructions, replace Baddr with a compatible operand.

Cmem

When an instruction contains Cmem, that instruction can access a single word (16 bits)
of data from data memory. As you write the instruction, replace Cmem with a
compatible operand.

Lmem

When an instruction contains Lmem, that instruction can access a long word (32 bits)
of data from data memory or from a memory-mapped registers. As you write the
instruction, replace Lmem with a compatible operand.

Smem

When an instruction contains Smem, that instruction can access a single word (16
bits) of data from data memory, from I/O space, or from a memory-mapped register.
As you write the instruction, replace Smem with a compatible operand.

Xmem and Ymem

When an instruction contains Xmem and Ymem, that instruction can perform two
simultaneous 16-bit accesses to data memory. As you write the instruction, replace
Xmem and Ymem with compatible operands.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Absolute Addressing Modes k16 absolute

This mode uses the 7-bit register called DPH (high part of the extended data page
register) and a 16-bit unsigned constant to form a 23-bit data space address. This mode
is used to access a memory location or a memory-mapped register.

k23 absolute

This mode enables you to specify a full address as a 23-bit unsigned constant. This
mode is used to access a memory location or a memory-mapped register.

I/O absolute

This mode enables you to specify an I/O address as a 16-bit unsigned constant. This
mode is used to access a location in I/O space.

Direct Addressing Modes DP direct

This mode uses the main data page specified by DPH (high part of the extended data
page register) in conjunction with the data page register (DP).This mode is used to
access a memory location or a memory-mapped register.

SP direct

This mode uses the main data page specified by SPH (high part of the extended stack
pointers) in conjunction with the data stack pointer (SP). This mode is used to access
stack values in data memory.

Register-bit direct

This mode uses an offset to specify a bit address. This mode is used to access one
register bit or two adjacent register bits.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

PDP direct

This mode uses the peripheral data page register (PDP) and an offset to specify an I/O
address. This mode is used to access a location in I/O space. The DP direct and SP
direct addressing modes are mutually exclusive. The mode selected depends on the
CPL bit in status register ST1_67: 0 DP direct addressing mode 1 SP direct addressing
mode The register-bit and PDP direct addressing modes are independent of the CPL
bit.

Indirect Addressing Modes

You may use these modes for linear addressing or circular addressing.

AR indirect

This mode uses one of eight auxiliary registers (AR0–AR7) to point to data. The way
the CPU uses the auxiliary register to generate an address depends on whether you are
accessing data space (memory or memory-mapped registers), individual register bits,
or I/O space.

Dual AR indirect

This mode uses the same address-generation process as the AR indirect addressing
mode. This mode is used with instructions that access two or more data-memory
locations.

CDP indirect

This mode uses the coefficient data pointer (CDP) to point to data. The way the CPU
uses CDP to generate an address depends on whether you are accessing data space
(memory or memory-mapped registers), individual register bits, or I/O space.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Coefficient indirect

This mode uses the same address-generation process as the CDP indirect addressing
mode. This mode is available to support instructions that can access a coefficient in
data memory at the same time they access two other data-memory values using the
dual AR indirect addressing mode.

Circular Addressing

Circular addressing can be used with any of the indirect addressing modes. Each of
the eight auxiliary registers (AR0–AR7) and the coefficient data pointer (CDP) can be
independently configured to be linearly or circularly modified as they act as pointers
to data or to register bits, see Table 3−10. This configuration is done with a bit
(ARnLC) in status register ST2_67. To choose circular modification, set the bit. Each
auxiliary register ARn has its own linear/circular configuration bit in ST2_67: 0 Linear
addressing 1 Circular addressing The CDPLC bit in status register ST2_67 configures
the DSP to use CDP for linear addressing or circular addressing: 0 Linear addressing
1 Circular addressing You can use the circular addressing instruction qualifier, .CR, if
you want every pointer used by the instruction to be modified circularly, just add
.CR to the end of the instruction mnemonic (for example, ADD.CR). The circular
addressing instruction qualifier overrides the linear/circular configuration in ST2_67.
Apparatus required
 PC with C50 Debugger
 TMS320C50 Trainer Kit.
Pseudo Code
1. Load data pointer to address 100h.
2. Load accumulator with input 1234h.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

3. Add the input 1234h with the content of accumulator and store the result in
accumulator.
4. Branch conditionally to the loop if there is no carry.
5. If the above instruction is false, Store the lower order content of Accumulator
that represents sum will be moved to zeroth location of 255th page.
6. Load the accumulator with one which represent the presence of carry.
7. Store the higher order content of Accumulator that represents carry will be
moved to first location of 255th page.
8. Unconditional branch to end the program.
9. Store the lower order content of Accumulator that represents sum will be
moved to zeroth location of 255th page.
10. Load the accumulator with one which represents no carry.
11. Store the lower byte of accumulator in location 00.
12. End.

Program

LABEL MNEMONICS COMMENTS


ldp #100h Load data pointer to address 100h
lacc #1234h Load accumulator with input 1234h.
add #1234h Add the input 1234h with the content of accumulator and
store the result in accumulator.
Bcnd loop,nc Branch conditionally to the loop if there is no carry.
sacl 00 If the above instruction is false, Store the lower order
content of Accumulator that represents sum will be moved
to zeroth location of 255th page.
Lacc #01 Load the accumulator with one which represent the
presence of carry
sach 01 Store the higher order content of Accumulator that
represents carry will be moved to first location of 255th
page.
L Bl Unconditional branch to end the program.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Loop sacl 00 Store the lower order content of Accumulator that


represents sum will be moved to zeroth location of 255 th
page.
Lacc #00 Load the accumulator with one which represents no carry.
sach 01 Store the lower byte of accumulator in location 00.
L b l End

Output
PI C000
Downloading From Host....
#GO C000
Executing....
Micro-50eb Serial Monitor, Ver-2.0
(c)1999, Vi Microsystems Pvt. Ltd., Chennai -96
#SD 8000
Substitute Data 8000:2468
Procedure
1. Open C50 Debugger, select project- new project.
2. Assign name for the project with the extension. dpj
3. Select file-new-assembly file and save it with the extension .asm
4. Type the program and save it.
5. Right click on assembly and select add file to project. Right click on assembly
and add
6. the file micro50
7. Right click on assembly and select build.
8. Select serial- open port 1-ok. this connects the processor to the port.
9. Switch on the processor
10. Select serial-load program-ok
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

11. Select serial –communication window.


12. Enter the file name in it and obtain the output.

Industrial Applications
In industrial environments, signals from sensors often need conditioning before
being processed further. Addition might be part of such conditioning, for example, to
offset or calibrate sensor readings.
Addition operations might be used in error correction algorithms, modulation
schemes, or encryption/decryption processes in communication systems deployed in
industrial settings.
In systems where multiple sensors are used to gather information about a process
or environment, addition could be involved in combining sensor readings to derive
more accurate or comprehensive information.
Many industrial control systems involve calculations on sensor inputs, reference
values, and control signals. Addition might be involved in summing up multiple sensor
inputs or adjusting control signals.
impulse response (FIR) or infinite impulse response (IIR) filters, involve adding the
weighted outputs of filter taps, which are typically 16-bit numbers.
In industrial automation and robotics, motor control algorithms often require
real-time calculations on sensor inputs and control signals. Adding 16-bit values might
be involved in tasks such as computing control errors, adjusting PWM (pulse-width
modulation) signals, or implementing PID (proportional-integral-derivative)
controllers.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Result
Thus, the Addition of two 16-bit numbers was performed using DSP processor.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment
no:3 Subtraction of two numbers

Aim
To perform subtraction of two 16-bit numbers using TMS320C50 processor, by
writing an assembly language program (ALP). This operation demonstrates basic
arithmetic functionality using the TMS320C50 processor.

Mapping with theory


In the DSP processor various addressing modes are studied. ALP for
understanding different modes this program has been done.
Apparatus required
 PC with C50 Debugger
 TMS320C50 Trainer Kit.

Pseudo Code
1. Load data pointer to address 100h.
2. Load accumulator with input 1234h.
3. Add the input 1234h with the content of accumulator and store the result in
accumulator.
4. Branch conditionally to the loop if there is no carry.
5. If the above instruction is false, Store the lower order content of Accumulator
that represents sum will be moved to zeroth location of 255th page.
6. Load the accumulator with one which represent the presence of carry.
7. Store the higher order content of Accumulator that represents carry will be
moved to first location of 255th page.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

8. Unconditional branch to end the program.


9. Store the lower order content of Accumulator that represents sum will be moved
to zeroth location of 255th page.
10. Load the accumulator with one which represents no carry.
11. Store the lower byte of accumulator in location 00.
12. End.

Procedure
1. Open C50 Debugger, select project- new project.
2. Assign name for the project with the extension. dpj
3. Select file-new-assembly file and save it with the extention .asm
4. Type the program and save it.
5. Right click on assembly and select add file to project.right click on assembly and
add
6. the file micro-50
7. Right click on assembly and select build.
a.Select serial- open port 1-ok. this connects the processor to the port.
b. Switch on the processor
c.Select serial-load program-ok
d. Select serial –communication window.
e.Enter the file name in it and obtain the output.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

LABEL MNEMONICS COMMENTS

ldp #100h Load data pointer to address 100h .represents zeroth


location of 255th page.
lacc #3421h Load accumulator with input #3421h .(immediate
addressing)
sub #2311h Subtract the input #2311h from the content of
accumulator and store the result in accumulator.
Bcnd loop,nc Branch conditionally to the loop if there is no carry.
sacl 00 If the above instruction is false, Store the lower order
content of Accumulator that represents difference
which will be moved to zeroth location of 255th page.
Lacc #00 Load the accumulator with zero which represents no
borrow..
sach 01 Store the higher order content of Accumulator that
represents no borrow will be moved to first location of
255th page.
l Bl Unconditional branch to end the program.
loop sacl 00 Store the lower order content of Accumulator that
represents sum will be moved to zeroth location of
255th page.
Lacc #01 Load the accumulator with one which represents
borrow.
sach 01 Store the lower byte of accumulator in location 00.
l b l End .
Program
Output

PI C000
Downloading From Host....
#GO C000
Executing....
Micro-50eb Serial Monitor, Ver-2.0
(c)1999, Vi Microsystems Pvt. Ltd., Chennai -96
#SD 8000
Substitute Data 8000:1110

Industrial Applications
In industrial control systems, precise control of processes or machinery often
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

requires subtracting feedback signals from reference values or set points. For example,
in temperature control systems, the difference between the desired temperature set
point and the actual temperature measured by a sensor can be calculated through
subtraction to adjust control parameters.
In industrial automation and communication systems, error detection and
correction algorithms, Subtraction can help to identify discrepancies and errors in data
transmission or reception, enabling real-time correction to ensure reliability and
accuracy.
In industrial applications where sensors measure physical quantities such as
pressure, displacement, or strain, subtraction can help eliminate unwanted DC offsets
or biases, ensuring accurate measurements.
In power generation and distribution systems, real-time monitoring and control of
electrical parameters such as voltage, current, and power factor are essential for
maintaining system stability and efficiency. Subtraction operations can be used to
calculate parameters such as active power, reactive power, and power factor from
measured voltage and current values.

Result
Thus, Subtraction of two 16-bit numbers was performed using DSP processor.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment
no:4 Multiplication of two numbers

Aim
To perform multiplication of two 16-bit numbers using TMS320C50 processor,
by writingan assembly language program (ALP).
Objective
The objective of performing multiplication of two 16-bit numbers using a
TMS320C50 processor, is to compute the product of the two numbers accurately and
efficiently
Mapping with theory
To understand the concept of different instruction sets and different types of
register operations such as temporary registers and product registers in addition to the
accumulation and also the usage of direct addressing mode
Apparatus Required
 PC with C50 Debugger
 TMS320C50 Trainer Kit.

Procedure
1. Open C50 Debugger , select project- new project.
2. Assign name for the project with the extension .dpj
3. Select file-new-assembly file and save it with the extention .asm
4. Type the program and save it.
5. Right click on assembly and select add file to project.right click on assembly
and add the file micro 50
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

6. Right click on assembly and select build.


7. Select serial- open port1-ok.this connects the processor to the
port. Switch on the processor
8. Select serial-load program-ok
Select serial –communication
window.
9. Enter the file name in it and obtain the output.

Pseudo Code
1. Load the data pointer to 100h, (Zeroth location of 255th page)
2. Load the temporary register with the contents of memory location 00
3. Multiply the contents of memory location 01 & 00 and keep the result in
the product register. (unsigned number)
4. Move the content of product register to accumulator
5. Store the lower byte of accumulator to location 02
6. Store the upper byte of accumulator to location 03
7. End the program
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Program
LABEL PROGRAM COMMENT
ldp #10h Load the data pointer to 100h,Zeroth location of 255th page

lt 00h Load the temporary register with the contents of memory


location
00
mp 01h Multiply the contents of memory location 01 & 00 and keep
yu the result in the product register.(unsigned number)
pac Move the content of product register to accumulator
sacl 02h Store the lower byte of accumulator to location 02
sac 03h Store the upper byte of accumulator to location 03
h
L b l End

Output
#SD 8000
Substitute Data 8000:0345-

Substitute Data 8001:0001-0012

Substitute Data 8002:0345-

Micro-50eb Serial Monitor, Ver-2.0 (c)1999, Vi


Microsystems Pvt. Ltd., Chennai -96
#GO C000
Executing....
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Micro-50eb Serial Monitor, Ver-2.0 (c)1999, Vi


Microsystems Pvt. Ltd., Chennai -96
#SD 8002

Substitute Data 8002:3ADA-


Substitute Data 8003:0000-

Industrial Application
In industries where motors are used extensively, such as robotics, manufacturing, or
automotive sectors, precise control of motor speed, torque, and position, Multiplication
operations are used in motor control algorithms for tasks like generating pulse-width
modulation (PWM) signals, calculating motor torque, or implementing sensor less control
techniques.
In power electronic systems like inverters, converters, and rectifiers, multiplication
operations are essential for tasks like calculating power flow, voltage/current control, and
harmonic analysis.
In industrial automation and monitoring systems, Multiplication operations may be
employed to process sensor signals, calibrate measurements, or perform statistical
analysis for condition monitoring and predictive maintenance applications.
The ability to efficiently multiply 16-bit numbers using the TMS320C50 processor
enables faster and more accurate computation, leading to improved system performance,
reliability, and productivity in industrial processes.

Result
Thus, the Multiplication of two 16-bit numbers was performed using DSP processor.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment
no:5 Exchange a block of Data

Aim
To write an assembly language program to exchange a block of data using
TMS320C50 DSP processor. The program aims to transfer a block of data as quickly
and efficiently as possible to minimize processing overhead and reduce latency.

Mapping With theory


Exchanging a block of data using a DSP (Digital Signal Processor) typically involves
transferring data between memory locations, such as internal memory, external
memory, or I/O devices, using specialized instructions or mechanisms.
Steps for Exchanging a Block of Data Using a DSP Processor
1. Determine the Source and Destination
 Identify the memory location or device from which data will be read (source).
 Identify the memory location or device to which data will be written
(destination).
2. Set Up Buffers
 Allocate memory buffers for the source and destination blocks.
 Ensure the buffer size matches the amount of data to be exchanged.
3. Use DMA (Direct Memory Access) for Efficient Transfer
 Many DSPs include DMA controllers to transfer data without burdening the
CPU.
 Steps to use DMA:
1. Configure the DMA source address.
2. Configure the DMA destination address.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

3. Set the transfer size.


4. Trigger the DMA transfer.
4. Program the DSP for Manual Transfer (If Needed)
 If DMA is not used, a block of data can be exchanged manually using
instructions

Apparatus Required
 PC with C50 Debugger
 TMS320C50 Trainer Kit.

Procedure
1. Open C50 Debugger, select project- new project.
2. Assign name for the project with the extension. dpj
3. Select file-new-assembly file and save it with the extension .asm
4. Type the program and save it.
5. Right click on assembly and select add file to project. Right click on
assembly and add the file micro-50
6. Right click on assembly and select build.
7. Switch on the processor
8. Select serial-load program-ok Select serial –
communication window.
9. Enter the file name in it and obtain the output.

Pseudocode
1. Load the data pointer to 100h
2. Load the auxiliary register0 with address 8000h (first block)
3. Load the auxiliary register1 with address 9000h (second Block)
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

4. Load the auxiliary register2 with count 04


5. Modify the auxiliary register ar1
6. Load the accumulator with data pointed by the pointer and modify to ar0
7. Exchange content of accumulator buffer with buffer
8. Load the accumulator with data pointed by the pointer and modify to ar1
9. Store the lower byte of accumulator in the pointed location and increment and
modify to ar0
10. Load the contents of the accumulator buffer
11. Store the lower byte of accumulator in the pointed location and increment and
modify to ar2
12. Branch to loop if ar2 is not equal to 0 and modify current auxiliary register as ar1
13. End

Program
LABEL PROGRAM COMMENT
Ldp #100h Load the data pointer to 100h
Lar ar0, #8000h Load the auxiliary register0 with address 8000h
(POINTER REGISTER TO POINT ARRAY OF
DATA)
Lar ar1, #9000h Load the auxiliary register1 with address 9000h
(POINT THE SECOND ARRAY)
Lar ar2, #04 Load the auxiliary register with count 04
mar*, ar1 Modify the auxiliary register ar1
loop lacc*, ar0 Load the accumulator with data pointed by the
pointer and modify to ar0
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Exar Exchange content of accumulator with accumulator


Buffer

lacc*, ar1 Load the accumulator with data pointed by the


pointer and modify to ar1
sacl*+, ar0 Store the lower byte of accumulator in the pointed
location and increment and modify to ar0
lacb Load the contents of the accumulator buffer to
accumulator
sacl*+, ar2 Store the lower byte of accumulator in the pointed
location and increment and modify to ar2
banz loop, ar1 Branch to loop if ar2 is not equal to 0 and modify the
current auxiliary register as ar1

L b l End

Output
PI C000
Downloading From Host....
#SD 8000

Substitute Data 8000:5000-01


Substitute Data 8001:0012-01 Substitute Data 8002:3ADA-
01 Substitute Data 8003:0000-01
Micro-50eb Serial Monitor, Ver-2.0 (c)1999, Vi
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Microsystems Pvt. Ltd., Chennai -96


#SD 9000
Substitute Data9000:FFFF-
09 Substitute
Data9001:FFFF-09
Substitute Data 9002:FFFF-
09 Substitute Data
9003:FFFF-09

Micro-50eb Serial Monitor, Ver-2.0 (c)1999, Vi


Microsystems Pvt. Ltd., Chennai -96
#GO C000
Executing....
Micro-50eb Serial Monitor, Ver-2.0 (c)1999, Vi
Microsystems Pvt. Ltd., Chennai -96
#SD 8000
Substitute Data 8000:0009-
Substitute Data 8001:0009-
Substitute Data 8002:0009-
Substitute Data 8003:0009-
Micro-50eb Serial Monitor, Ver-2.0 (c)1999, Vi
Microsystems Pvt. Ltd., Chennai -96
#SD 9000
Substitute Data 9000:0001-
Substitute Data 9001:0001-
Substitute Data 9002:0001-
Substitute Data 9003:0001-
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Industrial Application
In industrial power electronics applications such as motor drives, inverters,
and power converters, exchanging data blocks is crucial for controlling power
flow, voltage regulation, and current sensing.The TMS320C50 can be employed
in data acquisition systems, oscilloscopes, spectrum analyzers, and other test
instruments for exchanging data blocks with high throughput and low latency.
In embedded control systems for industrial machinery, robotics, and
automation equipment, the TMS320C50 can serve as a central processing unit for
exchanging data between sensors, actuators, and control algorithms.
Industrial signal processing applications, such as audio processing, image
processing, and vibration analysis, often involve the exchange of large blocks of
data for real-time analysis and manipulation. Industrial communication systems,
including wired and wireless networks, require efficient data exchange for
transmitting and receiving data packets.
In medical devices for patient monitoring and diagnostics, exchanging
blocks of physiological data (e.g., ECG, EEG) enables real-time analysis for
detecting abnormalities and providing timely feedback to healthcare
professionals.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Result
Thus, the block of data has been exchanged successfully using the DSP Processor
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment
no:6 Implementation Of Linear Convolution

Aim
To write an assembly language program to perform linear convolution of two
sequence using TMS320C50 DSP processor.
Mapping with theory
Linear convolution is a fundamental operation in digital signal processing used to
determine the output of a Linear Time-Invariant (LTI) system when the input signal
and the system's impulse response are known.A DSP processor efficiently implements
convolution due to its specialized architecture, including hardware multipliers,
accumulators, and support for addressing modes like circular buffering and pipelining.
Implementation in DSP Processors
DSP processors perform convolution using:
1. Multiply-and-Accumulate (MAC):
o Multiply elements of x[n] and h[n] and accumulate the result.
2. Efficient Addressing Modes:
o Use circular buffering to handle wrap-around for input/output buffers.
3. Pipelining:
o Perform multiple operations simultaneously for faster execution.

Apparatus required
 PC with C50 Debugger
 TMS320C50 Trainer Kit.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Pseudo Code
1. Load data pointer with address data #100h
2. Load auxiliary register ar0 with h(n) data with starting address 8100h
3. Load auxillary register ar1for output data y(n) from 8050h
4. Load auxillary register ar4with the length of output sequence. (n1+n2-1)
5. Load auxillary register ar3 with x(n) data with starting address 800fh
6. Load accumulator with program memory c100h
7. Modify the auxillary register to point to ar3
8. Repeat next instruction (5+1) times as a specified byte data #05
9. The contents of data memory address 800fh-8013h are moved to program
memory address c100h-c104h
10. Load auxillary register ar0.Actual data starts at 8104h
11. Clear the accumulator and product register as zero
12. Modify Auxillary register to point to ar0
13. Repeat the next instruction (5+1) times as a specified byte of data #05h
14. The PREG content is added to accumulator. The content of program memory
address and data memory address is multiplied and product is loaded in PREG
and the program memory address is incremented and data memory address is
decremented
15. Modify auxillary register to point to ar1
16. Store lower order byte of accumulator in memory location pointed by ar1.
Increment ar1 and modify pointer to ar0. ar0=ar0+7
17. Modify auxillary register to point to ar4
18. Branch on accumulator ar4 not zero to loop
19. Indefinite loop
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Program
LABEL PROGRAM COMMENT
ldp #100h Load data pointer with address data #100h
lar ar0,#8100h Load auxillary register ar0 with h(n) data with
starting address 8100h
lar ar1,#8050h Load auxillary register ar1for output data y(n)
from 8050h
lar ar4,#0007h Load auxillary register ar4with the length of
output sequence.(n1+n2-1)
lar ar3,#800fh Load auxillary register ar3 with x(n) data with
starting address 800fh
lacc #0c100h Load accumulator with program memory c100h
mar*,ar3 Modify the auxillary register to point to ar3
rpt #05h Repeat next instruction (5+1) times as a specified
byte data #05
tblw*+ The contents of data memory address 800fh-
8013h are moved to program memory address
c100h-c104h
lar ar0,#8104h Load auxillary register ar0.Actual data starts at
8104h
Loop zap Clear the accumulator and product register as zero
mar*,ar0 Modify Auxillary register to point to ar0
rpt #05h Repeat the next instruction (5+1) times as a
specified byte of data #05h
mac 0c100,*- The PREG content is added to accumulator. The
content of program memory address and data
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

memory address is multiplied and product is


loaded in PREG and the program memory address
is incremented and data memory address is
decremented
mar*,ar1 Modify auxillary register to point to ar1
sacl* +,ar0 Store lower order byte of accumulator in memory
location pointed by ar1. Increment ar1 and modify
pointer to ar0.
adrk #07h ar0=ar0+7
mar*,ar4 Modify auxillary register to point to ar4
Banz loop Branch on accumulator ar4 not zero to loop
L b l Indefinite loop

Output
PI C000
Downloading From Host....
#SD 8100
Substitute Data 8100:0000-
Substitute Data 8101:0000-
Substitute Data 8102:0000-
Substitute Data 8103:0000-
Substitute Data 8104:0003-
Substitute Data 8105:0004-
Substitute Data 8106:0005-
Substitute Data 8107:0000-
Substitute Data 8108:0000-
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Substitute Data 8109:0000-


Substitute Data 810A:0000-
Micro-50eb Serial Monitor, Ver-2.0
(c)1999, Vi Microsystems Pvt. Ltd., Chennai -96
#SD 800F
Substitute Data 800F:0001-
Substitute Data 8010:0002-
Substitute Data 8011:0003-
Substitute Data 8012:0002-
Substitute Data 8013:0001-
Substitute Data 8014:998C-
Micro-50eb Serial Monitor, Ver-2.0
(c)1999, Vi Microsystems Pvt. Ltd., Chennai -96
#GO C000
Executing....
Micro-50eb Serial Monitor, Ver-2.0
(c)1999, Vi Microsystems Pvt. Ltd., Chennai -96
#SD 8050
Substitute Data 8050:0003-
Substitute Data 8051:000A-
Substitute Data 8052:0016-
Substitute Data 8053:001C-
Substitute Data 8054:001A-
Substitute Data 8055:000E-
Substitute Data 8056:0005-
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Procedure
1. Open C50 Debugger, select project- new project.
2. Assign name for the project with the extension. dpj
3. Select file-new-assembly file and save it with the extension .asm
4. Type the program and save it.
5. Right click on assembly and select add file to project. Right click on assembly
and add file micro-50
6. Right click on assembly and select build.
7. Select serial- open port1-ok. this connects the processor to the port.
8. Switch on the processor
9. Select serial-load program-ok
10. Select serial –communication window.
11. Enter the data in it and obtain the output.

Industrial application
In industrial automation and control systems, linear convolution is used for
filtering and conditioning sensor signals to remove noise, interference, or undesired
components. This ensures accurate and reliable measurement of process variables such
as temperature, pressure, and flow rates.
In telecommunications and networking equipment, linear convolution is
employed for tasks such as channel equalization, error correction coding, and
modulation/demodulation.
Linear convolution is utilized in audio processing applications for tasks like room
impulse response modeling, reverberation effects, and equalization. In industrial
settings such as auditoriums, conference rooms, or recording studios, linear
convolution helps in simulating acoustic environments and enhancing audio quality.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

In medical imaging and diagnostic equipment, linear convolution is used for tasks
such as image filtering, deconvolution, and signal enhancement. It helps in improving
the clarity and resolution of medical images obtained from modalities such as MRI
(Magnetic Resonance Imaging), CT (Computed Tomography), and ultrasound.
Linear convolution is applied in structural health monitoring systems for
analyzing vibration signals from machinery, buildings, bridges, and other structures. It
helps in identifying structural defects, detecting anomalies, and predicting potential
failures based on the characteristics of vibration signals.

Result
Thus, linear convolution of two sequences was performed using DSP
processor.
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Experiment
no:7 Generation of various waveforms

Aim
To generate a sine wave, square wave, Triangular wave and Saw tooth wave using
TMS320C5416XX DSP KIT.
Mapping with theory
Generating waveforms using a DSP processor involves utilizing the computational
power of the processor to compute and output the desired waveform in real-time or
pre-computed samples. The waveforms are essential in signal processing for testing
systems, simulating signals, and driving hardware.
1. Theory of Waveform Generation
Waveforms are mathematical representations of signals over time. Common types
include sinusoidal, square, triangular, and sawtooth waveforms. These can be
generated using algorithms that define the waveform mathematically or through table
lookups.
Types of Waveforms
Sinusoidal Waveform
o Defined by

Where:
 A: Amplitude
 f: Frequency
 T: Sampling period (T=1/fs, fs is the sampling frequency)
 ϕ: Phase offset
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

 n: Discrete time index.


Square Waveform
 Alternates between two amplitude levels.
 Defined by

Triangular Waveform:
 Linearly increases and decreases over a period.
 Typically derived from sawtooth with modifications.
Sawtooth Waveform:
 A ramp signal that resets periodically.
 Defined by:

T0: Period of the waveform.


Apparatus required
 PC with C50 Debugger
 TMS320C50 Trainer Kit.
Pseudocode
Sine wave
START:
// Step 1: Initialize DSP processor and configure necessary registers
Initialize DSP registers
Set up stack pointer (if applicable)
Configure output port for DAC connection
Configure timer/interrupt for periodic sampling (sampling frequency)
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

// Step 2: Load sine wave lookup table into memory


Load precomputed sine wave samples into a memory array (SINE_TABLE)
Define TABLE_SIZE = Number of samples in the sine table
Set the DAC output range to match the values in SINE_TABLE
// Step 3: Initialize variables
currentIndex = 0 // Index for accessing sine table
stepSize = (frequency * TABLE_SIZE) / samplingRate
// Determines the increment for table index

MAIN_LOOP:
// Step 4: Read the next sine sample from the lookup table
sineValue = SINE_TABLE[currentIndex]
// Step 5: Output the sine sample to the DAC
Write sineValue to DAC output port
// Step 6: Increment the index for the next sample
currentIndex = currentIndex + stepSize
If currentIndex >= TABLE_SIZE:
currentIndex = currentIndex - TABLE_SIZE // Wrap around to start of
table
// Step 7: Wait for the next sampling period
Wait for interrupt or timer event
// Repeat the loop
Go to MAIN_LOOP
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Square waveform
START:
// Step 1: Initialize DSP processor and configure registers
Set stack pointer to 0x140 (STM #140H, ST0)
Reset the CPL register (RSBX CPL)
Perform stabilization with no-operation instructions (NOP, NOP, NOP, NOP)

MAIN_LOOP:
// Step 2: Toggle DATA value and create a delay
Set DATA to 0x0000 // Clear DATA
Call DELAY subroutine // Introduce a delay
Set DATA to 0x0FFF // Set DATA to maximum value
Call DELAY subroutine // Introduce a delay

// Step 3: Repeat the loop


Go to MAIN_LOOP

DELAY:
// Step 4: Introduce a delay using a counter
Initialize AR1 to 0x0FFF // Set counter (STM #0FFFH, AR1)

DELAY_LOOP:
Output DATA value to port 0x04 (PORTW DATA, 04H)
Decrement AR1 (AR1 = AR1 - 1)
If AR1 is not zero, repeat DELAY_LOOP (BANZ DELAY_LOOP)
Return from the subroutine (RET)
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Triangular wave
BEGIN

// Initialize data storage for waveform value


DATA = "what is this" // Or any appropriate initialization for DATA

// Start of the main execution


LOOP:
// Set the initial value to 0
DATA = 0H // Start with value 0 (lower limit)

// Incrementing phase (Ramp up)


WHILE DATA < 0FFFH:
// Increment the value stored in DATA
DATA = DATA + 1H

// Output the current value (perhaps to a DAC or output port)


OUTPUT(DATA, 04H)

// Decrementing phase (Ramp down)


WHILE DATA > 0H:
// Decrement the value stored in DATA
DATA = DATA - 1H

// Output the current value (perhaps to a DAC or output port)


OUTPUT(DATA, 04H)
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

// Repeat the entire process (create the triangular wave)


GOTO LOOP
END
Sawtooth waveform
BEGIN

// Initialize the value of DATA to 0


DATA = 0H // Store 0 in DATA (start value)

// Initialize the system or control registers (optional)


STM #140H, ST0 // Store the value 140H to the register ST0
RSBX CPL // Subtract the contents of CPL from RSBX (this may be
setting control flags)

// The next four NOP instructions are no-operations (delays or placeholders)


NOP // No operation (do nothing)
NOP
NOP
NOP

// Main loop (REP)


LOOP:
// Store the value 0 in DATA at the start of the loop
DATA = 0H // Reset DATA to 0 at the start of each loop
// Incrementing phase (INC)
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

WHILE DATA < 0FFFH: // Continue incrementing while DATA is less than
0FFFH
// Load DATA into register A
A = DATA
// Increment the value in register A by 1
A = A + 1H
// Store the incremented value back into DATA
DATA = A
// Output the value of DATA to port 04H (simulate hardware output)
OUTPUT(DATA, 04H)
// Compare DATA with 0FFFH
IF DATA == 0FFFH THEN
BREAK // Exit the loop if DATA reaches 0FFFH

END WHILE
// Repeat the main loop (reset and continue the process)
GOTO LOOP
END

Program
Sine waveform
mmreg
.text
START:
STM #140H,ST0
RSBX CPL
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

NOP
NOP
NOP
NOP
REP:
LD #TABLE,A
STM #372,AR1
LOOP:
READA DATA
PORTW DATA,04H
ADD #1H,A
B REP
}
}
Square waveform
DATA .SET 0H
.mmregs
.text
START:
STM #140H,ST0
RSBX CPL ; NOP
NOP
NOP
NOP
REP:
ST #0H,DATA
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

CALL DELAY
ST #0FFFH,DATA
CALL DELAY
B REP
DELAY:
STM #0FFFH,AR1
DEL1:
PORTW DATA,04H
BANZ DEL1,*AR1-
RET
TRIANGULAR WAVE GENERATION
DATA .SET 0H
.mmregs
.text
START:
STM #140H,ST0
RSBX CPL
NOP
NOP
NOP
NOP
REP:
ST #0H,DATA
INC:
LD DATA,A
ADD #1H,A
STL A,DATA
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

PORTW DATA,04H
CMPM DATA,#0FFFH
BC INC,NTC
DEC:
LD DATA,A
SUB #1H,A
STL A,DATA
PORTW DATA,04H
CMPM DATA,#0H
BC DEC,NTC
B REP

SAWTOOTH WAVE GENERATION


DATA .SET 0H
.mmregs
.text
START:
STM #140H,ST0
RSBX CPL
NOP
NOP
NOP
NOP
REP:
ST #0H,DATA
INC:
LD DATA,A
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

ADD #1H,A
STL A,DATA
PORTW DATA,04H
CMPM DATA,#0FFFH
BC INC,NTC
B REP

Procedure
1. Open C50 Debugger, select project- new project.
2. Assign name for the project with the extension. dpj
3. Select file-new-assembly file and save it with the extension .asm
4. Type the program and save it.
5. Right click on assembly and select add file to project. Right click on assembly
and add file micro-50
6. Right click on assembly and select build.
7. Select serial- open port1-ok. this connects the processor to the port.
8. Switch on the processor
9. Select serial-load program-ok
10. Select serial –communication window.
Enter the data in it and obtain the output.

Industrial Applications
Digital Signal Processors (DSPs) are widely used in communication systems for
generating and processing modulated signals like AM, FM, and PM for radio
transmitters and receivers, enabling efficient transmission of data over
communication channels. DSPs are also integral in audio and speech processing
MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

for applications such as voice recognition systems, sound reinforcement, and


telecommunication, where they generate and manipulate waveforms for clear and
intelligible sound output. In control systems, DSPs are employed in Variable
Frequency Drives (VFDs) to precisely control the speed of electric motors, and
in power electronics, they generate PWM signals to regulate the operation of
inverters and power converters in solar energy systems, UPS devices, and other
power conversion applications.
In medical devices, DSPs are essential in generating precise waveforms for
ultrasound imaging, defibrillators, and MRI systems. They are also used in
radar and sonar systems for generating signals that aid in target detection and
distance measurement in both military and marine applications. Furthermore, in
industries such as automotive and aerospace, DSPs are employed in active
vibration control systems to mitigate unwanted vibrations, enhancing safety and
comfort. Additionally, in test and measurement equipment like signal
generators and oscilloscopes, DSPs generate a wide range of waveforms for
electronic testing, ensuring the accurate calibration and operation of circuits and
components.

Viva Question and answers


Question 1: What is waveform generation in the context of DSP?
Answer:
Waveform generation in DSP involves creating specific signal shapes (e.g., sine,
square) using digital techniques, often through algorithms or look-up tables.

Question 2: How does a DSP processor generate a sine wave?


MEENAKSHI SUNDARARAJAN ENGINEERING COLLEGE
(An autonomous Institution)
#363, Arcot Road, Kodambakkam, Chennai – 600024, Tamil Nadu, India

Department: Electronics & Communication Engineering Lab Name: EC3492-DSP laboratory

Answer:
A DSP processor generates a sine wave using a look-up table with precomputed
sine values or by calculating the sine function directly using algorithms like Direct
Digital Synthesis (DDS).

Question 3: What is Direct Digital Synthesis (DDS)?


Answer:
DDS is a method for generating precise waveforms by using a phase accumulator
and a look-up table to produce signals with adjustable frequency and phase.

Question 4: What are the advantages of using DSP processors for waveform
generation over analog methods?
Answer:
DSP processors offer better precision, flexibility, ease of frequency control, and the
ability to generate complex waveforms without the need for analog components.

Result
Thus, the Sine wave, Square, Triangular and Saw tooth waveform was
generated displayed at graph.

You might also like