
function dummy = plotscales(w,L,lower,upper);

% plotscales -- plot wavelet coefficients with separation if scales
%  Usage
%    plotscales(w,L,lower,upper)
%  Inputs
%    w      wavelet coefficients
%    L      coarsest level
%    [lower,upper]
%           lower and upper bound for w-axis
%           default = 1.2*max(abs(w))
% Outputs
%    the plot
%
%  Description
%    plot wavelet coefficients w and scalesborders
%    for scales L, L+1, ...

J = 1;
N = length(w);
if nargin < 4
    hgt = 1.2*max(abs(w));
    lower = -hgt; upper = hgt;
end
n = 2;
while (n<N)
  n = 2*n;
  J = J+1;
end
vert = [lower,upper];
plot(w)
hold on
for j = J-1:-1:L
    border = [2^j 2^j];
    plot(border,vert,'--')
end
axis([0,N,lower,upper])
hold off  
