Skip to content

Commit f383601

Browse files
author
Cove Sturtevant
committed
Add files via upload
Part 3
1 parent cdbfe37 commit f383601

81 files changed

Lines changed: 12760 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
%****s* WMTSA-DWT/Structures
2+
%
3+
% NAME
4+
% WMTSA DWT Structures -- structs used in WMTSA DWT toolbox.
5+
%
6+
% DESCRIPTION
7+
% MATLAB structures used in WMTSA DWT toolbox.
8+
%
9+
% TOOLBOX
10+
% wmtsa/dwt
11+
%
12+
% CATEGORY
13+
%
14+
%
15+
%***
16+
%****s* Structures/wtf_s
17+
%
18+
% NAME
19+
% wtf_s -- wavelet transform filter struct.
20+
%
21+
% DESCRIPTION
22+
% wtf_s struct has fields:
23+
% * g -- scaling (low-pass) filter coefficients (vector).
24+
% * h -- wavelet (high-pass) filter coefficients (vector).
25+
% * L -- filter length (= number of coefficients) (integer).
26+
% * Name -- name of wavelet filter (character string).
27+
% * Class -- class of wavelet filters (character string).
28+
% * Transform -- name of transform (character string).
29+
%
30+
% Possible values for transform are: DWT, MODWT.
31+
%
32+
% SEE ALSO
33+
%
34+
%***
35+
%****s* Structures/w_att_s
36+
%
37+
% NAME
38+
% w_att_s -- wavelet transform attributes struct.
39+
%
40+
% DESCRIPTION
41+
% w_att_s struct has fields:
42+
% * Transform -- name of transform ('MODWT') (string).
43+
% * WTF -- name of wavelet transform filter or a wtf_s struct (string or struct).
44+
% * NX -- number of observations in original series (= length(X)) (integer).
45+
% * NW -- number of wavelet coefficients (integer).
46+
% * J0 -- number of levels of partial decompsition (integer).
47+
% * NChan -- number of channels in a multivariate dataset (integer).
48+
% * Boundary -- boundary conditions applied (string).
49+
% * Aligned -- Boolean flag indicating whether coefficients are aligned
50+
% with original series (1 = true) or not (0 = false) (boolean).
51+
% * RetrainVJ -- Boolean flag indicating whether VJ scaling coefficients at all
52+
% levels have been retained (1= true) or not (0 = false) (boolean).
53+
%
54+
% Possible values for transform are: DWT, MODWT.
55+
%
56+
% SEE ALSO
57+
%
58+
%***
59+
60+
% AUTHOR
61+
% Charlie Cornish
62+
%
63+
% CREATION DATE
64+
% 2005-03-03
65+
%
66+
% COPYRIGHT
67+
% (c) Charles R. Cornish 2005
68+
%
69+
% REVISION
70+
% $Revision: 630 $
71+
%
72+
73+
% $Id: DWT_Structures.m 630 2006-05-02 20:47:17Z ccornish $
74+
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
function nuGj = advance_scaling_filter(wtfname, j)
2+
% advance_scaling_filter -- Calculate the value to advance scaling filter at jth level for a given wavelet.
3+
%
4+
%****f* wmtsa.dwt/advance_scaling_filter
5+
%
6+
% NAME
7+
% advance_scaling_filter -- Calculate the value to advance scaling filter at jth level for a given wavelet.
8+
%
9+
% SYNOPSIS
10+
% nuGj = advance_scaling_filter(wtfname, level)
11+
%
12+
% INPUTS
13+
% wtfname = string containing name of WMTSA-supported wavelet filter.
14+
% j = jth level (index) of scale or a range of j levels of scales
15+
% (integer or vector of integers).
16+
%
17+
% OUTPUTS
18+
% nuGj = advance of scaling filter at specified levels.
19+
%
20+
% SIDE EFFECTS
21+
% wavelet is a WMTSA-supported scaling filter; otherwise error.
22+
%
23+
% DESCRIPTION
24+
%
25+
%
26+
% EXAMPLE
27+
%
28+
%
29+
% ALGORITHM
30+
% nuGj = (2^j - 1) * nu
31+
%
32+
% For details, see equation 114a of WMTSA.
33+
%
34+
% REFERENCES
35+
% Percival, D. B. and A. T. Walden (2000) Wavelet Methods for
36+
% Time Series Analysis. Cambridge: Cambridge University Press.
37+
%
38+
% SEE ALSO
39+
% advance_time_series_filter, dwt_filter
40+
%
41+
42+
% AUTHOR
43+
% Charlie Cornish
44+
%
45+
% CREATION DATE
46+
% 2003-05-08
47+
%
48+
% COPYRIGHT
49+
%
50+
%
51+
% REVISION
52+
% $Revision: 612 $
53+
%
54+
%***
55+
56+
% $Id: advance_scaling_filter.m 612 2005-10-28 21:42:24Z ccornish $
57+
58+
usage_str = ['Usage: nuGj = ', mfilename, ...
59+
' (wtfname, j)'];
60+
61+
62+
%% Check input arguments and set defaults.
63+
error(nargerr(mfilename, nargin, [2:2], nargout, [0:1], 1, usage_str, 'struct'));
64+
65+
% Check for valid wavelet and get wavelet filter coefficients
66+
try
67+
wtf_s = dwt_filter(wtfname);
68+
catch
69+
rethrow(lasterror);
70+
end
71+
h = wtf_s.h;
72+
g = wtf_s.g;
73+
L = wtf_s.L;
74+
75+
error(argterr(mfilename, j, 'int0', [], 1, '', 'struct'));
76+
77+
nuGj = NaN;
78+
79+
switch lower(wtfname)
80+
case 'haar'
81+
nuGj = advance_wavelet_filter('haar', j);
82+
83+
otherwise
84+
85+
nu = advance_time_series_filter(wtfname);
86+
87+
nuGj = (2.^j - 1) * nu;
88+
89+
end
90+
91+
return
92+
93+
94+
95+
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
function nu = advance_time_series_filter(wtfname)
2+
% advance_time_series_filter -- Calculate the advance of the time series or filter for a given wavelet.
3+
%
4+
%****f* wmtsa.dwt/advance_time_series_filter
5+
%
6+
% NAME
7+
% advance_time_series_filter -- Calculate the advance of the time series or filter for a given wavelet.
8+
%
9+
% SYNOPSIS
10+
% nu = advance_time_series_filter(wtfname)
11+
%
12+
% INPUTS
13+
% wtfname - string containing name of WMTSA-supported wavelet filter.
14+
%
15+
% OUTPUTS
16+
% nu - advance of time series for specified wavelet filter.
17+
%
18+
% SIDE EFFECTS
19+
% wavelet is a WMTSA-supported wavelet filter; otherwise error.
20+
%
21+
% DESCRIPTION
22+
%
23+
%
24+
% EXAMPLE
25+
%
26+
%
27+
% ALGORITHM
28+
%
29+
% For Least Asymmetric filters, equation 112e of WMTSA:
30+
% nu = -L/2 + 1, for L/2 is even;
31+
% = -L/2, for L = 10 or 18;
32+
% = -L/2 + 2, for L = 14.
33+
%
34+
% For Best Localized filter, page 119 of WMTSA.
35+
% nu = -5, for L = 14;
36+
% = -11, for L = 18;
37+
% = -9, for L = 20.
38+
%
39+
% For Coiflet filters, page 124 and equation 124 of WMTSA:
40+
% nu = -2*L/3 + 1
41+
%
42+
% REFERENCES
43+
% Percival, D. B. and A. T. Walden (2000) Wavelet Methods for
44+
% Time Series Analysis. Cambridge: Cambridge University Press.
45+
%
46+
% SEE ALSO
47+
% dwt_filter
48+
%
49+
50+
% AUTHOR
51+
% Charlie Cornish
52+
%
53+
% CREATION DATE
54+
% 2003-05-08
55+
%
56+
% COPYRIGHT
57+
%
58+
%
59+
% REVISION
60+
% $Revision: 612 $
61+
%
62+
%***
63+
64+
% $Id: advance_time_series_filter.m 612 2005-10-28 21:42:24Z ccornish $
65+
66+
67+
usage_str = ['Usage: nu = ', mfilename, ...
68+
' (wtfname)'];
69+
70+
%% Check input arguments and set defaults.
71+
error(nargerr(mfilename, nargin, [1:1], nargout, [0:1], 1, usage_str, 'struct'));
72+
73+
% Check for valid wavelet and get wavelet filter coefficients
74+
try
75+
wtf_s = dwt_filter(wtfname);
76+
catch
77+
rethrow(lasterror);
78+
end
79+
h = wtf_s.h;
80+
g = wtf_s.g;
81+
L = wtf_s.L;
82+
83+
84+
nu = NaN;
85+
86+
switch lower(wtfname)
87+
88+
% Haar filter
89+
case {'haar'}
90+
nu = 0;
91+
92+
% Haar filter
93+
% Value from Figure 115
94+
case {'d4'}
95+
nu = -1;
96+
97+
% Extremal Phase filters
98+
% case {'haar', 'd4', 'd6', 'd8', 'd12', 'd14', 'd16', 'd18', 'd20'}
99+
case { 'd6', 'd8', 'd12', 'd14', 'd16', 'd18', 'd20'}
100+
error('Need to determine nu for Extremal Phase filters - Is it -1 for all filters?.');
101+
102+
% Least Asymmetric filters
103+
case { 'la8', 'la10', 'la12', 'la14', 'la18', 'la16', 'la20'}
104+
nu = advance_least_asymetric_filter(L);
105+
106+
% Best Localized filters
107+
case {'bl14', 'bl18', 'bl20'}
108+
nu = advance_best_localized_filter(L);
109+
110+
% Coiflet filters
111+
case {'c6', 'c12', 'c18', 'c24', 'c30'}
112+
nu = advance_coiflet_filter(L);
113+
114+
otherwise
115+
% Do nothing
116+
end
117+
118+
return
119+
120+
function nu = advance_least_asymetric_filter(L)
121+
% Equation 112c of WMTSA.
122+
if (mod(L/2, 2) == 0)
123+
% L/2 is even, i.e. L = 8, 12, 16, 20
124+
nu = -(L/2) + 1;
125+
else
126+
switch (L)
127+
case {10, 18}
128+
nu = -(L/2);
129+
case {14}
130+
nu = -(L/2) + 2;
131+
otherwise
132+
error(['Invalid filter length (L = ', int2str(L), ') ' ...
133+
'specified.']);
134+
end
135+
end
136+
137+
return
138+
139+
function nu = advance_best_localized_filter(L)
140+
% Page 119 of WMTSA.
141+
switch L
142+
case 14
143+
nu = -5;
144+
case 18
145+
nu = -11;
146+
case 18
147+
nu = -9;
148+
otherwise
149+
% Do nothing
150+
end
151+
return
152+
153+
function nu = advance_coiflet_filter(L)
154+
% Page 124 and equation 124 of WMTSA:
155+
nu = -(2 * L / 3) + 1;
156+
return
157+
158+
159+
160+

0 commit comments

Comments
 (0)