Portability | portable |
---|---|

Stability | experimental |

Maintainer | m.p.donadio@ieee.org |

NCO and NCOM functions

- nco :: RealFloat a => a -> a -> [a]
- ncom :: RealFloat a => a -> a -> [a] -> [a]
- quadrature_nco :: RealFloat a => a -> a -> [Complex a]
- complex_ncom :: RealFloat a => a -> a -> [Complex a] -> [Complex a]
- quadrature_ncom :: RealFloat a => a -> a -> [Complex a] -> [a]
- agc :: RealFloat a => Complex a -> Complex a

# Documentation

:: RealFloat a | |

=> a | w |

-> a | phi |

-> [a] | y |

`nco`

creates a sine wave with normalized frequency wn (numerically
controlled oscillator, or NCO) using the recurrence relation y[n] =
2cos(wn)*y[n-1] - y[n-2]. Eventually, cumulative errors will creep
into the data. This is unavoidable since performing AGC on this type
of real data is hard. The good news is that the error is small with
floating point data.

:: RealFloat a | |

=> a | w |

-> a | phi |

-> [a] | x |

-> [a] | y |

`ncom`

mixes (multiplies) x by a real sine wave with normalized
frequency wn. This is usually called an NCOM: Numerically Controlled
Oscillator and Modulator.

`quadrature_nco`

returns an infinite list representing a complex phasor
with a phase step of wn radians, ie a quadrature nco with normalized
frequency wn radians/sample. Since Haskell uses lazy evaluation,
rotate will only be computed once, so this NCO uses only one sin and
one cos for the entire list, at the expense of 4 mults, 1 add, and 1
subtract per point.

`complex_ncom`

mixes the complex input x with a quardatue nco with
normalized frequency wn radians/sample using complex multiplies
(perform a complex spectral shift)

`quadrature_ncom`

mixes the complex input x with a quadrature nco with
normalized frequency wn radians/sample in quadrature (I/Q modulation)