/* * FourierTransformExample * * This class demonstrates a use of the FourierTransform class * A 256 point wave form formed by adding two sine waves * y = sin(2.pi.t) + 2sin(10.pi.t); * is first plotted, then its power spectrum is obtained * and displayed. The transformed data is then put * through a inverse Fourier transform and the inverse * transformed data, which should be the same as the * original wave form, is then displayed. * * AUTHOR: Dr Michael Thomas Flanagan * DATE: 24 January 2006 * * Copyright (c) January 2006 Michael Thomas Flanagan * * PERMISSION TO COPY: * Permission to use, copy and modify this software and its documentation for * NON-COMMERCIAL purposes is granted, without fee, provided that an acknowledgement * to the author, Michael Thomas Flanagan at www.ee.ucl.ac.uk/~mflanaga, appears in all copies. * * Dr Michael Thomas Flanagan makes no representations about the suitability * or fitness of the software for any or for a particular purpose. * Michael Thomas Flanagan shall not be liable for any damages suffered * as a result of using, modifying or distributing this software or its derivatives. * ***************************************************************************************/ import flanagan.io.*; import flanagan.math.*; import flanagan.plot.*; public class FourierTransformExample{ public static void main(String[] args){ int nPoints = 256; // number of points double[] tdata = new double[nPoints]; double[] ydata = new double[nPoints]; double amplitude1 = 1.0D; double amplitude2 = 2.0D; double pointsPerCycle = 200; double deltaT = 1.0D/pointsPerCycle; // Create wave form for(int i=0; i