逆変換もできる関数が揃っているリンクはこちら
http://www.phpkode.com/scripts/item/fast-fourier-transform/
ソースは下記ですが、最新版は上記から探してみてください。
FFT.class.php
<?php /** * @author Michele Andreoli <michi.andreoliあっとまーくgmail.com> * @name FFT.class.php * @version 0.5 updated 06-07-2010 * @license http://opensource.org/licenses/gpl-license-php GNU Public License * @package FFT */ require_once 'Complex.class.php'; /** * Class that calculate the FFT and the inverse FFT of a 1D signal */ class FFT { private $dim; private $p; private $ind; private $func; private $w1; private $w1i; private $w2; /** * Constructor for FFT class * @param int $dim dimension of the signal */ public function __construct($dim) { $this->dim = $dim; $this->p = log($this->dim, 2); } /** * Calculate the FFT of a signal * @param array<double> $func input signal * @return array<complex> return the DFT for the signal in input */ public function fft($func) { $this->func = $func; for ($i = 0; $i < $this->dim; $i++) $this->w1[$i] = new Complex($func[$i], 0); $w[0] = new Complex(1, 0); $w[1] = new Complex(cos((-2 * M_PI) / $this->dim), sin((-2 * M_PI) / $this->dim)); for ($i = 2; $i < $this->dim; $i++) $w[$i] = Complex::Cmul($w[$i-1], $w[1]); return $this->calculate($w); } /** * Calculate the inverse FFT of a signal * @param array<complex> $func input signal * @return array<complex> result of inverse FFT for the signal in input */ public function ifft($func) { $this->func = $func; $norm = 1 / $this->dim; for ($i = 0; $i < $this->dim; $i++) $this->w1[$i] = new Complex($func[$i]->getReal(), $func[$i]->getImag()); $w[0] = new Complex(1, 0); $w[1] = new Complex(cos((2 * M_PI) / $this->dim), sin((2 * M_PI) / $this->dim)); for ($i = 2; $i < $this->dim; $i++) $w[$i] = Complex::Cmul($w[$i-1], $w[1]); $this->w1i = $this->calculate($w); for ($i = 0; $i < $this->dim; $i++) $this->w1i[$i] = Complex::RCmul($norm, $this->w1i[$i]); return $this->w1i; } private function calculate($w) { $k = 1; $ind[0] = 0; for ($j = 0; $j < $this->p; $j++) { for ($i = 0; $i < $k; $i++) { $ind[$i] *= 2; $ind[$i+$k] = $ind[$i] + 1; } $k *= 2; } for ($i = 0; $i < $this->p; $i++) { $indw = 0; for ($j = 0; $j < pow(2, $i); $j++) { $inf = ($this->dim / pow(2, $i)) * $j; $sup = (($this->dim / pow(2, $i)) * ($j+1)) - 1; $comp = ($this->dim / pow(2, $i)) / 2; for ($k = $inf; $k <= floor($inf+(($sup-$inf)/2)); $k++) $this->w2[$k] = Complex::Cadd(Complex::Cmul($this->w1[$k], $w[0]), Complex::Cmul($this->w1[$k+$comp], $w[$ind[$indw]])); $indw++; for ($k = floor($inf+(($sup-$inf)/2)+1); $k <= $sup; $k++) $this->w2[$k] = Complex::Cadd(Complex::Cmul($this->w1[$k], $w[$ind[$indw]]), Complex::Cmul($this->w1[$k-$comp], $w[0])); $indw++; } for($j = 0; $j < $this->dim; $j++) $this->w1[$j] = $this->w2[$j]; } for ($i = 0; $i < $this->dim; $i++) $this->w1[$i] = $this->w2[$ind[$i]]; return $this->w1; } /** * Getter for the FFT * @return array<complex> get the FFT of the signal */ public function getFFT() { return $this->w1; } /** * Getter for the inverse FFT * @return array<complex> get the inverse FFT of the signal */ public function getIFFT() { return $this->w1i; } /** * Get the absolute value of the signal * @param array<complex> $fft * @return array<complex> get the absolute value of FFT */ public function getAbsFFT($w) { for ($i = 0; $i < $this->dim; $i++) $temp[$i] = Complex::Cabs($w[$i]); return $temp; } /** * Getter for the dimension of the signal * @return int return the dimension of the signal */ public function getDim() { return $this->dim; } /** * Convert an array of double into an array of complex * @param array<double> $func * @return array<complex> return an array of complex */ public function doubleToComplex($func) { for ($i = 0; $i < count($func); $i++) $aux[$i] = new Complex($func[$i], 0); return $aux; } /** * Convert an array of complex into an array of double * @param array<complex> $func * @return array<double> return an array of double */ public function complexToDouble($func) { for ($i = 0; $i < count($func); $i++) $aux[$i] = $func[$i]->getReal(); return $aux; } } ?>
Complex.class.php
<?php /** * @author Michele Andreoli <michi.andreoliあっとまーくgmail.com> * @name Complex.class.php * @version 0.3 updated 09-05-2010 * @license http://opensource.org/licenses/gpl-license-php GNU Public License * @package FFT */ /** * Class that implements a complex data number */ class Complex { private $real; private $imag; /** * Create a complex datatype * @param double $real * @param double $imag */ public function __construct($real, $imag) { $this->real = $real; $this->imag = $imag; } /** * Return the multiplication of two complex number * @param complex $a * @param complex $b * @return complex */ static public function Cmul($a, $b) { $c = new Complex(0, 0); $c->setReal($a->getReal() * $b->getReal() - $a->getImag() * $b->getImag()); $c->setImag($a->getImag() * $b->getReal() + $a->getReal() * $b->getImag()); return $c; } /** * Return the sum of two complex number * @param complex $a * @param complex $b * @return complex */ static public function Cadd($a, $b) { $c = new Complex(0, 0); $c->setReal($a->getReal() + $b->getReal()); $c->setImag($a->getImag() + $b->getImag()); return $c; } /** * Return the difference of two complex number * @param complex $a * @param complex $b * @return complex */ static public function Csub($a, $b) { $c = new Complex(0, 0); $c->setReal($a->getReal() - $b->getReal()); $c->setImag($a->getImag() - $b->getImag()); return $c; } /** * Return the absolute value of a complex number * @param complex $z * @return double */ static public function Cabs($z) { $x = abs($z->getReal()); $y = abs($z->getImag()); if ($x == 0.0) $ans = $y; else if ($y == 0.0) $ans = $x; else if ($x > $y) { $temp = $y / $x; $ans = $x * sqrt(1.0 + $temp * $temp); } else { $temp = $x / $y; $ans = $y * sqrt(1.0 + $temp * $temp); } return $ans; } /** * Return the radix of two complex number * @param complex $z * @return complex */ static public function Csqrt($z) { if (($z->getReal() == 0.0) && ($z->getImag() == 0.0)) { $c = new Complex(0, 0); return $c; } else { $x = abs($z->getReal()); $y = abs($z->getImag()); if ($x >= $y) { $r = $y / $x; $w = sqrt($x) * sqrt(0.5 * (1.0 + sqrt(1.0 + $r * $r))); } else { $r = $x / $y; $w = sqrt($y) * sqrt(0.5 * ($r + sqrt(1.0 + $r * $r))); } $c = new Complex(0, 0); if ($z->getReal() >= 0.0) { $c->setReal($w); $c->setImag($z->getImag() / (2.0 * $w)); } else { if ($z->getImag() >= 0) $c->setImag($w); else $c->setImag(-$w); $c->setReal($z->getReal() / (2.0 * $c->getImag())); } return $c; } } /** * Return the inverse of a complex number * @param complex $z * @return complex */ static public function Cinv($z) { $c = new Complex(0, 0); $c->setReal($z->getReal()); $c->setImag(-$z->getImag()); return $c; } /** * Return the multiplication of a complex number with a scalar value * @param complex $n * @param complex $z * @return complex */ static public function RCmul($n, $z) { $c = new Complex(0, 0); $c->setReal($z->getReal() * $n); $c->setImag(-$z->getImag() * $n); return $c; } /** * Getters and setters */ public function setReal($real) { $this->real = $real; } public function setImag($imag) { $this->imag = $imag; } public function getReal() { return $this->real; } public function getImag() { return $this->imag; } } ?>
サンプルファイル
index.php
<?php /** * @author Michele Andreoli <michi.andreoli@gmail.com> * @name index.php * @version 0.1 updated 07-05-2010 * @license http://opensource.org/licenses/gpl-license-php GNU Public License * @package FFT */ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Fast Fourier Transform, FFT</title> </head> <body> <?php require_once 'FFT.class.php'; // Define a generic function $f = array(); for ($i = 0; $i < 256; $i++) { if (($i >= 0 && $i <= 8) || ($i >= 248 && $i <= 255)) $f[$i] = 1; else $f[$i] = 0; } $fft = new FFT(256); // Calculate the FFT of the function $f $w = $fft->fft($f); echo "<h1 style=\"font: bold 14px verdana;\">FFT: </h1>"; for ($i = 0; $i < $fft->getDim(); $i++) echo "<p style=\"font: normal 10px verdana;\"><b>".$i."</b> (".$w[$i]->getReal().", ".$w[$i]->getImag().")</p>"; // Calculate the inverse FFT of the function $w $w = $fft->ifft($w); echo "<br/><h1 style=\"font: bold 14px verdana;\">FFT inverse:</h1>"; for ($i = 0; $i < $fft->getDim(); $i++) echo "<p style=\"font: normal 10px verdana;\"><b>".$i."</b> (".$w[$i]->getReal().")</p>"; ?> </body> </html>
サンプルテスト出力
FFT:
0 (17, 0)
1 (16.877376851216, 1.3239409568655E-14)
2 (16.512674319733, 1.8041124150159E-14)
3 (15.915296255567, 4.2299497238218E-14)
4 (15.100595973038, 2.4868995751604E-14)
5 (14.089407730913, 5.7842619582971E-14)
6 (12.9074126744, 6.1672889017927E-14)
7 (11.584360195483, 1.0079437284816E-13)
8 (10.153170387609, 2.8421709430404E-14)
9 (8.6489471020338, 6.9819150461115E-14)
10 (7.1079339256376, 6.8889338677991E-14)
11 (5.5664470995395, 1.1018963519405E-13)
12 (4.0598199297288, 6.3782312764715E-14)
13 (2.6213925918954, 9.886536034287E-14)
14 (1.281579431215, 9.2745255919624E-14)
15 (0.067042973107172, 1.2192330478555E-13)
16 (-1, 1.6168475976272E-14)
17 (-1.9023196470646, 4.4762804574106E-14)
18 (-2.6280462447661, 3.8344327712991E-14)
19 (-3.1708658792552, 5.6926685587655E-14)
20 (-3.5300352907046, 3.0420110874729E-14)
21 (-3.7102186573424, 4.0800696154975E-14)
22 (-3.7211550883243, 3.7359004778637E-14)
23 (-3.5771712024474, 4.0897840669629E-14)
24 (-3.2965582089384, 2.0539125955565E-14)
25 (-2.9008372059234, 2.0969337377608E-14)
26 (-2.4139398281315, 1.8651746813703E-14)
27 (-1.861333797279, 1.8623991238087E-14)
28 (-1.2691242823883, 1.6181500583912E-14)
29 (-0.66316222802768, 1.4557799410397E-14)
30 (-0.068189961048635, 1.4738210651899E-14)
31 (0.49294751478403, 1.4013096238941E-14)
32 (0.99999999999999, 1.5505964705829E-14)
33 (1.435896549321, 1.702284146976E-14)
34 (1.7871995226591, 1.7548462682981E-14)
35 (2.0444158500796, 2.1357915436226E-14)
36 (2.2021584578235, 1.8235413179468E-14)
37 (2.259156292821, 2.4008572907519E-14)
38 (2.2181168286947, 2.5313084961454E-14)
39 (2.0854501403741, 3.3292812950947E-14)
40 (1.8708684117894, 1.5598633495983E-14)
41 (1.5868789244465, 2.4744095661333E-14)
42 (1.2481920207445, 2.3758772726978E-14)
43 (0.87106813048327, 3.486100297323E-14)
44 (0.4726296108078, 2.120525977034E-14)
45 (0.070163833099847, 2.9559688030645E-14)
46 (-0.31955635390749, 2.7713942252205E-14)
47 (-0.68090991947076, 3.5672853559987E-14)
48 (-1, 4.4087703354695E-15)
49 (-1.2651415593768, 1.1664280652468E-14)
50 (-1.4672482570444, 9.1454621653497E-15)
51 (-1.6001065896392, 1.3933298959046E-14)
52 (-1.6605299057846, 6.883382752676E-15)
53 (-1.6483896157951, 8.8817841970013E-15)
54 (-1.5665256474979, 8.5209617139981E-15)
55 (-1.4205427576073, 8.2850393212652E-15)
56 (-1.218503525588, 6.4670491184415E-15)
57 (-0.97053257959026, 6.3976601794025E-15)
58 (-0.68834969871281, 6.8556271770603E-15)
59 (-0.38475179521194, 5.911937606129E-15)
60 (-0.073065326541002, 8.3544282603043E-15)
61 (0.23340862538904, 7.4593109467003E-15)
62 (0.52193455378641, 9.1801566348693E-15)
63 (0.78084698453526, 1.0143795525774E-14)
64 (0.99999999999999, 1.2170819907453E-14)
65 (1.1711451790866, 1.2678226524176E-14)
66 (1.288224448254, 1.4023504579797E-14)
67 (1.347567954397, 1.6556200854723E-14)
68 (1.3479910105092, 1.4530043834782E-14)
69 (1.2907882704857, 1.8804402479589E-14)
70 (1.1796273977999, 1.8651746813703E-14)
71 (1.0203484436007, 2.3717139363555E-14)
72 (0.82067879082865, 1.2434497875802E-14)
73 (0.5898767140905, 1.7194579093882E-14)
74 (0.33831923140421, 1.5903944827755E-14)
75 (0.077051888329222, 2.1038726316647E-14)
76 (-0.18268065064689, 1.2795320358805E-14)
77 (-0.42990386290684, 1.6014967130218E-14)
78 (-0.65436345108323, 1.4058199049316E-14)
79 (-0.84693828436805, 1.6549261960819E-14)
80 (-1, 1.6495537311177E-15)
81 (-1.1077054569259, 3.4486302702419E-15)
82 (-1.1662111434634, 1.4571677198205E-15)
83 (-1.1738019485656, 1.7486012637846E-15)
84 (-1.1309302754798, -6.6613381477509E-16)
85 (-1.0401651618179, -2.2759572004816E-15)
86 (-0.90605472289853, -2.5535129566379E-15)
87 (-0.73490871010854, -4.8433479449272E-15)
88 (-0.5345111359508, -2.2204460492503E-15)
89 (-0.31377563932833, -4.787836793696E-15)
90 (-0.08235844401145, -3.9968028886506E-15)
91 (0.14975468163902, -5.3568260938164E-15)
92 (0.37267018089141, -2.3037127760972E-15)
93 (0.57699973210147, -2.7478019859473E-15)
94 (0.75424763347272, -1.04777297949E-15)
95 (0.89715686611487, -3.9898639947467E-17)
96 (0.99999999999999, 2.1832884103274E-15)
97 (1.0588034996283, 4.0002723356025E-15)
98 (1.0714968217812, 5.4053983511437E-15)
99 (1.0379808584093, 8.7291285311153E-15)
100 (0.96011363307539, 7.6882944455292E-15)
101 (0.84161457218897, 1.1601830607333E-14)
102 (0.68789200394856, 1.2434497875802E-14)
103 (0.50580165410466, 1.6084356069257E-14)
104 (0.30334668360734, 8.1601392309949E-15)
105 (0.089332138671147, 1.1143863609675E-14)
106 (-0.12701153259932, 1.0380585280245E-14)
107 (-0.33642007008792, 1.3322676295502E-14)
108 (-0.52998575303648, 7.8270723236074E-15)
109 (-0.69953032173529, 8.3544282603043E-15)
110 (-0.83794509408247, 6.5919492087119E-15)
111 (-0.93948434240108, 5.8772431366094E-15)
112 (-1, 8.6583076418495E-17)
113 (-1.0171082499518, -1.3392065234541E-15)
114 (-0.9902814070487, -3.2335245592208E-15)
115 (-0.92086161973402, -5.6343818499727E-15)
116 (-0.81199616386893, -5.384581669432E-15)
117 (-0.66849734162249, -8.9928064994638E-15)
118 (-0.49663310430789, -9.4368957093138E-15)
119 (-0.30385736133689, -1.2559397966072E-14)
120 (-0.098491403357184, -6.7723604502135E-15)
121 (0.11063014353736, -1.0061396160665E-14)
122 (0.31453398385415, -9.2703622556201E-15)
123 (0.50448777275728, -1.1324274851177E-14)
124 (0.6723688525762, -7.2164496600635E-15)
125 (0.8110067489246, -7.9936057773011E-15)
126 (0.91448518154279, -5.8841820305133E-15)
127 (0.97839104176565, -4.6074255521944E-15)
128 (0.99999999999997, -2.3037127760972E-15)
129 (0.97839104176564, -1.6375789613221E-15)
130 (0.91448518154278, -1.2212453270877E-15)
131 (0.81100674892459, 8.8817841970013E-16)
132 (0.6723688525762, -4.4408920985006E-16)
133 (0.50448777275728, 2.1094237467878E-15)
134 (0.31453398385414, 2.4980018054066E-15)
135 (0.11063014353735, 5.0931481254679E-15)
136 (-0.098491403357185, -5.5511151231257E-16)
137 (-0.30385736133688, 1.2073675392799E-15)
138 (-0.49663310430789, 7.2164496600635E-16)
139 (-0.6684973416225, 1.720845688169E-15)
140 (-0.81199616386894, -6.1062266354384E-16)
141 (-0.92086161973403, -1.498801083244E-15)
142 (-0.9902814070487, -2.3453461395206E-15)
143 (-1.0171082499518, -4.3645642655576E-15)
144 (-1, -1.2384394644671E-15)
145 (-0.93948434240107, -4.0314973581701E-15)
146 (-0.83794509408246, -4.4547698863084E-15)
147 (-0.69953032173528, -8.076872504148E-15)
148 (-0.52998575303648, -4.6629367034257E-15)
149 (-0.33642007008791, -8.9372953482325E-15)
150 (-0.12701153259932, -8.3821838359199E-15)
151 (0.089332138671149, -1.2281842209916E-14)
152 (0.30334668360734, -3.441691376338E-15)
153 (0.50580165410467, -7.4523720527964E-15)
154 (0.68789200394857, -6.7723604502135E-15)
155 (0.84161457218897, -9.3536289824669E-15)
156 (0.9601136330754, -5.1347814888913E-15)
157 (1.0379808584093, -6.3143934525556E-15)
158 (1.0714968217812, -5.0237591864288E-15)
159 (1.0588034996283, -4.6108949991464E-15)
160 (0.99999999999999, -3.335144798376E-15)
161 (0.89715686611487, -2.6281060661049E-15)
162 (0.75424763347272, -1.9914625504214E-15)
163 (0.57699973210146, -1.3877787807814E-17)
164 (0.37267018089141, -1.3600232051658E-15)
165 (0.14975468163902, 8.0491169285324E-16)
166 (-0.082358444011456, 9.9920072216264E-16)
167 (-0.31377563932834, 1.873501354055E-15)
168 (-0.53451113595081, -1.0547118733939E-15)
169 (-0.73490871010853, -1.346145417358E-15)
170 (-0.90605472289853, -1.942890293094E-15)
171 (-1.0401651618179, -3.5527136788005E-15)
172 (-1.1309302754799, -3.663735981263E-15)
173 (-1.1738019485656, -7.3552275381417E-15)
174 (-1.1662111434634, -8.7568841067309E-15)
175 (-1.1077054569259, -1.4398204850607E-14)
176 (-1, -2.8014101191664E-15)
177 (-0.84693828436803, -9.3050567251396E-15)
178 (-0.65436345108322, -1.0227929614359E-14)
179 (-0.42990386290684, -1.7263968032921E-14)
180 (-0.18268065064689, -1.1157741397483E-14)
181 (0.077051888329233, -1.8374191057546E-14)
182 (0.33831923140422, -1.8485213360009E-14)
183 (0.58987671409051, -2.4216739724636E-14)
184 (0.82067879082866, -1.2184697695261E-14)
185 (1.0203484436007, -1.8027246362351E-14)
186 (1.1796273977999, -1.7347234759768E-14)
187 (1.2907882704857, -2.0969337377608E-14)
188 (1.3479910105092, -1.5834555888716E-14)
189 (1.3475679543971, -1.7638668303732E-14)
190 (1.288224448254, -1.6261297863807E-14)
191 (1.1711451790866, -1.5792922525293E-14)
192 (0.99999999999999, -1.4474532683551E-14)
193 (0.78084698453525, -1.3745081461902E-14)
194 (0.52193455378641, -1.4269835313385E-14)
195 (0.23340862538904, -1.2823075934421E-14)
196 (-0.073065326541002, -1.3697376566313E-14)
197 (-0.38475179521194, -1.3086753902769E-14)
198 (-0.68834969871281, -1.301736496373E-14)
199 (-0.97053257959026, -1.40304434737E-14)
200 (-1.218503525588, -1.3600232051658E-14)
201 (-1.4205427576073, -1.5751289161869E-14)
202 (-1.5665256474979, -1.6292522886374E-14)
203 (-1.6483896157951, -2.18436380095E-14)
204 (-1.6605299057846, -1.6930901125534E-14)
205 (-1.6001065896392, -2.4397150966138E-14)
206 (-1.4672482570444, -2.4771851236949E-14)
207 (-1.2651415593768, -3.4590386110978E-14)
208 (-1, -5.5606267235181E-15)
209 (-0.68090991947075, -1.5938639297275E-14)
210 (-0.31955635390748, -1.4557799410397E-14)
211 (0.070163833099856, -2.4896751327219E-14)
212 (0.4726296108078, -1.2267964422108E-14)
213 (0.87106813048328, -2.1982415887578E-14)
214 (1.2481920207446, -2.1094237467878E-14)
215 (1.5868789244465, -2.9046209881756E-14)
216 (1.8708684117894, -8.4376949871512E-15)
217 (2.0854501403741, -1.5445977830097E-14)
218 (2.2181168286947, -1.4210854715202E-14)
219 (2.259156292821, -1.9345636204093E-14)
220 (2.2021584578235, -1.3239409568655E-14)
221 (2.0444158500796, -1.5737411374062E-14)
222 (1.7871995226591, -1.5480672299617E-14)
223 (1.435896549321, -1.5943843467703E-14)
224 (0.99999999999999, -1.6657821093878E-14)
225 (0.49294751478403, -1.8537255064288E-14)
226 (-0.068189961048636, -1.9852175459079E-14)
227 (-0.66316222802769, -2.152444888992E-14)
228 (-1.2691242823883, -2.36199948489E-14)
229 (-1.861333797279, -2.647881913731E-14)
230 (-2.4139398281315, -3.0087043967342E-14)
231 (-2.9008372059234, -3.9315772859538E-14)
232 (-3.2965582089384, -2.8366198279173E-14)
233 (-3.5771712024474, -4.203581926987E-14)
234 (-3.7211550883243, -4.4242387531312E-14)
235 (-3.7102186573424, -6.6058269965197E-14)
236 (-3.5300352907046, -4.9349413444588E-14)
237 (-3.1708658792552, -7.4690253981657E-14)
238 (-2.6280462447661, -7.7562956057875E-14)
239 (-1.9023196470647, -1.1105699693204E-13)
240 (-1, -1.7320332364321E-14)
241 (0.0670429731072, -5.1077198026661E-14)
242 (1.281579431215, -4.6809778275758E-14)
243 (2.6213925918954, -8.2572837456496E-14)
244 (4.0598199297288, -3.9468428525424E-14)
245 (5.5664470995396, -7.2164496600635E-14)
246 (7.1079339256377, -7.0499162063697E-14)
247 (8.6489471020339, -9.8157593164672E-14)
248 (10.153170387609, -2.0428103653103E-14)
249 (11.584360195483, -4.3479109201883E-14)
250 (12.9074126744, -3.4694469519536E-14)
251 (14.089407730913, -5.2402526762307E-14)
252 (15.100595973038, -1.987299214079E-14)
253 (15.915296255568, -2.076117056049E-14)
254 (16.512674319733, -1.0935696792558E-14)
255 (16.877376851216, -4.4408920985006E-16)
FFT inverse: 逆変換
0 (1)
1 (1)
2 (1)
3 (1)
4 (1)
5 (1)
6 (1)
7 (1)
8 (1)
9 (-1.492017013091E-15)
10 (-1.3672015133964E-15)
11 (-1.6996440096182E-15)
12 (-1.2863480513928E-15)
13 (-1.5587683962791E-15)
14 (-1.5016291471669E-15)
15 (-1.6816325715574E-15)
16 (-7.4297729778648E-16)
17 (-1.0539044870699E-15)
18 (-1.0639905291507E-15)
19 (-1.3505522638021E-15)
20 (-1.0055282904977E-15)
21 (-1.2705716369273E-15)
22 (-1.2692721198654E-15)
23 (-1.4216144240241E-15)
24 (-2.1057182970151E-15)
25 (-1.867667083695E-15)
26 (-1.8321892485993E-15)
27 (-2.0814935382908E-15)
28 (-1.8419014220781E-15)
29 (-2.0550607086268E-15)
30 (-2.0158296086263E-15)
31 (-2.1691698800222E-15)
32 (-9.365943393149E-16)
33 (-1.1401018292578E-15)
34 (-1.1826072002246E-15)
35 (-1.3013645472888E-15)
36 (-1.2983146940507E-15)
37 (-1.4208495467536E-15)
38 (-1.4754605295649E-15)
39 (-1.6164844402858E-15)
40 (-1.5195956075257E-15)
41 (-9.9636106447977E-16)
42 (-1.0732633594539E-15)
43 (-1.2789339263661E-15)
44 (-1.0791084846866E-15)
45 (-1.2951014272876E-15)
46 (-1.2947108099685E-15)
47 (-1.4547926136329E-15)
48 (-7.3163494500363E-16)
49 (-8.7024357800018E-16)
50 (-9.5419792448397E-16)
51 (-1.1567488817289E-15)
52 (-9.1037531451755E-16)
53 (-1.1268657940098E-15)
54 (-1.1827819191168E-15)
55 (-1.3350199557727E-15)
56 (-3.188425109829E-15)
57 (-3.0245646842624E-15)
58 (-3.0252419075903E-15)
59 (-3.3207548064253E-15)
60 (-3.0911596029309E-15)
61 (-3.3091555033119E-15)
62 (-3.1818270138031E-15)
63 (-3.3695938743309E-15)
64 (-1.424191033118E-15)
65 (-1.5637786891793E-15)
66 (-1.5534733103025E-15)
67 (-1.7288728183304E-15)
68 (-1.7184179952312E-15)
69 (-1.7403457982855E-15)
70 (-1.8861274350464E-15)
71 (-1.9371085554654E-15)
72 (-2.0498557684724E-15)
73 (-1.012135590701E-15)
74 (-1.0864084616883E-15)
75 (-1.2528758928463E-15)
76 (-1.1556351459127E-15)
77 (-1.2300250974298E-15)
78 (-1.3418856072278E-15)
79 (-1.4616842235028E-15)
80 (-8.0012558618783E-16)
81 (-8.4112119101412E-16)
82 (-8.4782378723931E-16)
83 (-1.074041317721E-15)
84 (-8.7248324027388E-16)
85 (-1.0535146860055E-15)
86 (-1.0719161805933E-15)
87 (-1.2953142869287E-15)
88 (-1.8314926186071E-15)
89 (-1.6327361994757E-15)
90 (-1.6185793486579E-15)
91 (-1.802471513715E-15)
92 (-1.637156567619E-15)
93 (-1.8436696879157E-15)
94 (-1.775199972167E-15)
95 (-2.0095845587555E-15)
96 (-9.3979483213529E-16)
97 (-1.0479376107947E-15)
98 (-1.1253203833854E-15)
99 (-1.2100307147055E-15)
100 (-1.1236165240294E-15)
101 (-1.2317064737292E-15)
102 (-1.2767354929274E-15)
103 (-1.4702649386853E-15)
104 (-1.4987301307366E-15)
105 (-1.0394094576463E-15)
106 (-1.0783908549738E-15)
107 (-1.2926283889006E-15)
108 (-1.1062930635837E-15)
109 (-1.2623368725199E-15)
110 (-1.3034525271972E-15)
111 (-1.4596606618053E-15)
112 (-7.4400884754136E-16)
113 (-8.495059973224E-16)
114 (-8.7000388844759E-16)
115 (-1.0325677670822E-15)
116 (-8.6864591804354E-16)
117 (-1.0838828941156E-15)
118 (-1.0701171512984E-15)
119 (-1.2450859934057E-15)
120 (-5.6621374255883E-15)
121 (-5.3290705182008E-15)
122 (-5.3290705182008E-15)
123 (-5.4400928206633E-15)
124 (-5.3290705182008E-15)
125 (-5.4400928206633E-15)
126 (-5.4400928206633E-15)
127 (-5.6621374255883E-15)
128 (-2.1094237467878E-15)
129 (-2.2204460492503E-15)
130 (-2.3314683517128E-15)
131 (-2.5535129566379E-15)
132 (-2.2204460492503E-15)
133 (-2.5535129566379E-15)
134 (-2.6645352591004E-15)
135 (-2.6645352591004E-15)
136 (-2.7755575615629E-15)
137 (-1.0664723756337E-15)
138 (-1.0653632260952E-15)
139 (-1.3034231938083E-15)
140 (-1.0922414885677E-15)
141 (-1.2422479088185E-15)
142 (-1.2967615215007E-15)
143 (-1.4375446473715E-15)
144 (-7.0861208260941E-16)
145 (-8.1334397417021E-16)
146 (-8.5575897398995E-16)
147 (-1.0240971889493E-15)
148 (-8.4921747447718E-16)
149 (-1.0175128832528E-15)
150 (-1.0494516646105E-15)
151 (-1.1687972770004E-15)
152 (-1.8376590204648E-15)
153 (-1.596199898963E-15)
154 (-1.6552289120617E-15)
155 (-1.7994157191065E-15)
156 (-1.7257188016859E-15)
157 (-1.8789415438276E-15)
158 (-1.8620591401959E-15)
159 (-2.014658766747E-15)
160 (-9.394548898454E-16)
161 (-1.0099298826948E-15)
162 (-1.0476023046346E-15)
163 (-1.1980375100262E-15)
164 (-1.0470001506969E-15)
165 (-1.1466985809999E-15)
166 (-1.1606235980402E-15)
167 (-1.3938997130671E-15)
168 (-1.4312855457147E-15)
169 (-9.9750083518017E-16)
170 (-1.0086736196821E-15)
171 (-1.254721128795E-15)
172 (-1.0474870480059E-15)
173 (-1.1876502118413E-15)
174 (-1.233255510814E-15)
175 (-1.3821432938111E-15)
176 (-7.8240867335056E-16)
177 (-7.700602400744E-16)
178 (-8.3253046443266E-16)
179 (-9.4779184981862E-16)
180 (-8.6569033938408E-16)
181 (-9.621950387616E-16)
182 (-1.0580314097878E-15)
183 (-1.1308636059932E-15)
184 (-3.0288238280719E-15)
185 (-2.7485950437885E-15)
186 (-2.858940122923E-15)
187 (-3.0075164339381E-15)
188 (-2.9040447300449E-15)
189 (-3.0191157370515E-15)
190 (-3.0354219240978E-15)
191 (-3.1807219709575E-15)
192 (-1.3513665284449E-15)
193 (-1.4338234773087E-15)
194 (-1.4441288561854E-15)
195 (-1.6017962555451E-15)
196 (-1.5012287761817E-15)
197 (-1.59032327559E-15)
198 (-1.6665862437541E-15)
199 (-1.8376497282602E-15)
200 (-1.7249025152532E-15)
201 (-9.6713422438931E-16)
202 (-9.8946529908879E-16)
203 (-1.2180104829718E-15)
204 (-1.0537751409324E-15)
205 (-1.1976128930248E-15)
206 (-1.2517525584894E-15)
207 (-1.3676976630405E-15)
208 (-7.2268527341301E-16)
209 (-7.8395576313589E-16)
210 (-8.2698016624175E-16)
211 (-9.3543817621353E-16)
212 (-8.1746670441286E-16)
213 (-9.5230243502066E-16)
214 (-1.0080419807132E-15)
215 (-1.1560575711521E-15)
216 (-1.774646631364E-15)
217 (-1.4537126631547E-15)
218 (-1.555340638432E-15)
219 (-1.6440911914137E-15)
220 (-1.5675836588305E-15)
221 (-1.6608223246185E-15)
222 (-1.7854055439993E-15)
223 (-1.9112148742389E-15)
224 (-9.0340307119869E-16)
225 (-9.0985586836578E-16)
226 (-9.7433990779345E-16)
227 (-1.0645262338677E-15)
228 (-9.7196072972361E-16)
229 (-9.7470440440547E-16)
230 (-1.0831839902808E-15)
231 (-1.1814883335501E-15)
232 (-1.3235484440738E-15)
233 (-9.2217557726121E-16)
234 (-9.3546210646645E-16)
235 (-1.13585940817E-15)
236 (-9.4987347145686E-16)
237 (-1.0182644144254E-15)
238 (-1.1016264466494E-15)
239 (-1.3011637813802E-15)
240 (-7.6275162708356E-16)
241 (-7.3471406819511E-16)
242 (-6.8760816992127E-16)
243 (-7.4992408814179E-16)
244 (-5.8295316860667E-16)
245 (-4.7124925797664E-16)
246 (-5.6154910747191E-16)
247 (-5.7312029257445E-16)
248 (1)
249 (1)
250 (1)
251 (1)
252 (1)
253 (1)
254 (1)
255 (1)
元に戻っている。
以上です。当方PHP5、Winにて動作確認。
エクセルやR言語などでの出力結果と比較確認してから使うべし。
類似:
http://mitsui725.hatenablog.com/entry/2013/01/02/045859
タグ:
関数、クラス、ライブラリ、離散、FFT、
PHP class libray lib fourier analytics series transform
/**
* @author Michele Andreoli <michi.andreoliアットマークgmail.com>
* @name FFT.class.php
* @version 0.5 updated 06-07-2010
* @license http://opensource.org/licenses/gpl-license-php GNU Public License
* @package FFT
*/
/**
* @author Michele Andreoli <michi.andreoliアットマークgmail.com>
* @name Complex.class.php
* @version 0.3 updated 09-05-2010
* @license http://opensource.org/licenses/gpl-license-php GNU Public License
* @package FFT
*/
0 件のコメント:
コメントを投稿