class constructor for phiw_daub object FORMAT [o, others] = phiw_daub(num_coeffs, others) inherits from phiw_wavelet Synopsis -------- o = phiw_daub(4); Inputs num_coeffs - a scalar, setting the number of coefficients for the Daubechies wavelet filter others - optional structure with any other fields for phiw_wavelet (see phiw_wavelet) $Id: phiw_daub.m,v 1.5 2005/06/05 04:42:22 matthewbrett Exp $
0001 function [o, others] = phiw_daub(num_coeffs, others) 0002 % class constructor for phiw_daub object 0003 % FORMAT [o, others] = phiw_daub(num_coeffs, others) 0004 % inherits from phiw_wavelet 0005 % 0006 % Synopsis 0007 % -------- 0008 % o = phiw_daub(4); 0009 % 0010 % Inputs 0011 % num_coeffs - a scalar, setting the number of coefficients for the 0012 % Daubechies wavelet filter 0013 % others - optional structure with any other fields for phiw_wavelet 0014 % (see phiw_wavelet) 0015 % 0016 % $Id: phiw_daub.m,v 1.5 2005/06/05 04:42:22 matthewbrett Exp $ 0017 0018 myclass = 'phiw_daub'; 0019 0020 % Default object structure; Daub filter with 4 coefficients 0021 defstruct = struct('num_coeffs', 4); 0022 0023 if nargin < 1 0024 0025 num_coeffs = []; 0026 end 0027 if nargin < 2 0028 others = []; 0029 end 0030 0031 if isa(num_coeffs, myclass) 0032 o = num_coeffs; 0033 % Check for simple form of call 0034 if isempty(others), return, end 0035 0036 % Otherwise, we are being asked to set fields of object 0037 [p others] = mars_struct('split', others, defstruct); 0038 if isfield(p, 'num_coeffs'), o = num_coeffs(o, p.num_coeffs); end 0039 return 0040 end 0041 0042 % Check num_coeffs input argument 0043 if isempty(num_coeffs), num_coeffs = defstruct.num_coeffs; end 0044 if ~isnumeric(num_coeffs) | prod(size(num_coeffs)) > 1 0045 error('num_coeffs argument should be a scalar'); 0046 end 0047 0048 % set the phiw_wavelet object 0049 [H G RH RG] = daub(num_coeffs); 0050 [phiw_w others] = phiw_wavelet(struct('H', H, ... 0051 'G', G, ... 0052 'RH', RH, ... 0053 'RG', RG), ... 0054 others); 0055 0056 % Return phiw_daub object 0057 params.num_coeffs = num_coeffs; 0058 o = class(params, myclass, phiw_w); 0059