fs = 100;
t = 0:1/fs:1;
x = sin(2*pi*t*3)+.25*sin(2*pi*t*40);
%Now create a 10-point averaging FIR filter, and filter x using both filter and
%filtfilt for comparison:
b = ones(1,10)/10; % 10 point averaging filter
y = filtfilt(b,1,x); % Noncausal filtering
yy = filter(b,1,x); % Normal filtering

plot(t,x,'g',t,y,'b',t,yy,'r')
