SHARE
TWEET

Untitled

a guest Feb 18th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- a, b список коэффициентов БИХ фильтра. Например фильтр 2 порядка: [a2,a1,a0] [b2,b1,b0]
  2. -- xs отсчеты сигнала
  3. iir :: [Double] -> [Double] -> [Double] -> [Double]
  4. iir a b xs = helper n zeros where
  5.   n = zeros ++ xs -- изначальный сигнал дополненный нулями
  6.   zeros = replicate rank 0.0
  7.   rank = max (length b) (length a) - 1
  8.   helper [] _ = []  -- вспомогательная функция для прохода по всему сигналу
  9.   helper ns mem = next : helper (tail ns) mem' where
  10.    next = sum (zipWith (*) b ns) - sum (zipWith (*) a mem)
  11.    mem' = next : init mem
  12.  
  13. fir = iir []
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top