MATLAB-function that calculates discrete Fourier transform

1 view (last 30 days)
Hello,
I have to write a MATLAB-function that calculates the discrete Fourier transform and the inverse Fourier transform of a vector.
The input consists of a vector of length 2^N, where N is a natural number, so the length of the vector is a power of 2. I am not allowed to use functions like fft and ifft.
I have no idea how to start.
Thanks in advance!
  2 Comments
John D'Errico
John D'Errico on 30 Mar 2015
Well, if you have absolutely no idea, then you are probably in the wrong class. Did you take notes in class? Do you have a text for the class? Lacking all of that, you might just use Google. It is your friend. "fft formula" might be a place to start. I'll bet there is a formula for this, IF you looked in those places. It need not be superbly efficient. Make an effort. Unless of course, you just forgot to show up the first few months for class.
You start by creating a function in the MATLAB editor. Then looking at the formula that you found, you type it in.
Image Analyst
Image Analyst on 30 Mar 2015
Do you have to write the fft function yourself (basically creating your own version of the built-in fft() function), OR can you write a function that calls the built-in fft() function, and then perhaps does some other stuff, like asking for an input data file, or plotting, or whatever? Which is it?

Sign in to comment.

Answers (1)

Mahdiyar
Mahdiyar on 30 Mar 2015
Hi Tom
The best way to write any matlab code is that:
First, you have to know what you want to do, in technical point of view. For example, in this case you have to perfectly know how to calculate the discrete FFt.
Second, you have to make a flowchart or write a pseudo code.
Finally you may write each step very easily.
regards,

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!