version 1.1, 2005/09/27 13:50:43
|
version 1.6, 2007/12/31 18:40:24
|
Line 1
|
Line 1
|
|
\ fast fourier transform |
|
|
|
\ Copyright (C) 2005,2007 Free Software Foundation, Inc. |
|
|
|
\ This file is part of Gforth. |
|
|
|
\ Gforth is free software; you can redistribute it and/or |
|
\ modify it under the terms of the GNU General Public License |
|
\ as published by the Free Software Foundation, either version 3 |
|
\ of the License, or (at your option) any later version. |
|
|
|
\ This program is distributed in the hope that it will be useful, |
|
\ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
\ GNU General Public License for more details. |
|
|
|
\ You should have received a copy of the GNU General Public License |
|
\ along with this program. If not, see http://www.gnu.org/licenses/. |
|
|
\ *** Fast Fourier Transformation *** 15may93py |
\ *** Fast Fourier Transformation *** 15may93py |
|
|
require complex.fs |
require complex.fs |
Line 50 Carray expix
|
Line 69 Carray expix
|
BEGIN 2dup > WHILE dup 2* swap fft-step |
BEGIN 2dup > WHILE dup 2* swap fft-step |
REPEAT 2drop drop ; |
REPEAT 2drop drop ; |
|
|
: normalize ( -- ) #points dup s>f 1/f |
: fftscale ( r -- ) |
0 DO I values dup z@ 2 fpick zscale z! LOOP fdrop ; |
#points 0 DO I values dup z@ 2 fpick zscale z! LOOP fdrop ; |
|
: normalize ( -- ) #points s>f 1/f fftscale ; |
|
|
: fft ( -- ) #points true (fft ; |
: fft ( -- ) #points true (fft ; |
: rfft ( -- ) #points false (fft ; |
: rfft ( -- ) #points false (fft ; |
|
|
|
: hamming ( -- ) #points 0 DO |
|
I values dup z@ pi I #points fm*/ fsin f**2 f2* zscale z! |
|
LOOP ; |
|
|