Professional Documents
Culture Documents
Tamayo
ECE31S2
Assignment 5.1 SciLab Programming
I. Short Conceptual Discussion
Moving Average Filter is a response of a system in which it evaluates the average of the current
and previous three input samples from the given set. It is denoted by:
In digital signal processing, the most commonly used filter is the moving average. By averaging,
this lowpass filter has a capability to reduce such effects of the sudden changes and smoothen the
variations of a certain sequence.
Reference:http://www.ee.ic.ac.uk/pcheung/teaching/DE2_EE/Lecture%2011%20Discrete%20Time%20System
s%20(x2).pdf
II. Outputs
Figure 2. Console output for the average of (0,0,0,0,1), average of (0,0,0,1,2) and
average of (9,0,0,0,0)
III. Explanation/ Analysis
For this simulation, it shows the process of a moving average filter of a system. Figure 1 displays the
consecutive average output from the console wherein the x(n) = [1,2,3,4,5,6,7,8,9,0,0,0] since the software
doesn’t compute the succeeding zeros. Next, Figure 2 represents the individual calculations to verify the output
from the Figure 1.
Since the required computation of the system extends until all inputs are zeros, I used the function mave and
for loop as previously discussed. The function mave will be movingave(x,N) where x is the set while the N is any
real number placed by the user. The code has 2 condition statements of for loops where the first condition
denotes the number of samples and inside it lies another condition indicating the value of i starting from n up to
n+N-1. The sumx is the value added per element of the given x(n). Lastly, the cave is the average value where
sumx is divided by N.