Copyright | (c) Matthew Donadio 2003 |
---|---|
License | GPL |
Maintainer | m.p.donadio@ieee.org |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
IIR functions
IMPORTANT NOTE:
Except in integrator, we use the convention that
y[n] = sum(k=0..M) b_k*x[n-k] - sum(k=1..N) a_k*y[n-k]
sum(k=0..M) b_k*z^-1
H(z) = ------------------------
1 + sum(k=1..N) a_k*z^-1
- integrator :: Num a => a -> [a] -> [a]
- fos_df1 :: Num a => a -> a -> a -> [a] -> [a]
- fos_df2 :: Num a => a -> a -> a -> [a] -> [a]
- fos_df2t :: Num a => a -> a -> a -> [a] -> [a]
- biquad_df1 :: Num a => a -> a -> a -> a -> a -> [a] -> [a]
- biquad_df2 :: Num a => a -> a -> a -> a -> a -> [a] -> [a]
- biquad_df2t :: Num a => a -> a -> a -> a -> a -> [a] -> [a]
- iir_df1 :: (Num a, Eq a) => (Array Int a, Array Int a) -> [a] -> [a]
- iir_df2 :: Num a => (Array Int a, Array Int a) -> [a] -> [a]
- xt :: [Double]
- yt :: [Double]
- f1 :: Fractional a => [a] -> [a]
- f2 :: Fractional a => [a] -> [a]
- f3 :: Fractional a => [a] -> [a]
- f4 :: [Double] -> [Double]
- f5 :: [Double] -> [Double]
Documentation
:: Num a | |
=> a | a |
-> [a] | x[n] |
-> [a] | y[n] |
This is an integrator when a==1, and a leaky integrator when 0 < a < 1
.
y[n] = a * y[n-1] + x[n]
:: Num a | |
=> a | a_1 |
-> a | b_0 |
-> a | b_1 |
-> [a] | x[n] |
-> [a] | y[n] |
First order section, DF1
v[n] = b0 * x[n] + b1 * x[n-1]
y[n] = v[n] - a1 * y[n-1]
:: Num a | |
=> a | a_1 |
-> a | b_0 |
-> a | b_1 |
-> [a] | x[n] |
-> [a] | y[n] |
First order section, DF2
w[n] = -a1 * w[n-1] + x[n]
y[n] = b0 * w[n] + b1 * w[n-1]
:: Num a | |
=> a | a_1 |
-> a | b_0 |
-> a | b_1 |
-> [a] | x[n] |
-> [a] | y[n] |
First order section, DF2T
v0[n] = b0 * x[n] + v1[n-1]
y[n] = v0[n]
v1[n] = -a1 * y[n] + b1 * x[n]
:: Num a | |
=> a | a_1 |
-> a | a_2 |
-> a | b_0 |
-> a | b_1 |
-> a | b_2 |
-> [a] | x[n] |
-> [a] | y[n] |
Direct Form I for a second order section
v[n] = b0 * x[n] + b1 * x[n-1] + b2 * x[n-2]
y[n] = v[n] - a1 * y[n-1] - a2 * y[n-2]
:: Num a | |
=> a | a_1 |
-> a | a_2 |
-> a | b_0 |
-> a | b_1 |
-> a | b_2 |
-> [a] | x[n] |
-> [a] | y[n] |
Direct Form II for a second order section (biquad)
w[n] = -a1 * w[n-1] - a2 * w[n-2] + x[n]
y[n] = b0 * w[n] + b1 * w[n-1] + b2 * w[n-2]
:: Num a | |
=> a | a_1 |
-> a | a_2 |
-> a | b_0 |
-> a | b_1 |
-> a | b_2 |
-> [a] | x[n] |
-> [a] | y[n] |
Transposed Direct Form II for a second order section
v0[n] = b0 * x[n] + v1[n-1]
y[n] = v0[n]
v1[n] = -a1 * y[n] + b1 * x[n] + v2[n-1]
v2[n] = -a2 * y[n] + b2 * x[n]
Direct Form I IIR
v[n] = sum(k=0..M) b_k*x[n-k]
y[n] = v[n] - sum(k=1..N) a_k*y[n-k]
v[n]
is calculated with fir
Direct Form II IIR
w[n] = x[n] - sum(k=1..N) a_k*w[n-k]
y[n] = sum(k=0..M) b_k*w[n-k]
f1 :: Fractional a => [a] -> [a] Source #
f2 :: Fractional a => [a] -> [a] Source #
f3 :: Fractional a => [a] -> [a] Source #