To write the FFT function without using the built-in FFT function in Matlab, we can use the Cooley-Tukey algorithm. The Cooley-Tukey algorithm is a popular and efficient method for computing the FFT.
Here's an implementation of the FFT function in Matlab using the Cooley-Tukey algorithm:
main.m515 chars30 lines
This function takes an input vector x
and computes its FFT using the Cooley-Tukey algorithm. The function recursively splits the input into even and odd parts, computes the FFT of each part, and then combines the results using twiddle factors.
Note that this implementation assumes that the length of the input sequence is a power of 2. A more general implementation would need to handle sequences of arbitrary length.
gistlibby LogSnag