I run by using the function tfrwv.m in Time-Frequency Toolbox
[B,T,F] = tfrwv(data, 1:length(data), length(data), 1);
B(1:130, :) = 0; % remove the duplic
There is no concept of overlap in the Wigner-Ville distribution. That only applies to STFT and the Spectrogram which is the square modulus of the STFT.
The results from the 'tfrwv' (and all the TFR calculations in the TFTB) are in normalized frequency units. You can't get the units in frequency and seconds with out supplying a sampling frequency\rate.
This is too many input arguments.
[B,T,F] = tfrwv(data, 1:length(data), length(data), hamming(length(data)/10), hamming(length(data)/4));
There are three output arguments and up to four input arguments, so yeah giving it five is going to throw an error. Also, the fourth input argument is a boolean for turning on tracing which just prints some progress info to the Matlab command window as it calculates.
Just for a reality check make your tfrwv
call with no output arguments (i.e. >> tfrwv(blah, blah);
) this will cause it to call tfrqview
which is a menu driven plotting tool. On of the options in the menu is to change the sampling frequency (enter you sampling frequency in Hertz at the Matlab command prompt) and it will update the figure to have actual frequencies on the y-axis and times on the x-axis. Otherwise the default is normalized frequency and the y-axis is actually time in units of samples.
To do this by-hand, you will need to use a 3D "plot", one where you can use the sampling rate to convert the T
and F
vectors to be true time and true frequency instead of samples and normalized frequency (normalized frequency being [0 0.5]). Then the TFR
is used to apply a color to the z-axis, i.e. >>imagesc(T.*1/Fs, F.*Fs, TFR);
The TFTB is an awesome toolbox with the best documentation I've ever seen from an open-source third party Matlab toolbox. Dig around in it for the "refguide.pdf" and "tutorial.pdf".
I think tfrwv
is equivalent to spectrogram
if you use the following command.
Time-interval is t = 1/360
.
Choose fs = 360.5
.
imagesc(T*t, F*fs, abs(B));
There are more peaks in tfrwv
probably because the window size and overlap are different from what you used in spectrogram
.
The result