% eda10_02
% example of linear interpolation

% unevenly samples times
t = [0.01, 0.11, 0.24, 0.38, 0.42, 0.57, 0.62, 0.77, 0.81, 0.91, 0.99]';
N=length(t);

% simple function
f0=2;
c=2;
d = sin(2*pi*f0*t).*exp(-c*t);
d = t/2 + [0.1, -0.1, 0.1, -0.1, 0.1, -0.1, 0.1, -0.1, 0.1, -0.1, 0.1]';

% plot simple function
figure(1);
clf;
axis([0, 1, -5, 5]);
hold on;
set(gca,'LineWidth',2);
plot(t,d,'ko','LineWidth',2);

% evaluate at equally-spaced values of t
Np=101;
tp = 0.01*[0:Np-1]';

% linear interpolation
dp=interp1(t,d,tp);

% plot simple function
plot(tp,dp,'k-','LineWidth',2);

