%function [mag,err] = terpolb(fastfre,fastmag,slowfre)
%   interpolates back after complex cepstrum calculation,
%   from the interpolated, regularly spaced data, to the original
%   frequency response data.

function [mag,err] = terpolb(fastfre,fastmag,slowfre)
 nptsslo = length(slowfre);
 nptsfst = length(fastfre);
 if fastfre(1)<=slowfre(1) & fastfre(nptsfst)>=slowfre(nptsslo)
   mag = zeros(1,nptsslo);
   for i=1:nptsslo
    p = min(find(fastfre>=slowfre(i)));
    rat = (slowfre(i)-fastfre(p-1))/(fastfre(p)-fastfre(p-1));
    mag(i) = rat*fastmag(p) + (1-rat)*fastmag(p-1);
   end
   err = 0;
 else
  err = -1
 end
%
% Copyright MUSYN INC 1991,  All Rights Reserved
