Interpolating data


Interpolation of data can be done in the LTPDA Toolbox by means of interp. This function interpolates the values in the input AO(s) at new values specified by the input parameter list. Interp overloads interp1 function of Matlab Signal Processing Toolbox for AOs.

Syntaxis

	b = interpolate(a, pl)
  

With the following parameters:

For details see interp1 help of Matlab.

Examples

1. Interpolation of a sequence of random data at original sampling rate of 1 Hz by a factor of 10 with no initial phase.

	% Signal generation
	nsecs = 100;
	fs    = 10;

	pl = plist();
	pl = append(pl, param('nsecs', nsecs));
	pl = append(pl, param('fs', fs));
	pl = append(pl, param('tsfcn', 'sin(2*pi*1.733*t)'));
	a1 = ao(pl);

        % Interpolate on a new time vector
	t = linspace(0, a1.data.nsecs - 1/a1.data.fs, 2*len(a1));

	plspline = plist();
	plspline = append(plspline, param('vertices', t));
	
	plnearest = plist();
	plnearest = append(plnearest, param('vertices', t));
	plnearest = append(plnearest, param('method', 'nearest')); 

	bspline = interp(a1, plspline);
	bnearest = interp(a1, plnearest);

	iplot([a1 bspline bnearest], plist('Markers', {'x', 'o', '+'}, 'LineColors', {'k', 'r'}));
	ltpda_xaxis(0, 1)
  
Interpolate




©LTP Team