-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplyWindow.m
More file actions
33 lines (29 loc) · 821 Bytes
/
applyWindow.m
File metadata and controls
33 lines (29 loc) · 821 Bytes
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
function [ samples ] = applyWindow(samples, window, plot)
% samples = applyWindow(samples, window)
% Possible windows:
% 'flattop'
% 'nuttal'
% 'hamming'
% 'kayser'
switch window
case 'flattop'
signal = flattopwin(length(samples));
case 'nuttal'
signal = nuttallwin(length(samples));
case 'hamming'
signal = hamming(length(samples));
case 'kaiser'
signal = kaiser(length(samples), 38);
otherwise
display('Error in applyWindow: invalid window selected!');
return;
end
if(plot == true)
wvtool(signal);
end
if(size(samples, 2) > size(samples, 1))
samples = samples .* signal';
else
samples = samples .* signal;
end
end