Nandana Badami
unread,Jan 10, 2014, 4:13:08 PM1/10/14You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi.
I am trying to understand how MATLAB implements the decimate function.
In looking at decimate.m, I find that when the "fir" option is specified, an FIR filter of order 30 and with cut off frequency 1/r is designed, where r is the decimation factor.
However, before fir filtering is performed, there are a couple of lines of code, and I am not sure what they are for:
b = fir1(nfilt,1/r);
% prepend sequence with mirror image of first points so that transients
% can be eliminated. then do same thing at right end of data sequence.
nfilt = nfilt+1;
itemp = 2*idata(1) - idata((nfilt+1):-1:2);
[itemp,zi]=filter(b,1,itemp); %#ok
[odata,zf] = filter(b,1,idata,zi);
if m == 1 % row data
itemp = zeros(1,2*nfilt);
else % column data
itemp = zeros(2*nfilt,1);
end
itemp(:) = 2*idata(nd)-idata((nd-1):-1:(nd-2*nfilt));
itemp = filter(b,1,itemp,zf);
Any idea what this is done for?
Thanks,
Nandana