# Wigner Ville distribution - Integrating in time domain

11 views (last 30 days)
Sveinung Attestog on 28 Jan 2020
Commented: Sveinung Attestog on 21 Sep 2020
Have been trying to make by own function for computing the Wigner Ville distribution. One consern I have is that my estimation seems to have simular shape, but the amplitude is smaller by a large factor (In this case a factor of 2000).
n=1000;
endtime=1;
time=linspace(0,endtime,n*endtime);
Noise=normrnd(0,0.1,[1,endtime*n]);
xk1 = sin(2*pi*50*(time));
xk2 = 0*sin(2*pi*49*(time));
xk=xk1+xk2;
%% My Wigner Ville distribution algorythm
%Hilbert transform of data set
hil_xk=hilbert(xk);
%Defining time parameter
tau_delta=endtime/(n); %Increments of tau during integration
t=endtime*0.6; %Set time which I'm computing for
t_start=0; %Start of data set
t_end=endtime; %End of data set
tau_max=2*min(t-t_start,t_end-t); %Computing the limits for tau which is necesary for integrating. Either x or x* will be 0 if it's any larger
%Setting up frequency which will be computed
f=(0:1/(2*endtime):100-1/(2*endtime));
tau=(-tau_max:tau_delta:tau_max)';
%Computing all element of the function that will be integrated
x=interp1(time,hil_xk,t+tau/2);
xconj=conj(interp1(time,hil_xk,t-tau/2));
Xj=xconj.*x.*exp(-2*pi*1i*tau*f);
%Integration with resect to tau for different values of frequency f
Q=trapz(tau,Xj)/(2*pi);
%The signal
figure
plot(time,xk)
W2=wvd(xk');
f2=linspace(0,n/2,(n*endtime));
figure;
plot(f2,W2(:,endtime*n)*0.1/200)
xlim([0 100])
hold on
plot(f,(real(Q)'));
legend('Matlab','My function')
grid
title('Wigner distribution t=0.5')
Sveinung Attestog on 21 Sep 2020
Hope this will help. It's one of my scipt, which I probably based on another script I found online. It was currently set to a Choi-Williams kernal function, but I changed it to Wigner-Ville for you. Hope this will help. This example generates a matrix 5000*5000 for the images (Time period: 5 sec, sampling frequency: 1 kHz). It comutes in less than 2 sec (Checked by matlabs tic toc function).
Sorry if it is a little bit messy

### Categories

Find more on Time-Frequency Analysis in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by