Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

downsample

Decrease sampling rate by integer factor

Syntax

y = downsample(x,n)
y = downsample(x,n,phase)

Description

y = downsample(x,n) decreases the sampling rate of x by keeping every nth sample starting with the first sample. x can be a vector or a matrix. If x is a matrix, each column is considered a separate sequence.

y = downsample(x,n,phase) specifies the number of samples by which to offset the downsampled sequence. phase must be an integer from 0 to n – 1.

Examples

collapse all

Decrease the sampling rate of a sequence by 3.

x = [1 2 3 4 5 6 7 8 9 10];
y = downsample(x,3)
y =

     1     4     7    10

Decrease the sampling rate of the sequence by 3 and add a phase offset of 2.

y = downsample(x,3,2)
y =

     3     6     9

Decrease the sampling rate of a matrix by 3.

x = [1  2  3;
     4  5  6;
     7  8  9;
    10 11 12];
y = downsample(x,3)
y =

     1     2     3
    10    11    12

Introduced before R2006a


Was this topic helpful?