Lab Manual # 04 Linear Convolution Objective: Description:: College of Electrical & Mechanical Engineering, NUST
Lab Manual # 04 Linear Convolution Objective: Description:: College of Electrical & Mechanical Engineering, NUST
Lab Manual # 04
Linear Convolution
Objective:
To study linear convolution with and without using built in function.
Description:
The MATLAB Signal Processing Toolbox is required.
This section will contain material to help students successfully conduct the experiment. It
may contain the list of experimental steps that the students will have to go through for
successful experimentation. It can guide students on common pitfalls and points to note.
Linear Convolution:
Convolution is an operation between the input signal to a system, and its impulse response,
resulting in the output signal.
In discrete time, convolution of two signals involves summing the product of the two signals,
where one of the signals is “flipped and shifted”. It doesn't matter which signal is flipped and
shifted. Have to take care to get limits of sum correct. Convolution Sum is given by:
Step I:-
Step II:-
Determine h[n-k] with the smallest n that prevents any overlap between x[k] and h[n-k].
First we reflect h[k] about k=0 to obtain h[-k].
Note that x-axis has been extended on the left to include a few additional points. These will
be useful later.
Second we shift h[-k] by –n. This result in h[n-k] and is equivalent to shifting h[-k] towards
the left side by n. We begin with large and negative value of n such that there is no overlap
between the non-zero values of the two signals.
Shift h[n-k] by 1.
The sum of product is 2(1)+4(1)+8(1)=14. Output y[n] is 14 for n-3 and is shown in figure
below.
And so on….
Since h[n-k] do not overlap with x[n] then the convolution sum is now 0 for n>3.
Final Result
Moving Average:
Moving average is a simple operation used usually to suppress noise of a signal: As the name
implies, the moving average filter operates by averaging a number of points from the input
signal to produce each point in the output signal. In equation form, this is written:
Where x[ ] is the input signal, y[ ] is the output signal, and M is the number of points in the
average. For example, in a 5-point moving average filter, point 80 in the output signal is
given by:
As an alternative, the group of points from the input signal can be chosen symmetrically
around the output point:
As first approach, let us try what we get by convolving the x signal by the following k kernel:
>> x = [1 7 1 4 4 7 1];
>> k = [1 1 1];
>> y = conv(x, k, 'same')
y=
8 9 12 9 15 12 8
The output is exactly three times larger than the expected. It can be also seen, that the output
values are the summary of the three elements in the window. It is because during convolution
the window is slid along, all of the elements in it are multiplied by one and then summarized:
But would not it be optimal to do the division during convolution? Here comes the idea by
rearranging the equation:
Q1 Q2
a b a b
4 1 4 1