[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tftb-help] Question about TF representations as images
From: |
Eric Chassande-Mottin |
Subject: |
Re: [Tftb-help] Question about TF representations as images |
Date: |
Thu, 11 Oct 2012 09:38:08 +0200 (CEST) |
User-agent: |
Alpine 2.02 (DEB 1266 2009-07-14) |
dear Jaidev,
let me recall the mathematical definition of the Wigner-Ville
distribution
W(t,f)= int dtau x(t+tau) x^*(x-tau) exp(-2 pi i tau f)
which can be rewritten as
= int dtau R_x(t,tau) exp(-2 pi i tau f)
i.e., the Fourier transform of the local autocorrelation function R_x.
tfrwv.m implements exactly this last equation.
it computes R_x and takes the Fourier transform over tau using FFT.
for icol=1:tcol,
% for every instance of time
ti= t(icol);
% ti is the time instance
taumax=min([ti-1,xrow-ti,round(N/2)-1]);
% What is taumax?
on a computer, we are working with sampled signals of finite duration. the
above integral becomes a sum and the limits of sum have to be computed.
tfrwv.m assumes that x(.) is zero before the first sample and after the
last one. this leads to the value for taumax. tfrwv.m also allows to
restrict the length N of the FFT which explains the last term in the
min().
tau=-taumax:taumax; indices= rem(N+tau,N)+1;
% Why are we interested only in the indices in the 'indices' variable?
Windowing the input, maybe?
tfr(indices,icol) = x(ti+tau,1) .* conj(x(ti-tau,xcol));
as you can see, 'indices' contains the indices where the local
autocorrelation components (the function R_x) will be stored in the matrix
tfr. the lag axis tau runs from -taumax to +taumax. this has to be
converted into a set of indices that matches the FFT convention. zero
corresponds to index=1. positive indices runs from from 1 to N/2 and
negative indices correspond to N/2+1:N.
example:
octave:1> N=4
N = 4
octave:2> tau=[-1 0 1]
tau =
-1 0 1
octave:3> rem(N+tau,N)+1
ans =
4 1 2
% Product in the neighbourhood of -tau:tau
tau=round(N/2);
% Why this step?
the sample tau=N/2 leads to a slightly different calculation due the
Hilbert symmetry of FFT.
if (ti<=xrow-tau)&(ti>=tau+1),
tfr(tau+1,icol) = 0.5 * (x(ti+tau,1) * conj(x(ti-tau,xcol)) + ...
x(ti-tau,1) * conj(x(ti+tau,xcol))) ;
I'd be grateful if someone could walk me through this code, step by
step. I notice that this is script is common to most TFR scripts in
the toolbox, with minor modifications. I'm not getting what exactly it
does. I'm particularly interested in answering the questions, "Given a
signal f and a TFR method like STFT or WVD, how do you make the TFR
matrix?" If you can point me to a basic tutorial, that would be great
too.
The TFTB includes a tutorial available at this URL:
http://tftb.nongnu.org/tutorial.pdf
HTH,
Eric