How do I perform fft in MATLAB without inbuilt function?

Why wouldn't you want to use the inbuilt function?
Otherwise - write your own.
  • Define a function called fft
  • Google/work out how an fft is performed (here seems a good start)
  • Transcribe that algorithm into your function
  • Call your new function
I'm not entirely sure what benefit that gives you over the inbuilt method, but there you go.
This is a function which performs a discrete Fourier transform (greatest accuracy is achieved with the highest N)
  1. function X = dft(x,N)
  2. %fast Fourier transform
  3. X = zeros(1,length(X));
  4. k=1;
  5. while k<length(X);
  6. n=0;
  7. tempSum=0;
  8. while n<N
  9. tempSum = tempSum + x(n)*exp(-1i * 2*pi*k*n/N);
  10. n=n+1;
  11. X(k) =tempSum;
  12. k=k+1;
To make it a fast Fourier transform, you need to work out which bits you can shave off, or what bits you can reuse.
I leave that as an exercise to the reader….
(But here's a hint….someone has already gone through all of that bother for you….it's called the inbuilt method)

For any help- MATLABSolutions

Comments

Popular posts from this blog

What are applications of MATLAB?

How can I learn genetic algorithm using MATLAB (to be precise).

What are some good dissertation tips?