LTPDA Toolbox | contents | ![]() ![]() |
Resampling is the process of changing the sampling rate of data. Resample changes the sampling rate of the input AOs to the desired output sampling frequency. LTPDA resample overloads resample function of Matlab Signal Processing Toolbox for AOs.
b = resample(a, pl)
With the following parameters:
Examples
1. Resampling a sequence of random data at original sampling rate of 1 Hz at an output sampling of 50 Hz.
x=ao(tsdata(randn(100,1),1)); % create AO of random data with fs = 1 Hz.
pl = plist(); % create an empty parameters list
pl = append(pl, param('fsout', 50)); % add fsout = 50 Hz to parameters list
y = resample(x, pl); % resample the input AO (x) to obtain the resampled output AO (y)
iplot(x, y) % plot original and resampled data
1. Resampling a sequence of random data at original sampling rate of 10 Hz at an output sampling of 1 Hz with a filter defined by the user.
x=ao(tsdata(randn(100,1),10)); % create AO of random data with fs = 10 Hz.
% filter definition plfilter = plist(); % create an empty parameters list for the filter plfilter = append(plfilter, param('type','lowpass')); plfilter = append(plfilter, param('Win', specwin('Kaiser', 10, 150))); plfilter = append(plfilter, param('order', 32)); plfilter = append(plfilter, param('fs', 10)); plfilter = append(plfilter, param('fc', 1)); filter = mfir(plfilter)
% resampling pl = plist(); % create an empty parameters list pl = append(pl, param('fsout', 1)); % add fsout = 50 Hz to parameters list pl = append(pl, param('filter', filter)); % use the defined filter in the resampling process y = resample(x, pl); % resample the input AO (x) to obtain the resampled output AO (y) iplot(x, y) % plot original and resampled data
![]() |
Upsampling data | Interpolating data | ![]() |
©LTP Team