% EXERCISE:     ANALOG RECONSTRUCTION OF A DIGITAL SIGNAL
%
% Program:      interpolate.m
% Written by:   
% For:          EE 311
%               Exercise For EE311/EE312
% Date:         7-16-2001
% Purpose:      To estimate a signal between two samples.
clf reset, hold off, clear all

t0=0;
fs=4000;
t1=1;
t=[t0:1/fs:t1];

x=3*t-t.*t;
t2=pi/4;


%************************************************************************
% Exercise:                                                             *
%                                                                       *
% Suppose that you are given a signal x having a timebase t=[t0:ts:t1]. *
% Design a sequence of MATLAB statements to evaluate x(t2), where       *
% t0<=t2<=t1.  In other words, the row-vector x contains the samples    *
% x(t0), x(t0+ts), x(t0+2*ts) etc.  How do you "interpolate" between    *
% samples to get x(t2), where t2-t0 need not be an integer number of    *
% sampling periods?  This interpolation problem is critical in          *
% reconstructing analog signals from samples. In every CD player, there *
% is such an algorithm.                                                 *
%                                                                       *
% Printout your MATLAB script which does the job.  It must use only the *
% row-vector x, and the values of t0, ts, and t2.  Use the inputs given *
% above to develop this algorithm.                                      *
%                                                                       *
%************************************************************************