# 0.17 Appendix 3: fft computer programs

 Page 1 / 6
Fortran programs for efficient DFT, Cooley-Tukey, and Prime Factor Algorithm FFTs.

## Goertzel algorithm

A FORTRAN implementation of the first-order Goertzel algorithm with in-order input as given in ( [link] ) and [link] is given below.

```C---------------------------------------------- C GOERTZEL'S DFT ALGORITHMC First order, input inorder C C. S. BURRUS, SEPT 1983C--------------------------------------------- SUBROUTINE DFT(X,Y,A,B,N)REAL X(260), Y(260), A(260), B(260) Q = 6.283185307179586/NDO 20 J=1, N C = COS(Q*(J-1))S = SIN(Q*(J-1)) AT = X(1)BT = Y(1) DO 30 I = 2, NT = C*AT - S*BT + X(I) BT = C*BT + S*AT + Y(I)AT = T 30 CONTINUEA(J) = C*AT - S*BT B(J) = C*BT + S*AT20 CONTINUE RETURNEND First Order Goertzel Algorithm ```

## Second order goertzel algorithm

Below is the program for a second order Goertzel algorithm.

```C---------------------------------------------- C GOERTZEL'S DFT ALGORITHMC Second order, input inorder C C. S. BURRUS, SEPT 1983C--------------------------------------------- SUBROUTINE DFT(X,Y,A,B,N)REAL X(260), Y(260), A(260), B(260) CQ = 6.283185307179586/N DO 20 J = 1, NC = COS(Q*(J-1)) S = SIN(Q*(J-1))CC = 2*C A2 = 0B2 = 0 A1 = X(1)B1 = Y(1) DO 30 I = 2, NT = A1 A1 = CC*A1 - A2 + X(I)A2 = T T = B1B1 = CC*B1 - B2 + Y(I) B2 = T30 CONTINUE A(J) = C*A1 - A2 - S*B1B(J) = C*B1 - B2 + S*A1 20 CONTINUEC RETURNEND Second Order Goertzel Algorithm ```

## Second order goertzel algorithm 2

Second order Goertzel algorithm that calculates two outputs at a time.

```C------------------------------------------------------- C GOERTZEL'S DFT ALGORITHM, Second orderC Input inorder, output by twos; C.S. Burrus, SEPT 1991 C-------------------------------------------------------SUBROUTINE DFT(X,Y,A,B,N) REAL X(260), Y(260), A(260), B(260)Q = 6.283185307179586/N DO 20 J = 1, N/2 + 1C = COS(Q*(J-1)) S = SIN(Q*(J-1))CC = 2*C A2 = 0B2 = 0 A1 = X(1)B1 = Y(1) DO 30 I = 2, NT = A1 A1 = CC*A1 - A2 + X(I)A2 = T T = B1B1 = CC*B1 - B2 + Y(I) B2 = T30 CONTINUE A2 = C*A1 - A2T = S*B1 A(J) = A2 - TA(N-J+2) = A2 + T B2 = C*B1 - B2T = S*A1 B(J) = B2 + TB(N-J+2) = B2 - T 20 CONTINUERETURN ENDFigure. Second Order Goertzel Calculating Two Outputs at a Time```

## Basic qft algorithm

A FORTRAN implementation of the basic QFT algorithm is given below to show how the theory is implemented. The program is written for clarity, not tominimize the number of floating point operations.

```C SUBROUTINE QDFT(X,Y,XX,YY,NN)REAL X(0:260),Y(0:260),XX(0:260),YY(0:260) CN1 = NN - 1 N2 = N1/2N21 = NN/2 Q = 6.283185308/NNDO 2 K = 0, N21 SSX = X(0)SSY = Y(0) SDX = 0SDY = 0 IF (MOD(NN,2).EQ.0) THENSSX = SSX + COS(3.1426*K)*X(N21) SSY = SSY + COS(3.1426*K)*Y(N21)ENDIF DO 3 N = 1, N2SSX = SSX + (X(N) + X(NN-N))*COS(Q*N*K) SSY = SSY + (Y(N) + Y(NN-N))*COS(Q*N*K)SDX = SDX + (X(N) - X(NN-N))*SIN(Q*N*K) SDY = SDY + (Y(N) - Y(NN-N))*SIN(Q*N*K)3 CONTINUE XX(K) = SSX + SDYYY(K) = SSY - SDX XX(NN-K) = SSX - SDYYY(NN-K) = SSY + SDX 2 CONTINUERETURN END Simple QFT Fortran Program ```

#### Questions & Answers

how can chip be made from sand
Eke Reply
is this allso about nanoscale material
Almas
are nano particles real
Missy Reply
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
Lale Reply
no can't
Lohitha
where is the latest information on a no technology how can I find it
William
currently
William
where we get a research paper on Nano chemistry....?
Maira Reply
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
Maira Reply
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
Google
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
revolt
da
Application of nanotechnology in medicine
has a lot of application modern world
Kamaluddeen
yes
narayan
what is variations in raman spectra for nanomaterials
Jyoti Reply
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
LITNING Reply
what is a peer
LITNING Reply
What is meant by 'nano scale'?
LITNING Reply
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

### Read also:

#### Get Jobilize Job Search Mobile App in your pocket Now!

Source:  OpenStax, Fast fourier transforms. OpenStax CNX. Nov 18, 2012 Download for free at http://cnx.org/content/col10550/1.22
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Fast fourier transforms' conversation and receive update notifications? By John Gabrieli By OpenStax By OpenStax By Joanna Smithback By Tony Pizur By Jonathan Long By Angela Eckman By By OpenStax By OpenStax