[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: data resampling



Hi J,
   downsample(.) just picks out every nth sample (300th in your case). Though visually it may look like it worked well, it is quite likely that some of the high frequency portions of the signal are now aliased into the low frequency portions.

resample(.) and decimate(.) guard against this aliasing by filtering first.. But filtering would cause artifacts at the edges of your signal as you don't have the input for infinite past (or in your FIR case, enough samples that you don't care about, for your filter transients to die out) . However the middle portions should be properly filtered and decimated. So if you throw out the first few samples (technically, the length of the filter used) and the last few sample, the rest should match reasonably with what you have in mind. This is not a problem with the software implementations but rather is a fundamental limitation of filtering and time-frequency uncertainty. If you care about those first few seconds, your input should include additional/extra samples at the beginning and end that you don't care about that would absorb the filter transients. 

I would recommend consulting a signal processing text book for more elaborations on these issues (I.e, aliasing, filter design, resampling etc.).
Briefly, these might help:
http://en.m.wikipedia.org/wiki/Anti-aliasing_filter
https://ccrma.stanford.edu/~jos/fp/Transient_Response_Steady_State.html
The help for resample(.) talks about what kind of filter is employed: http://www.mathworks.com/help/signal/ref/resample.html


Hari 

> On Aug 13, 2014, at 7:05 PM, Juan Wu <wujuan22@xxxxxxxxx> wrote:
> 
> List experts,
> 
> I am attempting to down sample my data from 300 Hz to 1 Hz. I just tried two functions of Matlab: 1) a = resample(Data,1,300); 2) b = downsample(Data,300). The results are quite different between each others. 
> 
> <image.png>
> 
> Apparently, the result from "downsampled" is close to the the original data. However, quite a few persons suggested using the re-sampling method - I get this information from google searching, and very agree with this view. Personally I think the downsample method is too simple and very arbitrary. I also do not believe the "Nearest Neighbor" method. I assume that the method resampling takes both "FIR interpolator and decimator" implementation - this is what I expected. Am I right?  But now my output from the re-sampling method is really very terrible. So I assume that the resample function from Matlab does not do a good job for this. I am not sure whether I need change to use other softwares or try other functions in the Matlab. 
> 
> Any opinions or references are much appreciated.
> J


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.