BETA WAVELETS

by

 

Compactly Supported One-cyclic Wavelets Derived from Beta Distributions

betawavf.m
function varargout = betawavf(varargin);
% beta wavelet -- Type 3 Wavelet according to waveinfo
% TWO OPTIONS  -- 4 or 5 inputs
%
% case nargin = 4
% [PHI,PSI,T] = beta(LOWB,UPPB,N,alpha_beta) 
% returns beta scaling and wavelet function evaluated  
% on an N-point regular grid on the interval [LOWB,UPPB].
% LOWB and UPPB depend on alpha_beta (the input parameter).
% Output arguments are the PHI and PSI on the grid T
% The grid T is defined by LOWB,UPPB and N
% Two parameter into a single one:  
% alpha_beta is broken => alpha and beta
% parameter constraint: alpha>1 and beta>1
%
% These beta wavelets have compact support 
% The supp psi Beta is
% lowb= - sqrt( (alpha+beta+1)/(beta/alpha))
% uppb=   sqrt( (alpha+beta+1)/(alpha/beta))

% case nargin = 5
% A fiveth argument is allowed, if only one function is required
% [PHI,T] = betawavf(lowb,uppb,N,alpha_beta,'psi')
% [PSI,T] = betawavef(lowb,uppb,N,alpha_beta,'phi')
% When the fourth argument is used, but not equal to
% 'phi' or 'psi', outputs are the same as in main option.
%
%
% These wavelets are compactly supported 
% The supp Beta is
% lowb= - sqrt( (alpha+beta+1)/(beta/alpha))
% uppb=   sqrt( (alpha+beta+1)/(alpha/beta))
%
% N must be a power of two
% See also betainfo, wavefun, waveinfo
%
% H.M. de Oliveira, G.A.A. de Arajo
% Last revision: 08/03/2005
%
%
%checking 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('beta',label,4);
	if isequal(ind,1) label([1:4]) = []; end
	alpha_beta = wstr2num(deblank(label));

	case 5
	[lowb,uppb,N,label,opt] = deal(varargin{:});
	if ~(isequal(opt,'two') | isequal(opt,'phi') | isequal(opt,'psi'))
		opt = 'two'; end
end

% split alpha_beta => alpha , beta
alpha = floor(alpha_beta/10);
beta = alpha_beta - 10*alpha;

% check values of alpha and beta
if isempty(alpha) | isempty(beta) error('** beta: invalid parameter!');
   end
if (alpha < 2) | (alpha > 9) error('** invalid alpha')
   end
if (beta < 2) | (beta > 9 ) error('** invalid beta')
   end

% check N
if errargt(mfilename,log(N)/log(2),'int')
   error('** invalid value for N')
   end

% set wavelet support
lowb= - sqrt( (alpha+beta+1)/(beta/alpha));
uppb=   sqrt( (alpha+beta+1)/(alpha/beta));

% check interval
if errargt(mfilename,uppb-lowb,'re0')
   error('* beta: please verify the support')
   end

% transform interval to grid
lint = (uppb - lowb);
step = lint /N;
if step > 0.3 
   disp('* beta: the number of grid points is not enought ... Be carefull');
   end
t = [lowb:step:uppb];

a = lowb;
b = uppb;
TT= lint;
% TT is the length of the support

% CONSTANT B(alpha,beta)
betao = gamma(alpha)*gamma(beta)/gamma(alpha+beta);

% Scaling function (phi)
if opt == 'two' | opt == 'phi'
fator = betao.*TT.^(alpha+beta-1);
phi = (t-a).^(alpha-1).*(b-t).^(beta-1)./fator;
   end

% Wavelet function (psi)
if opt == 'two' | opt == 'psi'
    for i=2:N
psi(i) = ((alpha-1)./(t(i)-a)-(beta-1)./(b-t(i))).*((t(i)-a).^(alpha-1).*(b-t(i)).^(beta-1))./fator;
    end
psi(1)=0;
   end

% set output arguments
if opt == 'two' & nargout ~= 3
   error('* beta: too few output parameters');
   end

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


Contact us