home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 2.ddi / MUTOOLS2.DI$ / TERPOLB.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  697 b   |  22 lines

  1. %function [mag,err] = terpolb(fastfre,fastmag,slowfre)
  2. %   interpolates back after complex cepstrum calculation,
  3. %   from the interpolated, regularly spaced data, to the original
  4. %   frequency response data.
  5.  
  6. function [mag,err] = terpolb(fastfre,fastmag,slowfre)
  7.  nptsslo = length(slowfre);
  8.  nptsfst = length(fastfre);
  9.  if fastfre(1)<=slowfre(1) & fastfre(nptsfst)>=slowfre(nptsslo)
  10.    mag = zeros(1,nptsslo);
  11.    for i=1:nptsslo
  12.     p = min(find(fastfre>=slowfre(i)));
  13.     rat = (slowfre(i)-fastfre(p-1))/(fastfre(p)-fastfre(p-1));
  14.     mag(i) = rat*fastmag(p) + (1-rat)*fastmag(p-1);
  15.    end
  16.    err = 0;
  17.  else
  18.   err = -1
  19.  end
  20. %
  21. % Copyright MUSYN INC 1991,  All Rights Reserved
  22.