julialangHow to use JuliaLang to perform a Fast Fourier Transform?
JuliaLang provides a package called FFTW to perform Fast Fourier Transform (FFT). To use it, first install the package by running Pkg.add("FFTW") in the Julia REPL. Then, import the package by running using FFTW in the Julia REPL.
To perform a FFT, use the fft function. For example, to perform a FFT on a vector x, run y = fft(x).
julia> using FFTW
julia> x = [1,2,3,4]
4-element Array{Int64,1}:
1
2
3
4
julia> y = fft(x)
4-element Array{Complex{Float64},1}:
10.0+0.0im
-2.0+2.0im
-2.0+0.0im
-2.0-2.0im
Code explanation
Pkg.add("FFTW"): install theFFTWpackageusing FFTW: import theFFTWpackagefft(x): perform a FFT on a vectorx
Helpful links
More of Julialang
- How to use dictionaries in JuliaLang?
- How to use tuples in JuliaLang?
- How to use lambda functions in JuliaLang?
- How to create a histogram in JuliaLang?
- How to use channels in JuliaLang?
- How to use try catch in JuliaLang?
- How to use regular expressions in JuliaLang?
- How to round numbers in JuliaLang?
- How to use enums in JuliaLang?
- How to concatenate strings in JuliaLang?
See more codes...