Documentation for interplin (SPASS).

Real and complex linear interpolation


Description

The function interplin interpolates a signal at some given times. In the case of a real signal, usual linear interpolation is used. A warning is issued if the interpolation times are out of the range of the input times. In the case of a complex signal, interpolation in the complex plane or separate interpolation of the modulus and the phase are proposed.

Usage

a = interplin(adat,tdat,t)
a = interplin(adat,tdat,t,'zplane')
a = interplin(adat,tdat,t,'absangle')

Arguments

adat Input amplitudes. Vector.
tdat Input times. Vector.
t Ouput times. Vector.
rule Rule used for complex linear interpolation. String among 'zplane' and 'absangle'. Optional, default='zplane'.

Values

a Output amplitudes. Vector.

Example

% Creation of a uniform signal

f = 1;
tdat = [0 2 5 7 10]; % input times
adat = sin(f*tdat); % input amplitudes
t = [1 4 7 9];

a = interplin(adat,tdat,t);

% Plotting the result

figure(1)
plot(tdat,adat,'-*',t,a,'*r');
% For times out of range

tout = [0 5 11];
aout = interplin(adat,tdat,tout);

% For complex data

f = .1;
tdat = [0 2 5 7 10 15 20]; % input times
zdat = exp(-f*tdat).*exp(4*j*f*tdat); % input amplitudes
tplot=0:.01:20;
zplot = exp(-f*tplot).*exp(4*j*f*tplot); % input amplitudes
t = [1 4 7 9 12 18];

z = interplin(zdat,tdat,t,'zplane');
zz = interplin(zdat,tdat,t,'absangle');

% Plotting the result

figure(2)
plot(real(zplot),imag(zplot),'-k',real(zdat),imag(zdat),'-*b', ...
     real(z),imag(z),'-*r',real(zz),imag(zz),'-*g');