FFT
Algorithm for fast fourier transform, which is widely used in the treatment of signals.
The fast fourier transform picks up the signal input in a given time period and divides it into its frequency components as in the following figure:
Example
iex> a = [1,1,1,1,0,0,0,0]
[1, 1, 1, 1, 0, 0, 0, 0]
iex> FFT.transform a
[#ComplexNum (Cartesian) <4.0 + 0.0ยท๐>,
#ComplexNum (Cartesian) <1.0 + -2.414213562373095ยท๐>,
#ComplexNum (Cartesian) <0.0 + 0.0ยท๐>,
#ComplexNum (Cartesian) <1.0 + -0.4142135623730949ยท๐>,
#ComplexNum (Cartesian) <0.0 + 0.0ยท๐>,
#ComplexNum (Cartesian) <0.9999999999999999 + 0.4142135623730949ยท๐>,
#ComplexNum (Cartesian) <0.0 + 0.0ยท๐>,
#ComplexNum (Cartesian) <0.9999999999999997 + 2.414213562373095ยท๐>]
Installation
If available in Hex, the package can be installed
by adding fft to your list of dependencies in mix.exs:
def deps do
[
{:fft, "~> 0.1.1"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/fft.