-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlanczos.m
59 lines (50 loc) · 1.29 KB
/
lanczos.m
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
55
56
57
58
59
% FILE: lanczos.m
%
% FUNCTION: lanczos
%
% CALL: h = lanczos(M, L)
%
% Returns the values of a lanczos window of length M using the extra
% parameter L
%
% INPUTS:
% M - length of the returned window
% L - gives the oppening of the window, recomanded values
% L in [1, 3]
% OUTPUTS:
% h - the values of a lanczos window of length M and parameter L
%
% Author: Leonard-Gabriel Necula
% Created: December 24 2020
% Updated: January 18 2021
function h = lanczos(M, L)
if nargin < 1
display('No input parameters detected.');
display('Setting M = 128 and L = 1.5');
L = 1.5;
M = 128;
end
if isempty(M)
display('Detected empty M.');
display('Setting M = 128');
M = 128;
end
if nargin < 2
display('L missing.');
display('Setting L = 1.5');
L = 1.5;
end
if isempty(L)
display('Detected empty L.');
display('Setting L = 1.5');
L = 1.5;
end
% ---------------------------------------------------------------------- %
N = 0: M - 1;
arg = (2*pi * (2*N - M + 1))./(2*(M-1));
h = sin(arg)./arg;
if mod(M, 2)
h((M-1)/2 + 1) = 1;
end
h = h.^L;
end