/* From: "A SURVEY OF COMPUTATIONAL PHYSICS" by RH Landau, MJ Paez, and CC Bordeianu Copyright Princeton University Press, Princeton, 2007. Electronic Materials copyright: R Landau, Oregon State Univ, 2007; MJ Paez, Univ Antioquia, 2007; and CC Bordeianu, Univ Bucharest, 2007. Support by National Science Foundation */ import java.io.*; import ptolemy.plot.*; public class Noise{ static final int max =1000; static double array[] = new double[max]; static double ps[]=new double[max]; static double Autocorr[]=new double[max]; static double twopi=2*Math.PI; static double step= 4*Math.PI/1000; public static void main(String[] argv){ double dftreal[]=new double[max]; double dftimag[]=new double[max]; discrete(array,max); autocorr(array); fourier(dftreal,dftimag); filter1(); } /*Calculate and plot the power spectrum of initial function + noise using DFT */ public static void fourier(double dftreal[],double dftimag[]){ double real, imag; Plot powerspec = new Plot(); int n, k; for (n = 0; n