Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Virtual Sensing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SPAH
IN-NOVA
Virtual Sensing
Commits
dbe64773
Commit
dbe64773
authored
8 months ago
by
Achilles Kappis
Browse files
Options
Downloads
Patches
Plain Diff
Improved speed and clarity of code for the winSincFracDel.m and update date
parent
35787749
No related branches found
No related tags found
1 merge request
!3
Update to v0.2.3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Signal Processing/Generic/MATLAB/Functions/winSincFracDel.m
+18
-18
18 additions, 18 deletions
Signal Processing/Generic/MATLAB/Functions/winSincFracDel.m
with
18 additions
and
18 deletions
Signal Processing/Generic/MATLAB/Functions/winSincFracDel.m
+
18
−
18
View file @
dbe64773
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
% Author: Achilles Kappis
% Author: Achilles Kappis
% e-mail: axilleaz@protonmail.com
% e-mail: axilleaz@protonmail.com
%
%
% Date: 1
7
/0
4
/2024 (DD/MM/YYYY)
% Date: 1
3
/0
8
/2024 (DD/MM/YYYY)
%
%
% Copyright: MIT
% Copyright: MIT
% --------------------------------------------------
% --------------------------------------------------
...
@@ -133,43 +133,43 @@ function [sincFilt, causDel, dSig] = winSincFracDel(del, len, winFun, sig, sigLe
...
@@ -133,43 +133,43 @@ function [sincFilt, causDel, dSig] = winSincFracDel(del, len, winFun, sig, sigLe
sigLen
=
"Full"
;
sigLen
=
"Full"
;
end
end
% ====================================================
% Calculate some parameters
% ====================================================
fracDel
=
del
-
abs
(
rem
(
intDel
,
1
));
% Fractional part of the delay
% ====================================================
% ====================================================
% Generate FIR filter for fractional delay
% Generate FIR filter for fractional delay
% ====================================================
% ====================================================
idx
=
(
-
len
+
1
:
len
)
.'
;
% Filter sample indices
idx
=
floor
(
-
len
/
2
+
1
):
floor
(
len
/
2
)
;
% Filter sample indices
causDel
=
-
floor
(
idx
(
1
)
/
2
)
;
% The causal delay of the filter
causDel
=
-
idx
(
1
);
% The causal delay of the filter
sincFilt
=
sinc
(
idx
-
d
el
);
% Calculate the filter
sincFilt
=
sinc
(
idx
-
fracD
el
);
% Calculate the filter
% ====================================================
% ====================================================
% Apply windowing
% Apply windowing
% ====================================================
% ====================================================
fracDel
=
abs
(
rem
(
del
,
1
));
% Total filter delay
% Generate window
% Generate window
if
isstring
(
winFun
)
if
isstring
(
winFun
)
switch
lower
(
winFun
)
switch
lower
(
winFun
)
case
"rectangular"
win
=
ones
(
length
(
idx
),
1
);
case
"hann"
case
"hann"
win
=
sin
(
pi
*
(
idx
-
fracDel
)/
len
)
.^
2
;
win
=
sin
(
pi
*
(
idx
-
fracDel
+
causDel
+
1
)/
len
)
.^
2
;
case
"hamming"
case
"hamming"
alpha
=
25
/
46
;
alpha
=
25
/
46
;
win
=
alpha
-
(
1
-
alpha
)
*
cos
(
2
*
pi
*
(
idx
-
fracDel
)/
len
);
win
=
alpha
-
(
1
-
alpha
)
*
cos
(
2
*
pi
*
(
idx
-
fracDel
+
causDel
+
1
)/
len
);
otherwise
% Rectangular
win
=
ones
(
length
(
idx
),
1
);
end
end
else
else
% Kaiser window
% Kaiser window
win
=
besseli
(
0
,
pi
*
winFun
*
sqrt
(
1
-
(
2
*
(
idx
-
d
el
)/
len
)
.^
2
))/
besseli
(
0
,
pi
*
winFun
);
win
=
besseli
(
0
,
pi
*
winFun
*
sqrt
(
1
-
(
2
*
(
idx
-
fracD
el
)/
len
)
.^
2
))/
besseli
(
0
,
pi
*
winFun
);
end
end
% Shift window function to centre on sinc's peak
% Apply window to the filter
if
~
isscalar
(
winFun
)
sincFilt
=
sincFilt
.*
win
;
win
=
delayseq
(
win
,
floor
(
del
)
+
causDel
);
end
% Apply window function and keep only the causal part up to the length of the filter
sincFilt
=
sincFilt
(
causDel
+
1
:
causDel
+
len
)
.*
win
(
causDel
+
1
:
causDel
+
len
);
% ====================================================
% ====================================================
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment