Search code examples
matlabsignal-processingtime-frequency

To apply window function on Wigner-Ville Distribution in Matlab


We were thinking here how to create Hamming-64 window of overlap 64. It is done by

h = hamming(64);
h2 = hamming(38);
h = conv(h, h2);

Now, we are thinking how you can apply this window function to the resulted variabels of the Wigner-Ville Distribution function of Auger et al in Time-Frequency Toolbox. The function tfrwv.m does not have any parameter for window function.

So we have these variables

[B,T,F] = tfrwv(data, 1:length(data), length(data));

Here is one answer to related problem, but not completely the same. One says that apply the window function to the results

Just multiply, point-by-point

The dimensions of h are 101x1 double, while T and F 5001x1 double. So extrapolation seems to be needed to the window vector if multiplying point-by-point.

One more explanation here

About half way through the second code block, I apply a window function to a buffered signal. This is effectively a vector multiplication of the window function with each buffered block of time series data. I just use a sneaky diagonal matrix trick to do it efficiently.

How can you apply a window function to the variables B, T, and F?


Solution

  • There was one mistake and its symptoms in my 3rd extension to lennon310's answer. 4th extension to lennon310's answer

    I run

    h = hamming(64);
    h2 = hamming(38);
    h = conv(h, h2);    
    B = 0; T = 0; F = 0;    
    data1 = filter(data(1 : 64),1,h); [B,T,F] = tfrwv(data1, 1:length(data1), length(data1));    
    for i=1:133
        data1 = filter(data( 1 + i*37 : 64 + i*37 ),1,h); [b,t,f] = tfrwv(data1, 1:length(data1), length(data1));    
        B = [B b']; T = [T t]; F = [F; f];       
    end
    data1 = filter(data(4959 : 5001),1,h); [b,t,f] = tfrwv(data1, 1:length(data1), length(data1));    
    B = [B b']; T = [T t]; F = [F; f];       
    T = 49.8899*T;      % dummy constant to get appropriate time interval
    

    and get pictures like this

    enter image description here

    I have not managed to show all thin peaks in one picture. A new question about it here.

    I am plotting this by

    t = 1/360; % 360 samples per second
    fs = 360.5;
    imagesc(T*t, F*fs, abs(B))
    

    The algorithm is accumulating the points to the right dimension. I am not sure if multiplying by the dummy constant is the right way to go earlier.