forked from ltfat/ltfat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_firwin.m
72 lines (46 loc) · 1.62 KB
/
test_firwin.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function test_failed=test_firwin
%TEST_FIRWIN Test the firwin windows
%
% This test script verifies the properties listed in the help of firwin
allwins = getfield(arg_firwin,'flags','wintype');
test_failed=0;
disp(' =============== TEST_FIRWIN ================');
for L=[18,19,20,21]
for cent=0:1
if cent==0
centtype='wp';
else
centtype='hp';
end;
for ii=1:length(allwins);
winname=allwins{ii};
[g,info]=firwin(winname,L,centtype);
res = 1-isevenfunction(fir2long(g,2*L),centtype);
[test_failed,fail]=ltfatdiditfail(res,test_failed);
s=sprintf(['SYMM %10s %s L: %i %0.5g %s'],winname,centtype,L,res,fail);
disp(s);
if cent==0
res=1-g(1);
[test_failed,fail]=ltfatdiditfail(res,test_failed);
s=sprintf(['PEAK %10s %s L: %i %0.5g %s'],winname,centtype,L,res,fail);
disp(s);
end;
if mod(L,2)==0
if info.ispu
gpu=g+fftshift(g);
res=norm(gpu-gpu(1)*ones(L,1));
[test_failed,fail]=ltfatdiditfail(res,test_failed);
s=sprintf(['PU %10s %s L: %i %0.5g %s'],winname,centtype,L,res,fail);
disp(s);
end;
if info.issqpu
gpu=g.^2+fftshift(g.^2);
res=norm(gpu-gpu(1)*ones(L,1));
[test_failed,fail]=ltfatdiditfail(res,test_failed);
s=sprintf(['SQPU %10s %s L: %i %0.5g %s'],winname,centtype,L,res,fail);
disp(s);
end;
end;
end;
end;
end;