package com.imsl.test.example.math; import com.imsl.math.*; /** *
* Finds the Fourier coefficients of a complex * sequence.
* * The Fourier coefficients of a complex periodic sequence are computed. Then * the coefficients are used to try to reproduce the periodic sequence. * * @see Code * @see Output */ public class ComplexFFTEx1 { public static void main(String args[]) { Complex x[] = { new Complex(1, 8), new Complex(2, 7), new Complex(3, 6), new Complex(4, 5), new Complex(5, 4), new Complex(6, 3), new Complex(7, 2), new Complex(8, 1) }; ComplexFFT fft = new ComplexFFT(x.length); Complex y[] = fft.forward(x); Complex z[] = fft.backward(y); for (int i = 0; i < x.length; i++) { z[i] = Complex.divide(z[i], x.length); } new PrintMatrix("x").print(x); new PrintMatrix("y").print(y); new PrintMatrix("z").print(z); } }