daubcqf

PURPOSE ^

[h_0,h_1] = daubcqf(N,TYPE);

SYNOPSIS ^

function [h_0,h_1] = daubcqf(N,TYPE)

DESCRIPTION ^

    [h_0,h_1] = daubcqf(N,TYPE); 

    Function computes the Daubechies' scaling and wavelet filters
    (normalized to sqrt(2)).

    Input: 
       N    : Length of filter (must be even)
       TYPE : Optional parameter that distinguishes the minimum phase,
              maximum phase and mid-phase solutions ('min', 'max', or
              'mid'). If no argument is specified, the minimum phase
              solution is used.

    Output: 
       h_0 : Minimal phase Daubechies' scaling filter 
       h_1 : Minimal phase Daubechies' wavelet filter 

    Example:
       N = 4;
       TYPE = 'min';
       [h_0,h_1] = daubcqf(N,TYPE)
       h_0 = 0.4830 0.8365 0.2241 -0.1294
       h_1 = 0.1294 0.2241 -0.8365 0.4830

    Reference: "Orthonormal Bases of Compactly Supported Wavelets",
                CPAM, Oct.89

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [h_0,h_1] = daubcqf(N,TYPE)
0002 %    [h_0,h_1] = daubcqf(N,TYPE);
0003 %
0004 %    Function computes the Daubechies' scaling and wavelet filters
0005 %    (normalized to sqrt(2)).
0006 %
0007 %    Input:
0008 %       N    : Length of filter (must be even)
0009 %       TYPE : Optional parameter that distinguishes the minimum phase,
0010 %              maximum phase and mid-phase solutions ('min', 'max', or
0011 %              'mid'). If no argument is specified, the minimum phase
0012 %              solution is used.
0013 %
0014 %    Output:
0015 %       h_0 : Minimal phase Daubechies' scaling filter
0016 %       h_1 : Minimal phase Daubechies' wavelet filter
0017 %
0018 %    Example:
0019 %       N = 4;
0020 %       TYPE = 'min';
0021 %       [h_0,h_1] = daubcqf(N,TYPE)
0022 %       h_0 = 0.4830 0.8365 0.2241 -0.1294
0023 %       h_1 = 0.1294 0.2241 -0.8365 0.4830
0024 %
0025 %    Reference: "Orthonormal Bases of Compactly Supported Wavelets",
0026 %                CPAM, Oct.89
0027 %
0028 
0029 %File Name: daubcqf.m
0030 %Last Modification Date: 01/02/96    15:12:57
0031 %Current Version: daubcqf.m    2.4
0032 %File Creation Date: 10/10/88
0033 %Author: Ramesh Gopinath  <ramesh@dsp.rice.edu>
0034 %
0035 %Copyright (c) 2000 RICE UNIVERSITY. All rights reserved.
0036 %Created by Ramesh Gopinath, Department of ECE, Rice University.
0037 %
0038 %This software is distributed and licensed to you on a non-exclusive
0039 %basis, free-of-charge. Redistribution and use in source and binary forms,
0040 %with or without modification, are permitted provided that the following
0041 %conditions are met:
0042 %
0043 %1. Redistribution of source code must retain the above copyright notice,
0044 %   this list of conditions and the following disclaimer.
0045 %2. Redistribution in binary form must reproduce the above copyright notice,
0046 %   this list of conditions and the following disclaimer in the
0047 %   documentation and/or other materials provided with the distribution.
0048 %3. All advertising materials mentioning features or use of this software
0049 %   must display the following acknowledgment: This product includes
0050 %   software developed by Rice University, Houston, Texas and its contributors.
0051 %4. Neither the name of the University nor the names of its contributors
0052 %   may be used to endorse or promote products derived from this software
0053 %   without specific prior written permission.
0054 %
0055 %THIS SOFTWARE IS PROVIDED BY WILLIAM MARSH RICE UNIVERSITY, HOUSTON, TEXAS,
0056 %AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
0057 %BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
0058 %FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RICE UNIVERSITY
0059 %OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
0060 %EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
0061 %PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
0062 %OR BUSINESS INTERRUPTIONS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
0063 %WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
0064 %OTHERWISE), PRODUCT LIABILITY, OR OTHERWISE ARISING IN ANY WAY OUT OF THE
0065 %USE OF THIS SOFTWARE,  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0066 %
0067 %For information on commercial licenses, contact Rice University's Office of
0068 %Technology Transfer at techtran@rice.edu or (713) 348-6173
0069 
0070 if(nargin < 2),
0071   TYPE = 'min';
0072 end;
0073 if(rem(N,2) ~= 0),
0074   error('No Daubechies filter exists for ODD length');
0075 end;
0076 K = N/2;
0077 a = 1;
0078 p = 1;
0079 q = 1;
0080 h_0 = [1 1];
0081 for j  = 1:K-1,
0082   a = -a * 0.25 * (j + K - 1)/j;
0083   h_0 = [0 h_0] + [h_0 0];
0084   p = [0 -p] + [p 0];
0085   p = [0 -p] + [p 0];
0086   q = [0 q 0] + a*p;
0087 end;
0088 q = sort(roots(q));
0089 qt = q(1:K-1);
0090 if TYPE=='mid',
0091   if rem(K,2)==1,  
0092     qt = q([1:4:N-2 2:4:N-2]);
0093   else
0094     qt = q([1 4:4:K-1 5:4:K-1 N-3:-4:K N-4:-4:K]);
0095   end;
0096 end;
0097 h_0 = conv(h_0,real(poly(qt)));
0098 h_0 = sqrt(2)*h_0/sum(h_0);     %Normalize to sqrt(2);
0099 if(TYPE=='max'),
0100   h_0 = fliplr(h_0);
0101 end;
0102 if(abs(sum(h_0 .^ 2))-1 > 1e-4) 
0103   error('Numerically unstable for this value of "N".');
0104 end;
0105 h_1 = rot90(h_0,2);
0106 h_1(1:2:N)=-h_1(1:2:N);

Generated on Mon 10-Jun-2013 23:03:23 by m2html © 2005