-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplyWindowFunction.m
More file actions
32 lines (28 loc) · 1.04 KB
/
applyWindowFunction.m
File metadata and controls
32 lines (28 loc) · 1.04 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
function [result] = applyWindowFunction(signal,windowFunction)
%function that applies the correct window function to a signal. The window
%function is determined from the input string 'window'.
%DETERMINE WINDOW FUNCTION
switch windowFunction
case "Rectangle Window"
window = rectwin(length(signal));
fprintf('Rectangle Window\n');
case "Bartlett Window"
window = bartlett(length(signal));
fprintf('Bartlett Window\n');
case "Hann Window"
window = hann(length(signal));
fprintf('Hann Window\n');
case "Hamming Window"
window = hamming(length(signal));
fprintf('Hamming Window\n');
case "Blackman Window"
window = blackman(length(signal));
fprintf('Blackman Window\n');
case "Flat Top Window"
window = flattopwin(length(signal));
fprintf('Flat Top Window\n');
otherwise
fprintf('Wrong window function argument\n');
end
result = signal .* window;
end