How to filter out data ?
How to filter out data ?
(OP)
I have two columns of data (50,000 points) in an excel file (.CSV) that needs to be filtered down from 20hz to 5hz. How would I go about doing this?
ie I need the data to filtered down to 12500 data points evenly.
ie I need the data to filtered down to 12500 data points evenly.





RE: How to filter out data ?
RE: How to filter out data ?
M
--
Dr Michael F Platten
RE: How to filter out data ?
DECIMATE Resample data at a lower rate after lowpass filtering.
Y = DECIMATE(X,R) resamples the sequence in vector X at 1/R times the
original sample rate. The resulting resampled vector Y is R times
shorter, i.e., LENGTH(Y) = CEIL(LENGTH(X)/R). By default, DECIMATE
filters the data with an 8th order Chebyshev Type I lowpass filter with
cutoff frequency .8*(Fs/2)/R, before resampling.
alternatively you could take a 4-8 point moving average of the data in excel and pick every 4th point. Not too sure what the frequency response of a moving average is, but I don't need to.
Cheers
Greg Locock
SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.
RE: How to filter out data ?
M
--
Dr Michael F Platten
RE: How to filter out data ?
Also, decimate is not accepting 4.5 for R. Is there any way around this (this is to get 20hz down to 8hz)?
RE: How to filter out data ?
- Steve
RE: How to filter out data ?
Yes, vector is matlab speak for a one dimensional array
"Also, decimate is not accepting 4.5 for R. Is there any way around this (this is to get 20hz down to 8hz)?"
That is an odd and unnecessary restriction, they might have done it for speed.
Two ways, (1) roll your own, by filtering and then downsampling or (2) upsample using interp1 to a sampling rate that can be decimated to 8 hz, eg 40 hz. I'd use linear interpolation.
The latter might seem a bit bizarre but since it uses canned routines may be faster than rolling your own.
Cheers
Greg Locock
SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.
RE: How to filter out data ?
RESAMPLE Change the sampling rate of a signal.
Y = RESAMPLE(X,P,Q) resamples the sequence in vector X at P/Q times
the original sample rate using a polyphase implementation. Y is P/Q
times the length of X (or the ceiling of this if P/Q is not an integer).
P and Q must be positive integers.
RESAMPLE applies an anti-aliasing (lowpass) FIR filter to X during the
resampling process, and compensates for the filter's delay. The filter
is designed using FIRLS. RESAMPLE provides an easy-to-use alternative
to UPFIRDN, relieving the user of the need to supply a filter or
compensate for the signal delay introduced by filtering.
In its filtering process, RESAMPLE assumes the samples at times before
and after the given samples in X are equal to zero. Thus large
deviations from zero at the end points of the sequence X can cause
inaccuracies in Y at its end points.
Cheers
Greg Locock
SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.