MATLAB: Fast Fourier Transform

In summary, the conversation discusses using the log function to analyze a plot of a Fourier transform. The question arises as to why 1 is added to the log instead of just taking the log of the amplitude. The purpose of this analysis is to observe the symmetry property of the Fourier transform and explain any spikes that occur. The reason for adding 1 is not clear and the suggestion is made to ask the person who recommended it.
  • #1
McMurry
11
0
I have run the following command:

c = wavread('sample.wav');
amplitude = log (abs(fft(c)));

and obtained the following plot:

[PLAIN]http://img179.imageshack.us/img179/8733/withoutplusone.jpg

however, i was told to use this instead:

amplitude = log (1+abs(fft(c)));
and obtained the following plot:

[PLAIN]http://img146.imageshack.us/img146/4594/withplusone.jpg

my question is: why do we have to take the log 1 plus amplitude, instead of just the log of amplitude.

thanks.
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
TheLoser said:
there are 0s :roleeyes:

do you mean that the reason is because we can't log (0)?

is that the only reason we are adding 1 to the log?
thanks.
 
  • #3
I don't know why you would add 1. I never add 1, and plot log(abs(fft)) all the time (usually I do log10 because I want to get to decibels). If you are worried about zeros, you can always add eps or some other small number. By looking at your plot it is clear the adding 1 is covering up information you may care about. You should ask the person who suggested it to you.

jason
 
  • #4
May I ask what you are trying to learn from the data? It would help us to answer your question. Looking for peaks in the spectrum? Total noise?
 
  • #5
hi guys, thanks for the reply.

the purpose is to observe the symmetry property of Fourier transform and also to explain the spikes that is occurring.
 
  • #6
It's symmetrical because the inputs are real. If the sample.wav contained complex numbers, the output would not (necessarily) be symmetrical.
 

1. What is the Fast Fourier Transform (FFT) and why is it important in MATLAB?

The Fast Fourier Transform (FFT) is a mathematical algorithm used to quickly calculate the discrete Fourier Transform (DFT) of a signal. It is important in MATLAB because it allows for efficient and accurate analysis of signals and data in the frequency domain. This is useful for tasks such as filtering, spectral analysis, and signal processing.

2. How does the FFT differ from the regular Fourier Transform?

The FFT is a more efficient version of the regular Fourier Transform, as it reduces the computational complexity from O(n^2) to O(nlogn). This makes it much faster and more practical for real-time signal analysis and processing. The FFT also uses a divide-and-conquer approach, breaking down the signal into smaller sub-signals and combining the results to obtain the final DFT.

3. How do I perform the FFT in MATLAB?

To perform the FFT in MATLAB, you can use the built-in function fft(x), where x is the signal you want to analyze. This will return the complex amplitudes of the signal in the frequency domain. You can also use fftshift() to re-arrange the frequencies from [-fs/2, fs/2] to [0, fs], where fs is the sampling frequency.

4. What is the inverse FFT and how is it used?

The inverse FFT (IFFT) is used to convert a signal from the frequency domain back to the time domain. This is useful for tasks such as signal reconstruction, noise removal, and data compression. In MATLAB, the IFFT can be performed using the ifft() function, which takes in the complex amplitudes in the frequency domain as input and returns the time-domain signal.

5. Can the FFT be applied to any type of signal?

Yes, the FFT can be applied to any type of signal that is discrete and periodic. This includes signals such as audio, images, and digital data. However, the signal must be sampled at a constant sampling rate for the FFT to work properly. In addition, the length of the signal should be a power of 2 for optimal efficiency.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
7K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
Replies
2
Views
2K
Back
Top