Search This Blog

Moving Average Filter in MATLAB | DSP

Prerequisite:
Random sequence Generation in MATLAB | Part 1


Code:

clc
clear all
close all
t=0:0.11:20;
x=sin(t);
n=randn(1,length(t));
x=x+n;
a=input('Enter the no.:');
t2=ones(1,a);
num=(1/a)*t2;
den=[1];
y=filter(num,den,x);
plot(x,'b');
hold on;
plot(y,'r','linewidth',2);
legend('Noisy signal','Filtered signal');



No comments

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();