% file:      	daubechies_2.m, (c) Matthew Roughan, Mon Aug 14 2006
%
opts = struct('height',8, 'width', 8.5, 'Color', 'rgb');
n = 1024;
J = log2(n);
j = 7;
for p=[4 6 8 10]
% for p=[4]
  k = 2^(J-j-1);
  m = MakeWavelet(J-j,k,'Daubechies',p,'Mother',n).*2^(j/2);
  i_m = (((1:n)-n/2)./2^j);
  figure(1)
  p1 = plot(i_m,-m, 'b', 'linewidth', 3);
  set(gca, 'fontsize', 18, 'linewidth', 3);
  title(sprintf('mother wavelet \\psi(t), p = %d', p/2));
  axis([-p/2+1 p/2 -1.5 2])
  exportfig(gcf,sprintf('Plots/daubechies_m_%05d.eps',p), opts, 'format', 'eps');

  f = MakeWavelet(J-j,k,'Daubechies',p,'Father',n).*2^(j/2);
  i_f = (((1:n)-n/2)./2^j)+1;
  figure(2)
  p2 = plot(i_f,f, 'b', 'linewidth', 3);
  set(gca, 'fontsize', 18, 'linewidth', 3);
  title(sprintf('scaling function \\phi(t), p = %d', p/2));
  axis([0 5 -.5 1.5])
  exportfig(gcf,sprintf('Plots/daubechies_f_%05d.eps',p), opts, 'format', 'eps');
end







%   supp = find(abs(m) >0.0000001);
%   mins = min(supp);
%   maxs = max(supp);
%   plot(i(mins:maxs),m(mins:maxs))
