-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakeWaveletPlots.m
More file actions
55 lines (40 loc) · 1.3 KB
/
Copy pathmakeWaveletPlots.m
File metadata and controls
55 lines (40 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function makeWaveletPlots( outDir )
close all
lineWidth = 3;
% lpf = [ ...
% -0.12940952255092145, ...
% 0.22414386804185735, ...
% 0.836516303737469, ...
% 0.48296291314469025, ...
% ];
lpf = [ ...
1-sqrt(3), 3-sqrt(3), 3+sqrt(3), 1+sqrt(3) ...
] / ( 4 * sqrt(2) );
%lpf = lpf / norm( lpf );
hpf = [ ...
-(1+sqrt(3)), 3+sqrt(3), -(3-sqrt(3)), (1-sqrt(3)) ...
] / ( 4 * sqrt(2) );
%hpf = hpf / norm( hpf );
% hpf = [ ...
% -0.48296291314469025, ...
% 0.836516303737469, ...
% -0.22414386804185735, ...
% -0.12940952255092145, ...
% ];
figure;
subplot(2,1,1); stemnice( hpf, 'r', 'LineWidth', lineWidth );
hold on; stemnice( lpf, 'b', 'LineWidth', lineWidth );
set( gca, 'XTick', (1:numel(lpf)) );
title( 'Coefficients' );
legend( 'High Pass', 'Low Pass' );
paddedLpf = zeros(512,1); paddedLpf(1:numel(lpf)) = lpf;
paddedHpf = zeros(512,1); paddedHpf(1:numel(hpf)) = hpf;
fftLpf = 1/sqrt(2) * fftc( paddedLpf );
fftHpf = 1/sqrt(2) * fftc( paddedHpf );
fftCoords = size2fftCoordinates( 512 );
subplot(2,1,2); plotnice( fftCoords, abs( fftHpf ), 'r', 'LineWidth', lineWidth );
hold on; plotnice( fftCoords, abs( fftLpf ), 'b', 'LineWidth', lineWidth );
title( 'Spectrums' );
saveas( gcf, [ outDir, '/waveletPlots.png' ] );
close( gcf );
end