resampling irregularly sampled data

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

resampling irregularly sampled data

Przemek Klosowski-7
In Matlab the recommended method to resample irregularly sampled input data is:
[y, Ty] = resample(x,irregTx,desiredFs);
but Octave signal package's resample() function only handles already regularly sampled data:
error: resample.m: p and q must be positive integers
Is  resample() function worthy to be made Matlab-compatible here?

I don't think interp1 is the right approach because it just interpolates between nearest points instead of taking into account all points in the 'regularized' interval.

I got a working result by integrating within regular intervals:

 dateEven=0:.1:25;
 j=1; for i=dateEven; dataEven(j++)=sum(data(find((date>=i) & (date<i+.1)))); end

but is there a simpler and/or vectorized approach?


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: resampling irregularly sampled data

NJank
On Fri, Jun 23, 2017 at 10:14 AM, Przemek Klosowski <[hidden email]> wrote:
>
> In Matlab the recommended method to resample irregularly sampled input data is:
>
> [y, Ty] = resample(x,irregTx,desiredFs);

Yet another case of something I do regularly (with interp1) having a built in solution for years and I never new it.
 
>
> I don't think interp1 is the right approach because it just interpolates between nearest points instead of taking into account all points in the 'regularized' interval.
>
From the Matlab resample documentation [1], it appears using interp1 would emulate one of the resample forms:

"y = resample(x,tx) resamples the values, x, of a signal sampled at the instants specified in vector tx. The function interpolates x linearly onto a vector of uniformly spaced instants with the same endpoints and number of samples as tx. NaNs are treated as missing data and are ignored."

from the octave help for resample, it looks like it only implements the first two ( resample(x,p,q) and resample(x,p,q,h) ) or maybe 3 of the 10 or so different forms handled by the Matlab function.

It appears that the Matlab documentation does describe the type of filters that would be used by the other options.  At the bottom under Algorithm it states:

"resample performs an FIR design using firls, normalizes the result to account for the processing gain of the window, and then implements a rate change using upfirdn."

An improved firls is currently under development [2].  It may be that resample could be implemented that makes use of it.

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Loading...