While MATLAB 6.5 and earlier versions of the software contained a function called "specgram" that could handle the plotting of a signal's spectrogram, the newer versions come with improved functionality such as 3D rendering. Even though the old definition of the function is still supported, the use of "spectrogram" instead of "specgram" is highly recommended, especially since "specgram" is likely to be completely removed from future versions of MATLAB.
- Skill level:
Other People Are Reading
Open a new MATLAB project. Go to "File" and then click on "New."
Use the following line of code to load a speech signal from your computer:"[x, fs] = wavread('test.wav')." 'Test.wav' is the name of the file you will be using for plotting the spectrogram.
Use the spectrogram function to display the spectrogram of the signal in a new window as follows:
Add a "yaxis" flag to the command if you wish to have time represented on the horizontal axis. This step is optional, but will help render the most common representation of a spectrogram. The corresponding line of code is: "spectrogram(x, 'yaxis')."
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for