Advertisement
Guest User

Untitled

a guest
Feb 15th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 2.06 KB | None | 0 0
  1. %% definition of wavelet functions
  2. D2 = [1,    1];
  3. D4 = [0.6830127,    1.18301270.3169873,  -0.1830127];
  4. D6 = [0.47046721,   1.14111692, 0.650365,   -0.19093442,    -0.12083221,    0.0498175];
  5. D8 = [0.32580343,   1.01094572, 0.8922014,  -0.03957503,    -0.26450717,    0.04361630.0465036,  -0.01498699];
  6. D10 = [0.226418980.85394354, 1.02432694, 0.19576696, -0.34265671,    -0.04560113,    0.10970265, -0.0088268, -0.01779187,    0.004717428];
  7. D12 = [0.157742430.69950381, 1.06226376, 0.44583132, -0.3199866, -0.18351806,    0.13788809, 0.03892321, -0.04466375,    0.000783251,    0.006756062,    -0.001523534];
  8. D14 = [0.110099430.56079128, 1.03114849, 0.66437248, -0.20351382,    -0.31683501,    0.10084670.11400345, -0.05378245,    -0.02343994,    0.01774979, 0.000607515,    -0.002547905,   0.000500227];
  9. D16 = [0.076955620.44246725, 0.95548615, 0.82781653, -0.02238574,    -0.40165863,    0.000668194,    0.18207636, -0.0245639, -0.06235021,    0.01977216, 0.01236884, -0.006887719,   -0.000554005,   0.00095523, -0.000166137];
  10. D18 = [0.053850350.34483430.85534906, 0.92954571, 0.18836955, -0.41475176,    -0.13695355,    0.21006834, 0.043452675,    -0.09564726,    0.000354893,    0.03162417, -0.00667962,    -0.006054961,   0.002612967,    0.000325815,    -0.00035633,    5.56455E-05];
  11. D20 = [0.037717160.26612218, 0.74557507, 0.97362811, 0.39763774, -0.3533362, -0.27710988,    0.18012745, 0.13160299, -0.10096657,    -0.04165925,    0.04696981, 0.005100437,    -0.0151790.001973325,    0.002817687,    -0.000969948,   -0.000164709,   0.000132354,    -1.87584E-05];
  12.  
  13.  
  14. %% setup h0 and h1
  15. name = 'D4';
  16. h0 = D4;
  17. h1 = fliplr(h0);
  18. idx = 2:2:numel(h0);
  19. h1(idx) = -h1(idx);
  20.  
  21. %% iterate
  22. scale = [1];
  23. figure;
  24. for i = 0:100
  25.     h0scaled = zeros(1, numel(h0)*(2^i));
  26.     h1scaled = zeros(1, numel(h1)*(2^i));
  27.     for j = 1:numel(h0)
  28.        h0scaled(j*(2^i)) = h0(j);
  29.        h1scaled(j*(2^i)) = h1(j);
  30.     end
  31.     wavelet = conv(scale,h1scaled);
  32.     scale   = conv(scale,h0scaled);
  33.     stairs(scale);
  34.     hold all;
  35.     title(['Scale function ' name ' iteration ' int2str(i)]);
  36.     stairs(wavelet);
  37.     hold off;
  38.     title(['Wavelet function ' name ' iteration ' int2str(i)]);
  39.     pause;
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement