matlabdistributiontime-frequency

To scale values from Wigner-Ville Distribution to real range in Matlab


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 duplicate part of the distribution
imagesc(T, F, abs(B));
colormap(hot);
xlabel('t [s]');
ylabel('f [Hz]');

I get

enter image description here

The frequency should be within [0,180] Hz and time [0,2.5s].

How can you scale time and frequency to the real values?

The manuals says

%TFRWV  Wigner-Ville time-frequency distribution.
%   [TFR,T,F]=TFRWV(X,T,N,TRACE) computes the Wigner-Ville distribution
%   of a discrete-time signal X, 
%   or the cross Wigner-Ville representation between two signals. 
% 
%   X     : signal if auto-WV, or [X1,X2] if cross-WV.
%   T     : time instant(s)          (default : 1:length(X)).
%   N     : number of frequency bins (default : length(X)).
%   TRACE : if nonzero, the progression of the algorithm is shown
%                                    (default : 0).
%   TFR   : time-frequency representation. When called without 
%           output arguments, TFRWV runs TFRQVIEW.
%   F     : vector of normalized frequencies.
%
%   Example :
%    sig=fmlin(128,0.1,0.4); tfrwv(sig);
% 

and I Run

[B,T,F] = tfrwv(data, 1:length(data), length(data), hamming(length(data)/10), hamming(length(data)/4));

and I get

Error using tfrwv
Too many input arguments.

Error in flow_wv (line 8)
    [B,T,F] = tfrwv(data, 1:length(data), length(data),
    hamming(length(data)/10), hamming(length(data)/4));

I think the problem here is initialising the windows for time and frequency. I am trying to manipulate the both axis, by editing the values of the parameters.

A corresponding Spectrogram of the same data but with axis of right labels is, done by Matlab's default spectrogram function, discussion here:

enter image description here


Solution

  • 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

    enter image description here