Pregunta

I have the following code in matlab:

[Sound Fs bits] = wavread('a.wav');

Now i have to use the function spectrogram and plot it (i have to give the function spectrogram the following arguments: Sound and Fs and the function is suposed to return a vector with the frequence composition of the signal and a vector with the frequences in wich the composition was calculated).

My doubt is: how do i use the function with these specifications? Can someone help me?

¿Fue útil?

Solución

The spectrogram function is expecting a vector windowing argument in its second argument, if supplied. You need to supply values for all the arguments up to and including Fs. But these arguments can optionally be empty, so you can do:

[S, F, T] = spectrogram(Sound, [], [], [], Fs);
% Sample rate is the fifth argument        ^^

Although note that, to use this function properly, you really should understand what the rest of the parameters do/mean... (I'm not going to explain them here; you could write entire books on the topic, and indeed many have been)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top