resample               package:signal               R Documentation

_C_h_a_n_g_e _t_h_e _s_a_m_p_l_i_n_g _r_a_t_e _o_f _a _s_i_g_n_a_l

_D_e_s_c_r_i_p_t_i_o_n:

     Resample using bandlimited interpolation.

_U_s_a_g_e:

     resample(x, p, q = 1, d = 5)

_A_r_g_u_m_e_n_t_s:

       x: signal to be resampled. 

    p, q: 'p/q' specifies the factor to resample by. 

       d: distance. 

_D_e_t_a_i_l_s:

     Note that 'p' and 'q' do not need to be integers since this
     routine does not use a polyphase rate change algorithm, but
     instead uses bandlimited interpolation, wherein the continous time
     signal is estimated by summing the sinc functions of the nearest
     neighbouring points up to distance 'd'.

     Note that resample computes all samples up to but not including
     time n+1. If you are increasing the sample rate, this means that
     it will generate samples beyond the end of the time range of the
     original signal. That is why xf must goes all the way to 10.95 in
     the example below.

_V_a_l_u_e:

     The resampled signal, an array of length 'ceiling(length(x) * p /
     q)'.

_A_u_t_h_o_r(_s):

     Original Octave version by Paul Kienzle pkienzle@user.sf.net.
     Conversion to R by Tom Short.

_R_e_f_e_r_e_n_c_e_s:

     J. O. Smith and P. Gossett (1984). A flexible sampling-rate
     conversion method. In ICASSP-84, Volume II, pp. 19.4.1-19.4.2. 
     New York: IEEE Press.

     <URL: http://www-ccrma.stanford.edu/~jos/resample/>

     Octave Forge <URL: http://octave.sf.net>

_S_e_e _A_l_s_o:

     'filter', 'decimate', 'interp'

_E_x_a_m_p_l_e_s:

     xf=seq(0,10.95,by=0.05); yf = sin(2*pi*xf/5)
     xp=0:10;      yp = sin(2*pi*xp/5)
     r = resample(yp,xp[2],xf[2])
     title("confirm that the resampled function matches the original")
     plot(xf,yf, type = "l", col = "blue")
     lines(xf, r[1:length(xf)], col = "red")
     points(xp,yp, pch = 19, col = "blue")
     legend("bottomleft", c("Original", "Resample", "Data"),
            col = c("blue", "red", "blue"),
            pch = c(NA, NA, 19),
            lty = c(1, 1, NA), bty = "n")

