Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% definition of wavelet functions
- D2 = [1, 1];
- D4 = [0.6830127, 1.1830127, 0.3169873, -0.1830127];
- D6 = [0.47046721, 1.14111692, 0.650365, -0.19093442, -0.12083221, 0.0498175];
- D8 = [0.32580343, 1.01094572, 0.8922014, -0.03957503, -0.26450717, 0.0436163, 0.0465036, -0.01498699];
- D10 = [0.22641898, 0.85394354, 1.02432694, 0.19576696, -0.34265671, -0.04560113, 0.10970265, -0.0088268, -0.01779187, 0.004717428];
- D12 = [0.15774243, 0.69950381, 1.06226376, 0.44583132, -0.3199866, -0.18351806, 0.13788809, 0.03892321, -0.04466375, 0.000783251, 0.006756062, -0.001523534];
- D14 = [0.11009943, 0.56079128, 1.03114849, 0.66437248, -0.20351382, -0.31683501, 0.1008467, 0.11400345, -0.05378245, -0.02343994, 0.01774979, 0.000607515, -0.002547905, 0.000500227];
- D16 = [0.07695562, 0.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];
- D18 = [0.05385035, 0.3448343, 0.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];
- D20 = [0.03771716, 0.26612218, 0.74557507, 0.97362811, 0.39763774, -0.3533362, -0.27710988, 0.18012745, 0.13160299, -0.10096657, -0.04165925, 0.04696981, 0.005100437, -0.015179, 0.001973325, 0.002817687, -0.000969948, -0.000164709, 0.000132354, -1.87584E-05];
- %% setup h0 and h1
- name = 'D4';
- h0 = D4;
- h1 = fliplr(h0);
- idx = 2:2:numel(h0);
- h1(idx) = -h1(idx);
- %% iterate
- scale = [1];
- figure;
- for i = 0:100
- h0scaled = zeros(1, numel(h0)*(2^i));
- h1scaled = zeros(1, numel(h1)*(2^i));
- for j = 1:numel(h0)
- h0scaled(j*(2^i)) = h0(j);
- h1scaled(j*(2^i)) = h1(j);
- end
- wavelet = conv(scale,h1scaled);
- scale = conv(scale,h0scaled);
- stairs(scale);
- hold all;
- title(['Scale function ' name ' iteration ' int2str(i)]);
- stairs(wavelet);
- hold off;
- title(['Wavelet function ' name ' iteration ' int2str(i)]);
- pause;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement