decimate               package:signal               R Documentation

_D_e_c_i_m_a_t_e _o_r _d_o_w_n_s_a_m_p_l_e _a _s_i_g_n_a_l

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

     Downsample a signal by a factor, using an FIR or IIR filter.

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

     decimate(x, q, n = if (ftype == "iir") 8 else 30, ftype = "iir")

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

       x: signal to be decimated. 

       q: integer factor to downsample by. 

       n: filter order used in the downsampling. 

   ftype: filter type, '"iir"' or '"fir"' 

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

     By default, an order 8 Chebyshev type I filter is used or a
     30-point FIR filter if 'ftype' is 'fir'.  Note that 'q' must be an
     integer for this rate change method.

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

     The decimated signal, an array of length 'ceiling(length(x) / 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:

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

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

     'filter', 'resample', 'interp'

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

     # The signal to decimate starts away from zero, is slowly varying
     # at the start and quickly varying at the end, decimate and plot.
     # Since it starts away from zero, you will see the boundary
     # effects of the antialiasing filter clearly.  You will also see
     # how it follows the curve nicely in the slowly varying early
     # part of the signal, but averages the curve in the quickly
     # varying late part of the signal.
     t = seq(0, 2, by = 0.01)
     x = chirp(t,2,.5,10,'quadratic') + sin(2*pi*t*0.4)
     y = decimate(x,4)   # factor of 4 decimation
     plot(t, x, type = "l")
     lines(t[seq(1,length(t),by = 4)], y, col = "blue")

