PsiLAB Help Manual Page

Section: Fast Fourier Transform

Name: fft

Calculate the Fast Fouriertransfom from a matrix a.
The input matrix can be either a real or a complex matrix. The result matrix is always from type complex, and of the same size as of the input matrix.

fft ?fin:('a, 'b, 'c) Matrix.t list
?fout:(Complex.t, 'b, 'c) Matrix.t list
-> (Complex.t, 'b, 'c) Matrix.t

There are 2 ways to use the output matrix:

  1. The output matrix will be automatically allocated by the fft function and returned,
  2. the ouput matrix is already allocated.

The fout argument is used for an already allocated matrix:

~fout:[ complex matrix ]

Wihtout this argument, the fft function allocate a appropiate complex matrix.
The direction of the FFT is set by the dir argument:

~dir: Forward (default) | Backward

Furthermore it's possible to reorder the FFT output matrix with the reorder argument :

~reorder: false (default) true


[] let f = fmatrix ~dim:[500;300] ~rand:[1.0] () ;; 
[] let fc = fft ~fin:[f] () ;; 
[] f =<< (sin,f) ;; 
[] fft ~fin:[f] ~fout:[fc] ~dir:Backward ~reorder:true () ;; 

Printed by PsiLAB