|
1 | | -function out = CP_wavelet_varchg(y, wname, level, maxnchpts, minDelay) |
| 1 | +function out = CP_wavelet_varchg(y, wName, level, maxnchpts, minDelay) |
2 | 2 | % CP_wavelet_varchg Variance change points in a time series. |
3 | 3 | % |
4 | 4 | % Finds variance change points using functions from Matlab's Wavelet Toolbox, |
|
9 | 9 | % |
10 | 10 | % y, the input time series |
11 | 11 | % |
12 | | -% wname, the name of the mother wavelet to analyze the data with: e.g., 'db3', |
| 12 | +% wName, the name of the mother wavelet to analyze the data with: e.g., 'db3', |
13 | 13 | % 'sym2', cf. Wavelet Toolbox Documentation for details |
14 | 14 | % |
15 | 15 | % level, the level of wavelet decomposition |
|
62 | 62 | % ------------------------------------------------------------------------------ |
63 | 63 | N = length(y); % time-series length |
64 | 64 |
|
65 | | -if nargin < 2 || isempty(wname) |
66 | | - wname = 'db3'; % default wavelet |
| 65 | +if nargin < 2 || isempty(wName) |
| 66 | + wName = 'db3'; % default wavelet |
67 | 67 | end |
68 | 68 |
|
69 | 69 | if nargin < 3 || isempty(level) |
70 | 70 | level = 3; % level of wavelet decomposition |
71 | 71 | end |
72 | 72 | if strcmp(level,'max') |
73 | | - level = wmaxlev(N,wname); |
| 73 | + level = wmaxlev(N,wName); |
74 | 74 | end |
75 | 75 |
|
76 | 76 | if nargin < 4 || isempty(maxnchpts) |
|
84 | 84 | minDelay = ceil(minDelay*N); |
85 | 85 | end |
86 | 86 |
|
87 | | -if wmaxlev(N, wname) < level |
| 87 | +if wmaxlev(N, wName) < level |
88 | 88 | error('Chosen level, %u, is too large for this wavelet on this signal. Sorry.', level); |
89 | 89 | end |
90 | 90 |
|
|
97 | 97 | % ------------------------------------------------------------------------------ |
98 | 98 |
|
99 | 99 | % Perform a single-level wavelet decomposition : |
100 | | -[c, l] = wavedec(y,level,wname); |
| 100 | +[c, l] = wavedec(y,level,wName); |
101 | 101 |
|
102 | 102 | % Reconstruct detail at the same level. |
103 | | -det = wrcoef('d',c,l,wname,level); |
| 103 | +det = wrcoef('d',c,l,wName,level); |
104 | 104 |
|
105 | 105 | % ------------------------------------------------------------------------------ |
106 | 106 | % 2. Replace 2% of the greatest (absolute) values by the mean |
|
0 commit comments