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.
When I run resampleX(x,1) I don't get x back. Something seems wrong here ...
12 Mar 2006
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.
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.