Examples of fft applications, Examples of fft applications ,16-48 – HP 50g Graphing Calculator User Manual

Page 525

Advertising
background image

Page 16-48

the number of operations using the FFT is reduced by a factor of 10000/664

15.

The FFT operates on the sequence {x

j

} by partitioning it into a number of shorter

sequences. The DFT’s of the shorter sequences are calculated and later
combined together in a highly efficient manner. For details on the algorithm
refer, for example, to Chapter 12 in Newland, D.E., 1993, “An Introduction to
Random Vibrations, Spectral & Wavelet Analysis – Third Edition,” Longman
Scientific and Technical, New York.

The only requirement for the application of the FFT is that the number n be a
power of 2, i.e., select your data so that it contains 2, 4, 8, 16, 32, 62, etc.,
points.

Examples of FFT applications

FFT applications usually involve data discretized from a time-dependent signal.
The calculator can be fed that data, say from a computer or a data logger, for
processing. Or, you can generate your own data by programming a function
and adding a few random numbers to it.

Example 1 – Define the function f(x) = 2 sin (3x) + 5 cos(5x) + 0.5*RAND,
where RAND is the uniform random number generator provided by the
calculator. Generate 128 data points by using values of x in the interval
(0,12.8). Store those values in an array, and perform a FFT on the array.

First, we define the function f(x) as a RPN program:

<< x ‘2*SIN(3*x) + 5*COS(5*x)’ EVAL RAND 5 * + NUM >>

and store this program in variable

@@@@f@@@. Next, type the following program to

generate 2

m

data values between a and b. The program will take the values of

m, a, and b:

<< m a b << ‘2^m’ EVAL n << ‘(b-a)/(n+1)’ EVAL Dx << 1 n FOR j

‘a+(j-1)*Dx’ EVAL f NEXT n ARRY >> >> >> >>

Store this program under the name GDATA (Generate DATA). Then, run the
program for the values, m = 5, a = 0, b = 100. In RPN mode, use:

5#0#100@GDATA!

Advertising