Bare Essential Matlab Commands For Fourier Analysis of

a WAV file

 

Note: This assumes you have used the "cd" command (change directory) to

move to the directory (folder) where your file is.

 

(You can save time by cutting and pasting from here to Matlab as opposed to re-typing. You have to do it one line at a time – Matlab is an interpreted language)

 

>>[wave,fs]=wavread('your_file_name.wav');               /* read file into memory */

>>sound(wave,fs);                                                            /* see what it sounds like */

>>t=0:1/fs:(length(wave)-1)/fs;                                    /* and get sampling frequency */

>>plot(t,wave);                                                        /* graph it – try zooming while its up…not much visible until you do*/

>>n=length(wave)-1;                                             

>>f=0:fs/n:fs;

>>wavefft=abs(fft(wave));                                 /* perform Fourier Transform */

>>plot(f,wavefft);                                               /* plot Fourier Transform  */

 

now go into the plot you have generated and use the "zoom" feature to see what the frequency is that you are looking for. Simply looking at the graph will get you little information.

 

 

Comments on moving around among folders in Matlab:

 

            Matlab is a Dos oriented language and predates Windows.  The "cd" command is for "change directory". Essentially the

            same as in Unix.  You either  >cd folder_name to  go down into a folder  or  > cd .. to go up one level.  Also " \"

            stands for the root directory so doing   >>cd \  puts you there.

 

            If you try to use a folder name which has blanks in it, put the whole folder name in single quotes:

 

                                                >>cd 'My Matlab Files'

 

            The command "dir" will list files  like "ls" does in Unix

 

            It accepts qualifiers  such as:   >>dir *.wav      which will only display files ending in .wav