Mercurial > hg > ishara
diff dsp/wigner.m @ 32:c3b0cd708782
Imported core dsp tools.
author | samer |
---|---|
date | Sun, 20 Jan 2013 13:48:47 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dsp/wigner.m Sun Jan 20 13:48:47 2013 +0000 @@ -0,0 +1,42 @@ +function wig = wigner(sig,m,l,k,win) +% Wigner -- Wigner-Ville Distribution. This version +% operates on an entire signal in a vector. +% Usage +% wig = wigner(sig,m,l,k,win) +% Inputs +% sig 1-d signal +% m half window length (must be power of 2) +% l number of frequencies (ie rows in output) +% k window step (defaults to 1) +% win half window of size m+1 +% Outputs +% wig complex-valued matrix representing the Wigner-Ville +% distribution of zero-extended signal with rows corresponding +% to frequencies and columns corresponding to times. +% +% Side Effects +% Image Plot of the Wigner-Ville distribution +% + +sig = sig(:); +n = length(sig); + +if nargin<4 k = 1; end +if nargin<3 l = m+1; end +if nargin<5 win = ones(m+1,1); end + +f = [zeros(m,1); sig; zeros(m,1)]; +wig = zeros(l,floor(n/k)); +ix = 0:m; + +col=1; +for t=1:k:n, + tplus = m + t + ix; + tminus = m + t - ix; + R = win .* ( f(tplus) .* f(tminus) ); + x = [ R(1:m); R(m+1:-1:2) ]; + y = fft(x); + wig(:,col) = real(y(1:l)); + col = col+1; +end +