MOVING AVERAGE FILTER
t=0:.01:1;
f=5;
y=sin(2*pi*f*t);
%Generation of random signal
g=0.5*randn(size(t));
z=g+y;
N=10; %order required
b=1/N*(ones(1,N));
x=filter(b,1,z); %filters noice
subplot(3,1,1);
plot(t,y);
ylabel('pure signal');
subplot(3,1,2);
plot(t,z);
ylabel('noise buried');
subplot(3,1,3);
plot(t,x);
ylabel('filtered signal');
xlabel('Time in seconds');
0 comments:
Post a Comment