LTPDA Toolbox™ | contents | ![]() ![]() |
The ao class has a method for interpolating data using different forms of interpolation. This method is called ao/interp.
To configure ao/interp, use the following parameters:
Key | Description |
---|---|
VERTICES |
A new set of vertices (relative to the t0) on which to resample. |
METHOD |
The method by which to interpolate. Choose from
|
Here we will interpolate a sinusoid singal on to a new time-grid. The result will be to increase the sample rate by a factor 2.
First we create a time-series ao:
pl = plist('Name', 'None', 'tsfcn','sin(2*pi*1.733*t)','fs',20,'nsecs',10,'yunits','V'); x = ao(pl);
Then we create the new time-grid we want to resample on to.
tt = linspace(0, x.nsecs - 1/x.fs, 2*(x.len));
And finally we can apply our new time-grid to the data using interp. We test two of the available interpolation methods:
pl_spline = plist('vertices',tt); pl_nearest = plist('vertices',tt,'method','nearest'); x_spline = interp(x,pl_spline); x_nearest = interp(x,pl_nearest); iplot(x, x_spline, x_nearest, plist('Markers', {'o', '+', 'x'}, ... 'LineColors', {'k', 'r', 'g'}, ... 'XRanges', [0 1]));
To do the same activity on the workbench, we can use a pipeline like:
This teaches some important aspects of the use of the workbench, so it's worth stepping through its construction slowly.
To build this pipeline:
To add inputs (or outputs) to a block, right-click on the block and choose "Add input". |
Double-click an LTPDA Block to get a dialog box to enter a new name for the block. |
To set the color of the pipes eminating from a particular block, right-click on the block and choose "Set output pipe color" from the context menu. You can also set the color of individual pipes by right-clicking on a pipe and choosing "Set color" from the context menu. |
The single quotes around the TSFCN value are not strictly necessary, but it can avoid problems, for example in the case you have a variable t already defined in the MATLAB workspace. |
![]() |
Resampling a time-series AO | Remove trends from a time-series AO | ![]() |
©LTP Team