MATLAB: Fast Fourier Transform

  • MATLAB
  • Thread starter McMurry
  • Start date
  • #1
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 [Broken]

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 [Broken]

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:

Answers and Replies

  • #2
11
0
there are 0s :roleeyes:
do you mean that the reason is because we cant log (0)?

is that the only reason we are adding 1 to the log?
thanks.
 
  • #3
jasonRF
Science Advisor
Gold Member
1,349
411
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
11
0
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
2
0
It's symmetrical because the inputs are real. If the sample.wav contained complex numbers, the output would not (necessarily) be symmetrical.
 

Related Threads on MATLAB: Fast Fourier Transform

Replies
1
Views
20K
Replies
1
Views
5K
  • Last Post
Replies
3
Views
5K
Replies
5
Views
37K
Replies
5
Views
969
Replies
9
Views
945
Replies
1
Views
1K
Replies
2
Views
4K
Replies
2
Views
1K
  • Last Post
Replies
7
Views
975
Top