maxplanck735
Computer
- Mar 28, 2006
- 2
Can someone either explain or refer me to a good tutorial regarding Matlab that illustrates how to create a plot of the FFT of an audio file that has a meaningfully indexed/numbered frequency axis? This is stumping me at the moment, probably because I don't understand the inner mathematical workings of the FFT, which results in my not knowing what frequency value should be associated with which element in the array that is the result of the FFT. I've studied the Matlab help file for a long time to try to figure this out on my own, and am still stumped.
Here is my situation outlined in Matlab code, for easy understanding. I am hoping that someone can tell me what to define the variable/array "f" as in order to produce a meaningful plot of "triangle.wav" 's frequency spectrum, i.e. a spectrum in which the proper frequency value is associated with and plotted with the proper element of the FFT's output. (Note: in the example below, I've removed the latter half of the FFT's output due to the fact that the FFT's output is always perfectly symmetrical about a point near the data point(s) with the middlemost index number(s)).
>> [x,fs] = wavread('C:\Matlab7\terrorist.wav');
>> fs
fs =
44100
>> X = abs(fft(x));
>> length(X)
ans =
32647
>> Y = X(1:length(X)/2+1);
>> length(Y)
ans =
16324
>>f = ????????????
>> plot(f,Y)
Here is my situation outlined in Matlab code, for easy understanding. I am hoping that someone can tell me what to define the variable/array "f" as in order to produce a meaningful plot of "triangle.wav" 's frequency spectrum, i.e. a spectrum in which the proper frequency value is associated with and plotted with the proper element of the FFT's output. (Note: in the example below, I've removed the latter half of the FFT's output due to the fact that the FFT's output is always perfectly symmetrical about a point near the data point(s) with the middlemost index number(s)).
>> [x,fs] = wavread('C:\Matlab7\terrorist.wav');
>> fs
fs =
44100
>> X = abs(fft(x));
>> length(X)
ans =
32647
>> Y = X(1:length(X)/2+1);
>> length(Y)
ans =
16324
>>f = ????????????
>> plot(f,Y)