%
% generate dyadic wavelet of given resolution
% dilated and shifted
%
%  f = wavefunc( type, l, m, k )
%
%    f    = wavelet (2^l+1 points)
%    xx   = axis points (0..2^l)
%    type = 1 gaussian
%           2 sombrero
%           3 morlet ?
%
%    l    = resolution
%    m    = dilation (by 2^m)
%    k    = shift (in points)
%
function f = wavefunc( xx, type, l, m, k )
%
x = ( xx(:) - k ) .* 2^(-m);
%
if type == 1,
  f = exp( - x.^2 ./ 2 );
elseif type == 2,
  f = x.^2 .* exp( - x.^2 ./ 2 );
elseif type == 3,
  xo = 0.5;
  f = exp( - (x-xo).^2 ./ 2 ) ...
    - exp( - (x.^2 + xo.^2) ./ 2 );
else
  disp( 'ERROR - unsupported wavelet type' );
  f = zeros( size( x ) );
end;
%
f = f .* sqrt( 2^(-m) );
%