-
Notifications
You must be signed in to change notification settings - Fork 0
/
gwspm_filter_design.m
103 lines (90 loc) · 3.13 KB
/
gwspm_filter_design.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
function [g,gp,t,gb,gb2,gb3] = gwspm_filter_design(lmax,Nscales,hamShift,varargin)
% A modified version of nsgwt_filter_design.m by Nora Leonardi, Dimitri Van
% De Ville (2011), which itself is an extension based on
% sgwt_filter_design.m from the the SGWT toolbox.
control_params = {...
'designtype','default',...
'lpfactor',20,...
'a',2,...
'b',2,...
't1',1,...
't2',2,...
'wav_type','meyer',...
'dmax',lmax/2,...
};
argselectAssign(control_params);
argselectCheck(control_params,varargin);
argselectAssign(varargin);
g = cell(Nscales+1,1);
gp = cell(Nscales+1,1);
switch designtype
case 'default'
lmin = lmax/lpfactor;
t = sgwt_setscales(lmin,lmax,Nscales);
gl = @(x) exp(-x.^4);
glp = @(x) -4*x.^3 .*exp(-x.^4);
gb = @(x) sgwt_kernel(x,'a',a,'b',b,'t1',t1,'t2',t2);
gbp = @(x) sgwt_kernel_derivative(x,'a',a,'b',b,'t1',t1,'t2',t2);
for j = 1:Nscales
g{j+1} = @(x) gb(x*t(j));
gp{j+1} = @(x) gbp(t(j)*x)*t(j);
end
f = @(x) -gb(x);
xstar = fminbnd(f,1,2);
gamma_l = -f(xstar);
lminfac = 0.6*lmin;
gb2 = @(x) gamma_l*gl(x);
g{1} = @(x) gamma_l*gl(x/lminfac);
gp{1} = @(x) gamma_l*glp(x/lminfac)/lminfac;
case 'mh'
lmin = lmax/lpfactor;
t = sgwt_setscales(lmin,lmax,Nscales);
gb = @(x) sgwt_kernel(x,'gtype','mh');
gl = @(x) exp(-x.^4);
for j = 1:Nscales
g{j+1} = @(x) gb(t(j)*x);
end
lminfac = 0.4*lmin;
gb2 = @(x) 1.2*exp(-1)*gl(x);
g{1} = @(x) 1.2*exp(-1)*gl(x/lminfac);
case 'mey'
switch wav_type
case 'meyer'
gb = @(x) sgwt_meyer(x,'t1',t1);
gb2 = @(x) sgwt_mey_h(x,'t1',t1);
gb3 = @(x) sgwt_meyer_end(x,'t1',t1);
case 'simonc'
gb = @(x) sgwt_simonc(x,'t1',t1);
gb2 = @(x) sgwt_simonc_h(x,'t1',t1);
gb3 = @(x) sgwt_simonc_end(x,'t1',t1);
case 'shannon'
gb = @(x) sgwt_shannon(x,'t1',t1);
gb2 = @(x) sgwt_shannon_h(x,'t1',t1);
case 'papadakis'
gb = @(x) sgwt_papadakis(x,'t1',t1);
gb2 = @(x) sgwt_papadakis_h(x,'t1',t1);
case 'held'
gb = @(x) sgwt_held(x,'t1',t1);
gb2 = @(x) sgwt_held_h(x,'t1',t1);
otherwise
error('Unknown wavelet type');
end
t = sgwt_setscales_mey(lmax,Nscales,hamShift,'t1',t1);
switch wav_type
case {'meyer', 'simonc'}
for j = 1:Nscales-1
g{j+1} = @(x) gb(t(j)*x);
gp{j+1} = @(x) 0;
end
g{Nscales+1} = @(x) gb3(t(end)*x);
otherwise
for j = 1:Nscales
g{j+1} = @(x) gb(t(j)*x);
gp{j+1} = @(x) 0;
end
end
g{1} = @(x) gb2(t(1)*x);
gp{1} = @(x) 0;
otherwise
error('Unknown design type');
end