comparison m-toolbox/test/test_specwin_nenbw_definition.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 % Test specwin/specwin normalized equivalent noise bandwidth definition.
2 %
3 % M Hueller 06-03-09
4 %
5 % $Id: test_specwin_nenbw_definition.m,v 1.1 2009/03/06 09:26:28 mauro Exp $
6 %
7 win_names = {'Rectangular', ...
8 'Welch', ...
9 'Bartlett', ...
10 'Hanning', ...
11 'Hamming', ...
12 'Nuttall3', ...
13 'Nuttall4', ...
14 'Nuttall3a', ...
15 'Nuttall3b', ...
16 'Nuttall4a', ...
17 'Nuttall4b', ...
18 'Nuttall4c', ...
19 'BH92', ...
20 'SFT3F', ...
21 'SFT3M', ...
22 'FTNI', ...
23 'SFT4F', ...
24 'SFT5F', ...
25 'SFT4M', ...
26 'FTHP', ...
27 'HFT70', ...
28 'FTSRS', ...
29 'SFT5M', ...
30 'HFT90D', ...
31 'HFT95', ...
32 'HFT116D', ...
33 'HFT144D', ...
34 'HFT169D', ...
35 'HFT196D', ...
36 'HFT223D', ...
37 'HFT248D'};
38
39 % Different parameters for the Kaiser window family
40 psll = [50:50:300];
41 % Lenght of the window
42 npts = 100;
43
44 N = length(win_names);
45 M = length(psll);
46 def_dif = zeros(N+M,1);
47
48 % All windows but Kaiser
49 for jj = 1:N
50 w = specwin(win_names{jj},npts);
51 % Definition from the specwin constructor (included in a helper dedicated
52 % to each window)
53 d1 = w.nenbw;
54 % Definition from the "theory"
55 d2 = w.ws2/(w.ws)^2/fs*length(w.win);
56 % Relative difference
57 def_dif(jj) = (d1-d2)/mean([d1,d2]);
58 disp([win_names{jj} ' ' num2str(def_dif(jj))]);
59 end
60
61 % Kaiser windows
62 for jj = N+1:N+M
63 w = specwin('Kaiser',psll(jj-N),npts);
64 % Definition from the specwin constructor (included in a helper dedicated
65 % to each window)
66 d1 = w.nenbw;
67 % Definition from the "theory"
68 d2 = w.ws2/(w.ws)^2/fs*length(w.win);
69 % Relative difference
70 def_dif(jj) = (d1-d2)/mean([d1,d2]);
71 disp(['Kaiser' num2str(psll(jj-N)) ' ' num2str(def_dif(jj))]);
72 end