Name: Moving Average Filter Rating: Figure 1. Manual Solving of Impulse Response
Name: Moving Average Filter Rating: Figure 1. Manual Solving of Impulse Response
Date:
12 October 2021
PreLab Assignment
1. Manually compute the impulse response of the system described
by the difference equation 𝑦(𝑛)=13[𝑥(𝑛)+𝑥(𝑛−1)+𝑥(𝑛−2)]
The impulse response is the output y(n) if the input x(n) is a
unit sample or x(n)={0,1,0}. Call the input response h(n).
the system
1
y (n)= [x (n)+ x (n−1)+ x (n−2)+ x(n−3)]
4
S1 (frequency = 500Hz)
S2 (frequency = 10kHz)
clear all;
close all;
clc;
%Description:This activity will plot the input and output
signals of the system
%[𝑛]=sin (0.2𝜋𝑛)+sin (0.8𝜋𝑛) and
%()=1/4[𝑥(𝑛)+𝑥(𝑛−1)+𝑥(𝑛−2)+𝑥(𝑛−3)]
n=1:50;
%input signal
x1=sin(0.2*pi*n);
x2=sin(0.8*pi*n);
x3=x1+x2;
subplot(1,3,2) ;
stem(x2) ;
title('x2 f=0.4')
subplot(1,3,3) ;
stem(x3);
title('x3= x1 + x2 f=0.1 and 0.4')
% outputs
subplot(1,3,2) ;
stem(y2);
title('y2')
subplot(1,3,3)
stem(y3)
title('y3')
2. GNU Radio Flowgraph for Problem
It can be observe in the graph the the outputs y1,y2 and y3 are
attenuated compared to its inputs. The output y1 was attenuated. The
amplitude was reduced from 1 to less than 0.8.Likewise, y2 the
amplitude was decreased from 1 to less than 0.3.For y3,the plot was
a bit similar to x1.The input x2 was filtered out since it was
blocked by the low pass filter because it has a higher frequency
than x1, allowing x1 to pass.
2. Interpretation of Result 2
Comapring Signal 1(Figure 8) to Signal 2(Figure 9), the output of
the signal two has greatly attenuated with higher frequency, the
amplitude was decreased from 1 to less than 0.2. MAV Filter takes M
samples of input at a time and takes the average of those to produce
a single output point.It also improved the waveform of the outputs.
Extra Credit
Look for and download the daily new covid cases in Misamis
Occidental from the last 3 months and call this x(n). Apply a 7-day
MAV filter and call the output y(n). Plot both x(n) and y(n) and
comment what information can you get from the filtered data y(n)
which you cannot easily spot from the raw data x(n).
Code:
%*******************************************************************
%La Salle University
%ECEng313 Signals, Spectra and Signal Processing Laboratory
%Student Name : Ron Resma
%Activity 5
%Due Date : 26 October 2021
%Written on Octave Ver 6.2.0
%*******************************************************************
clear all;
close all;
clc;
% Source of data :
https://datastudio.google.com/u/0/reporting/617bd18b-6c71-49eca1b1-
74276e58d570/page/8HaNB?s=kVqCOvBiBj0
y = array(:, 2);
% output y(n)
y1 = conv(y,h);
%Plot
plot(x,y,y1);
legend('Cases','7-Day Moving Average')
title('Misamis Occidental COVID-19 Cases')
xlabel('August 1 - October 31')
ylabel('Covid Cases')
grid on
Observation:
Figure 10. Daily Covid cases in Misamis Occidental applied with MAV Filter
Conclusion:
RATING
Criteria Score
Ability to prepare a well
written report
Ability to write a
computer code
Ability to interpret the
results correctly