Documentation Center

  • Trial Software
  • Product Updates

Resampling Data at the Command Line

Use resample to decimate and interpolate time-domain iddata objects. You can specify the order of the antialiasing filter as an argument.

    Note:   resample uses the Signal Processing Toolbox™ command, when this toolbox is installed on your computer. If this toolbox is not installed, use idresamp instead. idresamp only lets you specify the filter order, whereas resample also lets you specify filter coefficients and the design parameters of the Kaiser window.

To create a new iddata object datar by resampling data, use the following syntax:

datar = resample(data,P,Q,filter_order)

In this case, P and Q are integers that specify the new sampling interval: the new sampling interval is Q/P times the original one. You can also specify the order of the resampling filter as a fourth argument filter_order, which is an integer (default is 10). For detailed information about resample, see the corresponding reference page.

For example, resample(data,1,Q) results in decimation with the sampling interval modified by a factor Q.

The next example shows how you can increase the sampling rate by a factor of 1.5 and compare the signals:

ur = resample(u,3,2);

When the Signal Processing Toolbox product is not installed, using resample calls idresamp instead.

idresamp uses the following syntax:

datar = idresamp(data,R,filter_order)

In this case, R=Q/P, which means that data is interpolated by a factor P and then decimated by a factor Q. To learn more about idresamp, type help idresamp.

The data.InterSample property of the iddata object is taken into account during resampling (for example, first-order hold or zero-order hold). For more information, see iddata Properties.

Was this topic helpful?