3.66667

3.7 | 3 ratings Rate this file 19 Downloads (last 30 days) File Size: 2.83 KB File ID: #9094
image thumbnail

resampleX

by

 

19 Nov 2005 (Updated )

Resample time series

| Watch this File

File Information
Description

Resamples X(n). Y(n) = X(alpha*n), where alpha is a resample interval. For example, if X is data sampled at 1000 samples per second and you would like to transform it to the equivalent of 1100 samples per second use alpha= 1000/1100 (.9091); for 800 sample per second use alpha = 1000/800 (1.25).

ResampleX is similar to the MATLAB "resample" function (in the SignalProcesscing Toolbox). For most applications resampleX is much faster.

MATLAB release MATLAB 7.0.4 (R14SP2)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
28 Apr 2010 mahmoud  
05 Oct 2006 D M

When I run resampleX(x,1) I don't get x back. Something seems wrong here ...

12 Mar 2006 Bill Winter

Line 94: m = round((0:(N2-1))/alpha) - (0:(N2-1));

You're essentially doing a nearest neighbor interpolation. You've upsampled the data by your factor of 'r,' but I believe that it's perfectly equivalent to running the command resample(X,r,r/alpha,0). Taking this into account, resampleX loses its speed advantage.

I do appreciate the fact that to run resample, r must be chosen to make r/alpha an integer. An exotic alpha could necessitate an enormous r to work in resample.

Updates
05 Dec 2005

Changes incorporate comments and sugestions made two users. Changes are summarized in the comments included in the new m file.

08 Dec 2005

A user found a minor bug. The update has a fix, which improves the accuracy slightly.
Also, please note that there is a new screenshot, consistent with this new version.

23 Oct 2006

User commented that resampleX(x,1) did not return exatly x. The problem was tracked down and fixed. See comments in m file.

Contact us