|
@@ -1,27 +0,0 @@
|
|
|
-function [force_lin, idx]= MoBi_linearize_force(force_from_arduino, linearize, funz)
|
|
|
-
|
|
|
-% linearizie should be a linear function from 0 to a maximum
|
|
|
-%linearize = linspace(0, max_force, force_steps);
|
|
|
-
|
|
|
-% funz should be a non linear function
|
|
|
-
|
|
|
-% funz and linearize should have the same force_steps
|
|
|
-
|
|
|
-if isempty(force_from_arduino) % it might be that at the beginning of the trial weird readings are performed
|
|
|
-
|
|
|
- idx = 0;
|
|
|
-else
|
|
|
-
|
|
|
-idx = find(force_from_arduino<=funz, 1, 'first');
|
|
|
-
|
|
|
-end
|
|
|
-
|
|
|
-% in case force_from_arduino is freater than any value from funz, idx =
|
|
|
-% length(funz) --> so whatever higehr value, the output is always the last
|
|
|
-% idx of funz
|
|
|
-if isempty(idx)
|
|
|
- idx = length(funz)
|
|
|
-end
|
|
|
-force_lin = linearize(idx);
|
|
|
-
|
|
|
-end
|