#ifndef frb_fourier_H #define frb_fourier_H /* Fourier transforms. */ /* Last edited on 2005-01-16 14:46:00 by stolfi */ /* Copyright © 2005 Universidade Estadual de Campinas. See note at end of file. */ #include void frb_fourier_transform ( double_vec_t *V, double_vec_t *F ); /* Computes the Fourier transform {F} of a sample vector {V}, destroying {V} in the process. This routine actually computes the Hartley transform: {V[i] == Sum { F[j] * basis(N,j)(i) : j == 0..N-1 }} where {basis(N,j)(i) == sqrt(2/N) * cos((2*Pi*j*i / N) + Pi/4)} and {N == (V.nel) == (F.nel)}. The {basis} functions are orthonormal, meaning that {Sum { basis(N,j)(i)*basis(N,k)(i) : i == 0..N-1 } == dirac(j,k)} for all {j} and {k} in {0..N-1}. Therefore, the Fourier transform {F} can be computed by scalar products: {F[j] == Sum { V[i] * basis(N,j)(i) : i == 0..N-1 }} The actual frequency of component {F[j]} is {min(j MOD N, (N-j) MOD N)}. */ void frb_power_spectrum ( double_vec_t *F, double_vec_t *P ); /* Given the Hartley-Fourier transform {F} of a signal, stores in {P} its power spectrum. If {F} has {n} elements, {P} must have {floor(n/2)+1} elements. {P[0]} will be the squared norm of {F[0]}, and {P[n/2]} will be the power at the maximum frequency {n/2}, which comes from one or two components of {F}. */ unsigned frb_fourier_compute_order ( double band, double step, double length ); /* Selects a suitable number of resampling points for computing the FFT of a filtered signal, given the filter cutoff wavelength {band}, the minimum spacing {step}, and the total curve length {length}. */ void frb_fourier_diff ( double_vec_t *F, unsigned order ); /* Replaces the FFT of a curve by the FFT of its {order}th derivative, after discarding the maximum frequency term. */ #endif /* COPYRIGHT AND AUTHORSHIP NOTICE Copyright © 2005 Universidade Estadual de Campinas (UNICAMP). Created by Helena C. G. Leitão and Jorge Stolfi in 1995--2005. This source file can be freely distributed, used, and modified, provided that this copyright and authorship notice is preserved in all copies, and that any modified versions of this file are clearly marked as such. This software has NO WARRANTY of correctness or applicability for any purpose. Neither the authors nor their employers shall be held responsible for any losses or damages that may result from its use. END OF NOTICE */