DSP Lab 3
DSP Lab 3
LAB # 03
MOVING AVERAGE FILTER AND CONVOLUTION
3.4 Tasks
1. Plot a discrete time real exponential x(n) = 𝑲𝜶𝒏 with K=5 and α= 0.9.
MATLAB Code
n = 0:100;
k = 5;
a = 0.9;
x = k*a.^n;
stem (n,x)
title ('x[n] = ka^n')
xlabel ('n')
ylabel ('Amplitude')
Result:
subplot (3,1,1)
stem(n,s)
title('Original sequence')
xlabel ('n')
ylabel('Amplitude')
%------discrete randone noise---
noise = rand (1, length (n));
Figure 2 Task2 plot of given original sequence, noise and corrupted sequence
3. Apply a moving average filter on a noisy sequence to smoothen a corrupted
sequence.
The Corrupted sequence used is obtained from task 2
%------smoothen signal----------
w = 10;
b= (1/w) *ones (1,w);
a = 1;
smooth = filter (b, a, y);
subplot (3,1,3)
stem (n, smooth)
title( 'Smoothened Signal')
xlabel('n')
ylabel('Amplitude')
Figure 3 Task3 plot of given original sequence, corrupted sequence and smoothen signal
4. Convolve two discrete time sequences x1(n) and x2(n) using conv() command and plot
the output sequence
MATLAB Code