MATLAB Program for Linear Convolution
Linear Convolution:
Convolution
is a formal mathematical operation, just as multiplication, addition, and
integration. Addition takes two numbers and produces a third number, while
convolution takes two signals and produces a third signal. Convolution is used
in the mathematics of many fields, such as probability and statistics. In
linear systems, convolution is used to describe the relationship between three
signals of interest: the input signal, the impulse response, and the output
signal.
If the input and impulse response of a system are x[n]
and h[n] respectively, the convolution is given by the expression,
x[n]
* h[n] = ε x[k] h[n-k]
Where
k ranges between -∞ and ∞
If,
x(n)
is an M- point sequence
h(n) is an N – point sequence
then, y(n) is a (M+N-1) – point sequence.
h(n) is an N – point sequence
then, y(n) is a (M+N-1) – point sequence.
In this equation, x(k), h(n-k) and y(n) represent the
input to and output from the system at time n. Here we could see that one of
the inputs is shifted in time by a value every time it is multiplied with the
other input signal. Linear Convolution is quite often used as a method of
implementing filters of various types.
In mathematics and, in particular, functional analysis,
convolution is a mathematical operation on two functions f and g, producing a
third function that is typically viewed as a modified version of one of the
original functions, giving the area overlap between the two functions as a
function of the amount that one of the original functions is translated.
Convolution is similar to cross-correlation. It has applications that include
probability, statistics, computer vision, natural language processing, image
and signal processing, engineering, and differential equations.
The convolution can be defined for functions on groups
other than Euclidean space. For example, periodic functions, such as the
discrete-time Fourier transform, can be defined on a circle and convolved by
periodic convolution. A discrete convolution can be defined for functions on
the set of integers. Generalizations of convolution have applications in the
field of numerical analysis and numerical linear algebra, and in the design and
implementation of finite impulse response filters in signal processing.
ALGORITHM:
Step 1: Start
Step 2: Read the first sequence
Step 3: Read the second sequence
Step 4: Perform linear or circular convolution for both the sequences using conv() or cconv() function resp.
Step 5: Plot the sequence
Step 6: Display the output sequence
Step 7: Stop
Step 2: Read the first sequence
Step 3: Read the second sequence
Step 4: Perform linear or circular convolution for both the sequences using conv() or cconv() function resp.
Step 5: Plot the sequence
Step 6: Display the output sequence
Step 7: Stop
MATLAB code and Output:
%Linear
Convolution
clc;
clear all;
x=input('Enter
the sequence 1:');
h=input('Enter
the sequence 2:');
y=conv(x,h);
subplot(3,1,1);
stem(x);
ylabel('Amplitude->');
xlabel('N->');
title('Input
sequence x')
subplot(3,1,2);
stem(h);
ylabel('Amplitude->');
xlabel('N->');
title('Input
sequence h')
subplot(3,1,3);
stem(y);
ylabel('Amplitude->');
xlabel('N->');
title(‘linear
Convolution');
Output:
>> convolution_ok
Enter the first sequence - [1 2 3 4]
Enter the second sequence - [4 3 2 1]
y =
4 11
20 30 20
11 4
No comments