downsample

Downsample a signal.

Syntax

output = downsample(x,n)

output = downsample(x,n,p)

Inputs

x
The signal to be downsampled. If x is a matrix, then each column is downsampled.
Type: double
Dimension: vector | matrix
n
The downsample period. Every nth sample is retained.
Type: integer
Dimension: scalar
p
The offset to the first sample retained, within the period length.
Type: integer
Dimension: scalar

Outputs

output
The re-sampled signal.

Examples

Example with the default phase:

output = downsample([1 2 3 4 5],2)
output = [Matrix] 1 x 3
1  3  5

Example with the specified phase:

output = downsample([1 2 3 4 5],2,1)
output = [Matrix] 1 x 2
2  4