diff m-toolbox/classes/@specwin/win_kaiser.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@specwin/win_kaiser.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,38 @@
+% WIN_KAISER returns Kaiser window, with N points and psll peak sidelobe level.
+% If mode == 'define', the window values will be empty and all the features
+% If mode == 'build', the window values will be calculated
+%
+% A Grynagier 03/01/2010
+%
+% $Id: win_kaiser.m,v 1.2 2011/05/25 07:30:08 mauro Exp $
+%
+
+function varargout = win_kaiser(w, mode, N, psll)
+  
+  switch lower(mode)
+    
+    case 'build'
+      n_args = nargin;
+      if n_args < 3
+        N = w.len;
+      end
+      
+      % Compute window samples
+      % - here we adjust to make the window asymmetric
+      v = kaiser(N+1, pi*w.alpha)';
+      varargout{1} = v(1:end-1);
+      
+    case 'define'
+      % Make window struct
+      w.type         = 'Kaiser';
+      w.alpha        = specwin.kaiser_alpha(psll);
+      w.psll         = psll;
+      w.rov          = specwin.kaiser_rov(w.alpha);
+      w.nenbw        = specwin.kaiser_nenbw(w.alpha);
+      w.w3db         = specwin.kaiser_w3db(w.alpha);
+      w.flatness     = specwin.kaiser_flatness(w.alpha);
+      w.len          = N;
+      w.skip         = 0;
+      
+      varargout{1}   = w;
+  end