diff dsp/wignerdata.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/wignerdata.m	Sun Jan 20 13:48:47 2013 +0000
@@ -0,0 +1,37 @@
+function Z=wignerdata(m,X)
+% sliding window wigner distribution. feature:
+% - low pass filter because of undersampling of 
+%   autocorrelation function
+% - windowing of autocorrelation to avoid spectral leakage
+% - temporal smoothing followed by down sampling
+
+	N = 2*m+1; % frame size
+
+	[ filtB, filtA ] = butter( 5, 0.5);
+
+	% make sure frames are N samples long
+
+	% lowpass signal, get autocorrelation in wigner form,
+	% then short term average (exponential window) by 1st
+	% order IIR.
+	Im=m+1:2*m+1;
+	Ip=m+1:-1:1;
+	Z=map(@wiglocal,select(filtA,filtB,X));
+
+	function z=wiglocal(m,Im,Ip,X)
+		r=X(Ip,:).*X(Im,:);	
+		%smoothing??
+		smKernel = gauss_win(128,0.4)';
+		wigR = spdiag(hgauss_win(m,0.5))*r;
+		% must filter and subsample wigR here
+		smRS = filter2(smKernel, wigR, 'valid');
+		% subsample in time here?
+
+		% take real fft using window
+		z = abs(fft([smR(1:m,:); smR(m+1:-1:2,:)]));
+	end
+end
+
+
+
+