-
Notifications
You must be signed in to change notification settings - Fork 1
/
filter_threshold_vel.m
38 lines (30 loc) · 1.31 KB
/
filter_threshold_vel.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
function vectorOut = filter_threshold_vel(vectorIn,...
rifThreshold)
% vectorOut = filter_threshold_vel(vectorIn, rifThreshold) return a vector
% equal to the input signal except for the indexes found to have values >=
% or <0 to the rifThreshol variable (that are set to zero).
%
% vectorIn dobles Nx1 gaze vector
%
% rifThreshold doubles 1x1 velocity threshold
%
% vectorOut doubles Nx1 filtered gaze vector
%
%
% Author: Pamela Federighi
% Time-stamp: 2011-02-13
% E-mail: [email protected]
% Comments made by Valeria Serchi Mar 2016
x = vectorIn; % Assign to the variable x the input gaze vector
rif = rifThreshold; % Assign to the variable rif the vale of the input variable rifThreshold
[n, ~] = size(x); % Assign to the variable n the number of the columns of the gaze vector
y = zeros(n, 1); % Initialize the vector y to a vector of zeros having the same size of
% the input gaze vector
% Make a loop on the rows of the input gaze vector. If a value within +-rif
% is found, it is assigned to the corresponding row of the vector y
for i = 1 : n
if x(i) >= rif || x(i) <= -rif
y(i) = x(i);
end
end
vectorOut = y; % Assign to the output variable vectorOut the value of the variable y.