## [586fe9]: wavelets / wfilt_symds.m Maximize Restore History

 ``` 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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203``` ```function [h,g,a,info] = wfilt_symds(N) %WFILT_SYMDS Symmetric wavelets dyadic sibling % Usage: [h,g,a] = wfilt_symds(N); % % `[h,g,a]=wfilt_symds(N)` Returns symmetric dyadic sibling wavelet filters. % The redundancy is equal to 2. % % Examples: % --------- % ::: % figure(1); % wfiltinfo('ana:symds3'); % figure(2); % wfiltinfo('syn:symds3'); % % References: abdelnour2012sib % info.istight = 0; a = [2;2;2;2]; switch(N) case 1 % Example 1. Not a tight frame! harr = [ -5 3 -1 0 -7 17 -2 -1 35 11 -3 -2 105 -31 12 -3 105 -31 -3 12 35 11 -2 -3 -7 17 -1 -2 -5 3 0 -1 ]; harr(:,1)=harr(:,1)*sqrt(2)/2^8; harr(:,2)=harr(:,2)/2^7; harr(:,3:4)=harr(:,3:4)/2^4; if(nargout>1) garr = [ 0 0 0 0 -3 -5 0 -1 5 -13 -1 -2 30 18 -2 6 30 18 6 -2 5 -13 -2 -1 -3 -5 -1 0 0 0 0 0 ]; garr(:,1)=garr(:,1)*sqrt(2)/2^6; garr(:,2)=garr(:,2)/2^6; garr(:,3:4)=garr(:,3:4)/2^3; end; case 2 % Example 2. Not a tight frame! harr = [ 0 0 0 0 0 0 0 0 0 -sqrt(2)/2^5 -1/2^3 0 -sqrt(2)/2^5 -4*sqrt(2)/2^5 -2/2^3 -1/2^3 0 sqrt(2)/2^5 6/2^3 -2/2^3 9*sqrt(2)/2^5 8*sqrt(2)/2^5 -2/2^3 6/2^3 16*sqrt(2)/2^5 sqrt(2)/2^5 -1/2^3 -2/2^3 9*sqrt(2)/2^5 -4*sqrt(2)/2^5 0 -1/2^3 0 -sqrt(2)/2^5 0 0 -sqrt(2)/2^5 0 0 0 ]; if(nargout>1) garr = [ -sqrt(2)/2^5 0 0 1/2^6 0 -sqrt(2)/2^5 1/2^6 2/2^6 9*sqrt(2)/2^5 -4*sqrt(2)/2^5 2/2^6 0 16*sqrt(2)/2^5 sqrt(2)/2^5 0 -18/2^6 9*sqrt(2)/2^5 8*sqrt(2)/2^5 -18/2^6 30/2^6 0 sqrt(2)/2^5 30/2^6 -18/2^6 -sqrt(2)/2^5 -4*sqrt(2)/2^5 -18/2^6 0 0 -sqrt(2)/2^5 0 2/2^6 0 0 2/2^6 1/2^6 0 0 1/2^6 0 ]; end; case 3 % Example 3. Not a tight frame! harr = [ 0 35*sqrt(2)/2^12 0.003385355341795 0 35*sqrt(2)/2^12 185*sqrt(2)/2^12 0.011757930078244 0.003385355341795 -45*sqrt(2)/2^12 208*sqrt(2)/2^12 0.038383315957975 0.011757930078244 -252*sqrt(2)/2^12 -648*sqrt(2)/2^12 0.127426546608992 0.038383315957975 420*sqrt(2)/2^12 -706*sqrt(2)/2^12 -0.112865104706813 0.127426546608992 1890*sqrt(2)/2^12 706*sqrt(2)/2^12 -0.710280910094278 -0.112865104706813 1890*sqrt(2)/2^12 648*sqrt(2)/2^12 0.710280910094278 -0.710280910094278 420*sqrt(2)/2^12 -208*sqrt(2)/2^12 0.112865104706813 0.710280910094278 -252*sqrt(2)/2^12 -185*sqrt(2)/2^12 -0.127426546608992 0.112865104706813 -45*sqrt(2)/2^12 -35*sqrt(2)/2^12 -0.038383315957975 -0.127426546608992 35*sqrt(2)/2^12 0 -0.011757930078244 -0.038383315957975 0 0 -0.003385355341795 -0.011757930078244 0 0 0 -0.003385355341795 ]; if(nargout>1) garr = [ % 0 0 0 0 0 0 0 0 35*sqrt(2)/2^12 0 0 -0.043136204314165 -45*sqrt(2)/2^12 35*sqrt(2)/2^12 -0.043136204314165 -0.022725249453801 -252*sqrt(2)/2^12 185*sqrt(2)/2^12 -0.022725249453801 -0.016002341917868 420*sqrt(2)/2^12 208*sqrt(2)/2^12 -0.016002341917868 0.463586703221768 1890*sqrt(2)/2^12 -648*sqrt(2)/2^12 0.463586703221768 -0.463586703221768 1890*sqrt(2)/2^12 -706*sqrt(2)/2^12 -0.463586703221768 0.016002341917868 420*sqrt(2)/2^12 706*sqrt(2)/2^12 0.016002341917868 0.022725249453801 -252*sqrt(2)/2^12 648*sqrt(2)/2^12 0.022725249453801 0.043136204314165 -45*sqrt(2)/2^12 -208*sqrt(2)/2^12 0.043136204314165 0 35*sqrt(2)/2^12 -185*sqrt(2)/2^12 0 0 0 -35*sqrt(2)/2^12 0 0 ]; end; case 4 % Example 4. Not a tight frame! harr = [ 0 99 0.0008317898274 0 99 837 0.00527762349601 0.0008317898274 351 2630 0.01705880266437 0.00527762349601 -286 2778 0.02633268946272 0.01705880266437 -2574 -3195 0.03753999326488 0.02633268946272 -1287 -10429 -0.00195902477575 0.03753999326488 10725 -6348 -0.0711227784702 -0.00195902477575 25740 6348 -0.54534348089652 -0.0711227784702 25740 10429 0.54534348089652 -0.54534348089652 10725 3195 0.0711227784702 0.54534348089652 -1287 -2778 0.00195902477575 0.0711227784702 -2574 -2630 -0.03753999326488 0.00195902477575 -286 -837 -0.02633268946272 -0.03753999326488 351 -99 -0.01705880266437 -0.02633268946272 99 0 -0.00527762349601 -0.01705880266437 0 0 -0.0008317898274 -0.00527762349601 0 0 0 -0.0008317898274 ]; harr(:,1:2)=harr(:,1:2)*sqrt(2)/2^16; if(nargout>1) garr = [ % 0 0 0 0 0 0 0 0 99 0 0 -0.0054868984046 351 99 -0.0054868984046 -0.03102895771555 -286 837 -0.03102895771555 -0.05109382225012 -2574 2630 -0.05109382225012 -0.05321999995116 -1287 2778 -0.05321999995116 0.1089262550963 10725 -3195 0.1089262550963 0.6365944921083 25740 -10429 0.6365944921083 -0.6365944921083 25740 -6348 -0.6365944921083 -0.1089262550963 10725 6348 -0.1089262550963 0.05321999995116 -1287 10429 0.05321999995116 0.05109382225012 -2574 3195 0.05109382225012 0.03102895771555 -286 -2778 0.03102895771555 0.0054868984046 351 -2630 0.0054868984046 0 99 -837 0 0 0 -99 0 0 ]; garr(:,1:2)=garr(:,1:2)*sqrt(2)/2^16; end; case 5 % Example 5. Not a tight frame! harr = [ -5 35 0 5 -7 -35 35 -7 35 -665 -35 -35 105 665 -665 105 105 665 665 -105 35 -665 665 35 -7 -35 -665 7 -5 35 -35 -5 0 0 35 0 ]; harr(:,[1 4])=harr(:,[1 4])*sqrt(2)/2^8; harr(:,2:3)=harr(:,2:3)*sqrt(2)/2^12; if(nargout>1) garr = [ % 0 0 0 0 -5 0 -1 -5 -7 -1 -1 7 35 -1 2 35 105 2 2 -105 105 2 -1 105 35 -1 -1 -35 -7 -1 0 -7 -5 0 0 5 ]; garr(:,[1 4])=garr(:,[1 4])*sqrt(2)/2^8; garr(:,2:3)=garr(:,2:3)*sqrt(2)/2^3; end; otherwise error('%s: No such filters.',upper(mfilename)); end g=mat2cell(garr,size(garr,1),ones(1,size(garr,2))); h=mat2cell(flipud(harr),size(harr,1),ones(1,size(harr,2))); ```