Downsample reduces the sampling rate of the input AOs by an integer factor, which can be very useful for example to reduce data load.

Example 1

With the following parameters:

Examples

1. Downsampling a sequence of random data at original sampling rate of 10 Hz by a factor of 4 (fsout = 2.5 Hz) and no offset.

pl = plist('tsfcn', 'randn(size(t))','fs',10,'yunits','m');  % create an AO of random data with fs = 10 Hz
x = ao(pl); % create AO 
pl_down = plist('factor', 5); % add the decimation factor
x_down = downsample(x, pl_down); % downsample the input AO, x
iplot(x, x_down) % plot original,x, and decimated,x_down, AOs
  
Downsample

2. Downsampling the same AO by a factor of 4 (fsout = 2.5 Hz) and offset = 10.

pl_downoff = plist('factor', 4,'offset',10); % add decimation factor and offset parameter
x_downoff = downsample(x, pl_downoff); % downsample the input AO, x
iplot(x, x_downoff) % plot original,x, and decimated,x_downoff, AOs
  
Downsample