Home > NoiseTools > nt_resample_interp.m

# nt_resample_interp

## PURPOSE

y=nt_resample_interp(x,R,method) - resample with arbitrary ratio

## SYNOPSIS

function y=nt_resample_interp(x,R,method);

## DESCRIPTION

     y=nt_resample_interp(x,R,method) - resample with arbitrary ratio

      y: resampled data

      x: data to resample (columnwise)
      R: ratio of new/old sampling rates
      method: method to give to interp1 [default: 'spline']

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

## SOURCE CODE

    0001 function y=nt_resample_interp(x,R,method);
    0002 % y=nt_resample_interp(x,R,method) - resample with arbitrary ratio
    0003 %
    0004 %  y: resampled data
    0005 %
    0006 %  x: data to resample (columnwise)
    0007 %  R: ratio of new/old sampling rates
    0008 %  method: method to give to interp1 [default: 'spline']
    0009 %
    0010
    0011 if nargin<3||isempty(method); method='spline' ; end
    0012
    0013 Xq=(1 : 1/R : size(x,1))';
    0014 y=interp1(1:size(x,1),x,Xq,method);
    0015