Code covered by the BSD License  

Highlights from
deOliveira wavelets

deOliveira wavelets

by

 

cdeo is the complex wavelet (type 5), deo is an orthogonal infinitely regular wavelet (type 3)

deowavf(varargin);
function varargout = deowavf(varargin);
% deo  wavelet -- TYPE 3 WAVELET according to waveinfo
%   case nargin = 4 
%   [PHI,PSI,T] = deo(LOWB,UPPB,N,alpha) returns deO
%   scaling and wavelet functions evaluated on
%   a N point regular grid on the interval [LOWB,UPPB].
%   Output arguments are the scaling function PHI, the
%   wavelet function PSI computed on the grid T 
%   (defined in terms of LOWB, UPPB and N)
%
%   These functions have [-12 12] as effective support.
%   
%   case nargin = 5
%   A fiveth argument is allowed, if only one function
%   is required:
%     [PHI,T] = DEOWAFV(LOWB,UPPB,N,alpha,'phi')
%     [PSI,T] = DEOWAFV(LOWB,UPPB,N,alpha,'psi')
%   When the fourth argument is used, but not equal to
%   'phi' or 'psi', outputs are the same as in main option.
%
%   N must be a power of two.
%
%   See also DEOINFO, WAVEFUN, WAVEINFO.
%
%   Luciana R. Soares, H.M. de Oliveira.
%   Last Revision: 10-Dec-2002

% Check arguments
if errargn(mfilename,nargin,[4:5],nargout,[0:3]), error('*'), end

% Translate input arguments...
switch nargin
  case 4
    [lowb,uppb,N,label] = deal(varargin{:}); opt = 'two';
    ind = strncmpi('deo',label,3);
    if isequal(ind,1) label([1:3]) = []; end
    alpha = wstr2num(deblank(label));
    
  case 5
    [lowb,uppb,N,alpha,opt] = deal(varargin{:});
    if ~(isequal(opt,'two') | isequal(opt,'phi') | isequal(opt,'psi'))
        opt = 'two'; end
end

% Check alpha factor (roll-off)
if isempty(alpha) error('** deO: Invalid wavelet number!'); end
if (alpha < 0) | (alpha > 1/3)
    error('** deO: Invalid value for alpha **')
end
if (alpha == 0)
   alpha = 10.^-5; % alpha ~ 0
   disp('deO: Shannon Wavelet');
end

% Check N
if errargt(mfilename,log(N)/log(2),'int')
    error('** deO: Invalid value for N **')
end

% Check Interval
if errargt(mfilename,uppb-lowb,'re0')
   error('** deO: Verify upper/lower bound... **')
end

% Transform interval bounds to grid
lint = (uppb-lowb);
step = lint/N;
if step > 0.3
   disp('** deO: the number of grid points is not enough for that support... Be carefull **');
end
t    = [lowb:step:uppb];
td = t - 1/2;

% Initial Variables
va = 2*(1 - alpha);
vb = 1 + alpha;
vc = 1 - alpha;
vd = 2*(1 + alpha);
epslon = 0.0001;

% Computing critical values...
x = find(t==0);
crit_cb1 = 1/(2*(vc-vb));
xcb1 = find(t == crit_cb1);
crit_cb2 = -1/(2*(vc-vb));
xcb2 = find(t == crit_cb2);

y = find(td==0);
ycb1 = find(abs(td - crit_cb1) < epslon);
ycb2 = find(abs(td - crit_cb2) < epslon);

crit_da1 = 1/(2*(vd-va));
yda1 = find(abs(td - crit_da1) < epslon);
crit_da2 = -1/(2*(vd-va));
yda2 = find(abs(td - crit_da2) < epslon);

% Avoiding critical values...
t(x)= epslon;
t(xcb1)= t(xcb1) + epslon;
t(xcb2)= t(xcb2) + epslon;

td(y) = epslon;
td(ycb1) = crit_cb1 + epslon;
td(ycb2) = crit_cb2 + epslon;
td(yda1) = crit_da1 + epslon;
td(yda2) = crit_da2 + epslon;

% Scaling function (phi)
if opt == 'phi' | opt == 'two'
    hc = sin(vc*pi*t)./(pi*t);
    mcb = (2*abs(vb-vc).*(cos(vb*pi*t) + 2*(vb-vc).*t.*sin(vc*pi*t)))./(pi.*(1-(2.*t.*(vb-vc)).^2));
    phi = (hc + mcb)/(sqrt(2*pi));
end

% Wavelet function (psi)
if opt == 'psi' | opt == 'two'
   % Real part
   hra = sin(va*pi*td)./(pi*td);
   hrb = sin(vb*pi*td)./(pi*td);
   mrbc = (2*abs(vc-vb)*(cos(vc*pi*td) + 2*(vc-vb).*td.*sin(vb*pi*td)))./(pi.*(1-(2*td*(vc-vb)).^2));
   mrad = (2*abs(vd-va)*(cos(vd*pi*td) + 2*(vd-va).*td.*sin(va*pi*td)))./(pi.*(1-(2*td*(vd-va)).^2));
   RdeO = (hra - hrb + mrbc + mrad)/(2*sqrt(2*pi));
   % Imaginary part
   denom = pi * td;
   hia = cos(va*pi*td)./denom;
   hib = cos(vb*pi*td)./denom;
   den1 = pi.*(1-(2*td*(vc-vb)).^2);
   den2 = pi.*(1-(2*td*(vd-va)).^2);
   mibc = (2*abs(vc-vb)*(sin(vc*pi*td) - 2*(vc-vb).*td.*cos(vb*pi*td)))./(den1);
   miad = (2*abs(vd-va)*(sin(vd*pi*td) - 2*(vd-va).*td.*cos(va*pi*td)))./(den2);
   IdeO = (hia - hib + mibc + miad)/(2*sqrt(2*pi));
   % deO Wavelet
   psi = RdeO + j*IdeO;
end

% Set output arguments
if opt == 'two' & nargout ~= 3 
   error('**deO: too few output parameters: should be [phi, psi, t]=...'); 
end

switch opt
    case 'psi' , varargout = {psi,t};
    case 'phi' , varargout = {phi,t};
    otherwise  , varargout = {phi,psi,t};
end

Contact us