comparison m-toolbox/classes/@specwin/win_levelledhanning.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % WIN_LEVELLEDHANNING returns Hanning window, with N points and levelCoef levelling order
2 % If mode == 'define', the window values will be empty and all the features
3 % If mode == 'build', the window values will be calculated
4 %
5 % A Grynagier 03/01/2010
6 %
7 % $Id: win_levelledhanning.m,v 1.1 2011/05/24 16:23:21 mauro Exp $
8 %
9
10 function varargout = win_levelledhanning(w, mode, N, levelCoef)
11
12 switch lower(mode)
13
14 case 'build'
15 n_args = nargin;
16 if n_args < 3
17 N = w.len;
18 end
19 if n_args < 4
20 levelCoef = w.levelorder;
21 end
22 % Calculate the values of the window
23 z = (1:N)./(N+1);
24 v = 0.5 * (1 - cos(2*pi*z));
25
26 for jj = 1:levelCoef
27 v = v.*(2-v);
28 end
29 varargout{1} = v/norm(v)*length(v)^0.5;
30
31 case 'define'
32 % Make window struct
33 w.type = 'levelledHanning';
34 w.len = N;
35 w.levelorder = levelCoef;
36 w.skip = 0;
37
38 varargout{1} = w;
39 end
40
41 % END