Diff of /wavelets/wfilt_symds.m [77a22a] .. [95fe2b]  Maximize  Restore

  Switch to side-by-side view

--- a/wavelets/wfilt_symds.m
+++ b/wavelets/wfilt_symds.m
@@ -1,212 +1,212 @@
-function [h,g,a] = 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.
-%
-%   References: abdelnour2012sib
-%
-%   Examples:
-%   ---------
-%
-%   Frequency responses of the analysis filters:::  
-%
-%      w = fwtinit({'symds',2});
-%      wtfftfreqz(w.h);
-%
-%   Frequency responses of the synthesis filters:::  
-%
-%      w = fwtinit({'symds',2});
-%      wtfftfreqz(w.g);
-%
-
-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
-
-        [hR hC]=size(harr); 
-        h=mat2cell(harr.',ones(1,hC),hR);
-        if(nargout>1)
-           [gR gC]=size(garr);
-           g=mat2cell(garr.',ones(1,gC),gR);
-        end
-
+function [h,g,a] = 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.
+%
+%   References: abdelnour2012sib
+%
+%   Examples:
+%   ---------
+%
+%   Frequency responses of the analysis filters:::  
+%
+%      w = fwtinit({'symds',2});
+%      wtfftfreqz(w.h);
+%
+%   Frequency responses of the synthesis filters:::  
+%
+%      w = fwtinit({'symds',2});
+%      wtfftfreqz(w.g);
+%
+
+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
+
+        [hR hC]=size(harr); 
+        h=mat2cell(harr.',ones(1,hC),hR);
+        if(nargout>1)
+           [gR gC]=size(garr);
+           g=mat2cell(garr.',ones(1,gC),gR);
+        end
+