mafilt1 - end M = length(b); brev = b(M:-1:1); xhat =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function y = mafilt(b,x) % causal Moving Average filter % y = mafilt(b,x) % b is system impulse respose; x is input signal % Make sure x is a column vector: [r c] = size(x); if(c > r) x = x'; end N = length(x); % Make sure b is a row vector -- then reverse it [r c] = size(b); if(r > c) b = b';
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end M = length(b); brev = b(M:-1:1); xhat = zeros(N+M-1,1); xhat(M:(N+M-1)) = x; y = zeros(N,1); for n=1:N, y(n) = brev * xhat(n:(n+M-1)); end avgdata= mafilt( data.date,data.Tp); plot(data.Tp,'Color',[0.8 0.8 0.8],'LineWidth',2); hold on; plot(avgdata,'k'); return...
View Full Document

This note was uploaded on 11/01/2011 for the course ANTHRO 5 taught by Professor Gaulin during the Spring '11 term at San Diego.

Ask a homework question - tutors are online