-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathdeadZone.m
35 lines (29 loc) · 892 Bytes
/
deadZone.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 y = deadZone(u, thr)
% DEADZONE implements a dead zone for the input u. If an element of u is
% lower (absolute value) than a user-defined threshold,
% consider that element of u as zero. u can be either a vector
% or a scalar.
%
% FORMAT: y = deadZone(u, thr)
%
% INPUT: - u = [n * 1] input vector;
% - thr = user-defined threshold;
%
% OUTPUT: - y = [n * 1] filtered output.
%
% Authors: Daniele Pucci, Marie Charbonneau, Gabriele Nava
%
% all authors are with the Italian Istitute of Technology (IIT)
% email: [email protected]
%
% Genoa, Dec 2018
%
%% --- Initialization ---
% initialize output
y = u;
for i = 1:length(u)
if abs(u(i)) < thr
y(i) = 0;
end
end
end