主要内容

resample

(Not recommended) Resample time-domain data that is stored in an iddata object by decimation or interpolation (requires Signal Processing Toolbox software)

resample is not recommended. Use idresamp instead to resample estimation data in the form of timetables, numeric matrices, and iddata objects, with or without Signal Processing Toolbox™. For more information, see 版本历史记录.

说明

datar = resample(data,P,Q) resamples the data in data such that the data is interpolated by a factor P and then decimated by a factor Q. For example, the command resample(z,1,Q) results in decimation by a factor Q.

示例

datar = resample(data,P,Q,order) filters the data by applying a filter of specified order before interpolation and decimation.

示例

全部折叠

Increase the sampling rate of data and compare the resampled and the original data signals.

Use idinput to generate an input signal u that contains 2 periods, each containing 20 samples, of a sum-of-sinusoids signal with 5 sinusoids.

u = idinput([20 1 2],'sine',[],[],[5 10 1]);
plot(u)

Figure contains an axes object. The axes object contains an object of type line.

Repackage u into an iddata object ui. Set the start time to 0. A sum-of-sinusoids signal is band limited, so set 'intersample' to 'bl'.

ui = iddata([],u,1,'tstart',0,'intersample','bl');

Resample the data using factors of 25 and 3 for P and Q, respectively. These values produce an increase in sample rate of about 8.3.

ur = resample(ui,25,3);
plot(ui,ur)
legend('ui','ur')

Figure contains an axes object. The axes object with title u1 contains 2 objects of type line. These objects represent ui, ur.

The resampled signal is smoother than the original signal.

输入参数

全部折叠

Original data, specified as an iddata that contains either input/output data or time series data. data must contain uniform time samples.

Resampling factor terms, specified as integers that represent the interpolation and decimation factors. After resampling, the new sample time is Q/P times the original sample time.

Setting (Q/P)>1 results in decimation and setting (Q/P)<1 results in interpolation.

Order of the FIR filter that resample applies before interpolation and decimation, specified as a positive integer.

Output Arguments

全部折叠

Resampled data, returned as an iddata that contains the same type of data as data. The length of the data in datar is equal to P/Q times the length of the data in data.

算法

resample calls the resample (Signal Processing Toolbox) function in Signal Processing Toolbox. The algorithm takes into account the intersample characteristics of the input signal that are described by the data.InterSample property.

If you do not have a license for Signal Processing Toolbox, perform resampling using idresamp.

版本历史记录

在 R2006a 之前推出

全部展开

另请参阅

|