MATLAB Program for M-point moving average filter
Hi friends, today we are going to learn a how to write a MATLAB program for m point moving averagr filter.
Steps for writing M-point moving average filter program in MATLAB:
- Take a given signal 2n*(0.9)^n and denote it by s(n).
- Then generate a random noise signal having same length (50) as that of s(n) and denote it by d.
- Then add s+d and save it in p, i.e. p=s+d.
- We know that the formula for m point moving average filter is given by
- To determine summation use one for loop.
- Finally divide summation by M, you will get original signal.
The MATLAB program:
clc; clear all; close all; n=1:50; s(n)=2*n.*(0.9).^n; subplot(2,2,1) stem(s) xlabel('Original signal') d=rand(1,50); subplot (2,2,2) stem(d) xlabel('Noise signal') p=s+d; subplot (2,2,3) stem(p) xlabel('Corrupted Signal') m=100; xu=0; for i=1:m d=rand(1,50); x=s+d; xu=xu+x; end xu=xu/m; subplot(2,2,4) stem(xu) xlabel('Output signal')
OUTPUT of M-Point moving average filter :
You may also like:
- Representation of basic discrete time signal using MATLAB.
- Simpson’s 3/8th Rule MATLAB Program example.
- Simpson’s 1/3rd rule MATLAB Program examples.
- MATLAB Programming for Trapezoidal rule with example.
- Addition of two images using MATLAB image processing.
If you like this article, please share it with your friends and like or facebook page for future updates. Subscribe to our newsletter to get notifications about our updates via email. If you have any queries, feel free to ask in the comments section below. Have a nice day!