% Kevin Brenon
% EE 483
% Project 3
% October 9, 2001

% This is the function linfilt.  It is used to evaluate the output of a linear filter.

function [y,ty]=linfilt(h,th,x,tx);

Dtx=tx(2)-tx(1);	%We find the time spacing for the input x.
Dth=th(2)-th(1);	%We find the time spacing for the impulse response h.
if abs(Dtx-Dth)>1e-5;
   error('ERROR: Time spacings are not equal!\n')
else
   ly=length(x)+length(h)-1;	%We get the length of the response vector.
   %We find the lower time limit of x.
   tx0=tx(1);
   %We find the lower time limit of h.
   th0=th(1);
   %We calculate the lower time limit of y.
   ty0=tx0+th0;
   Dty=Dtx;	%We find the time spacing for y.
   ty=[ty0:Dty:ty0+Dty*(ly-1)];	%We set the time axis for y.
   y=conv(h,x);	%And we calculate y.
   y=y/100;
end
