```Force Panel
IDENTIFICATION OF HUMAN
TRANSFER FUNCTION
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
2
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Human Transfer Function
Reference
position (to be
followed by
the finger)
H(w)
3
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Modelling
Actual finger
position
Transfer functions have been used to model how human beings
control several types of plants, for example the lane keeping
task in automobiles (Kondo-like models) or route keeping in
aircraft.
Plöchl, Edelmann. Driver models in
automobile dynamics application, Vehicle
System Dynamics, Vol. 45, Nos. 7–8, pp
699–741 , July–August 2007
A typical transfer function is the following:
Simplified:
K
 e P s
1 s TN
Where the gain K, the time delay and TN are parameters
4 inherent of the human being (K is also task dependent), TI and
 changes (TL with
TL are adaptive parameters that the subject
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Modelling
• Band-Limited Noise
• fc = 40 Hz
• Butterworth Lowpass Filter;
1st Order, ft = 0.1 Hz
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Input and output signals
The transfer function gives the possibility to directly simulate the
user behaviour in interacting with any control panel. As an
example:
- to simulate the appearance of a button to press 100 mm far
away from the hand position
Noise PSD
G
 eiwd
1 iw
100
Input: step function

100
Model parameters: Output: simulated trajectory +
G = motion gain
noise (estimation of final
 = time constant
position uncertainty)
d = delay
What if G is less than 1???
6
Why happens to be like that??
button
(typically 0.6)
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Human Transfer Function - simulating the task of
pressing a button
7
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Human Transfer Function - simulating a game
interaction
Class work
Identification in frequency
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
1th work in class:
filter outliers due
to low finger
pressure
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Main steps – 1 filter outliers
2th work in class:
filter the frequency
ratio (that is too
noisy to be used
as it is)
zoom
Zoom of the zoom
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Main steps – 2 filter the FFT ratio
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Main steps – 2 filter the FFT ratio
The considered HTF to find are:
1)
1
1

2)
iw
wP
iw
wZ
1

e  iw
iw
iw
1
1
w P1
w P2
1
3)

1
 e 
iw
iw
wZ
1
 iw

e
2
iw


2i
w
i
w
1
w P 1 w  w 
 N 
N
M. De Cecco - Lucidi del corso di Measurement Systems and Applications

3th work in class:
fit the modulus
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Main steps – 3 fit the modulus of the HTF
4th work in class:
find the phase
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Main steps – 4 find the HTF delay ()
% program to complete in class
% [to do between square brackets]
% so, find '[]' to localize where to write code (or functions)
clear all
close all;
clc;
% []
% [copy the filename to elaborate and its directory]
im = strcat('Dati/Segnale_5/fp_acq_03_04_20111004115703.txt');
tempo = dd(:,1);
x = dd(:,2);
y = dd(:,3);
f1 = dd(:,4);
f2 = dd(:,5);
f3 = dd(:,6);
x_segnale = dd(:,7);
x_touch = x * 1.19 - 108.55 ;
ID = dd (:, 8 ) ;
% time
% x finger position red by arduino [ bit ]
% y finger position red by arduino [ bit ]
% first load cell red by arduino [ bit ]
% second load cell red by arduino [ bit ]
% third load cell red by arduino [ bit ]
% x reference of the vertical line [ pixel ]
% x finger position with respect to LCD (calibration) [ pixel ]
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Class work
% extract time
tempo = tempo - tempo(1) ;
Tc = tempo(end) / length(tempo) ;
tempo = 0 : (length(tempo) - 1) ;
tempo = tempo * Tc ;
% filter repeated data on the ARDUINO ID
IIf = find( [ 1; diff(ID)] ) ;
data_finger = x_touch( IIf ) ;
% x finger position filtered
data_input = x_segnale( IIf ) ;
% x reference filtered
tempo = tempo( IIf ) ;
% time filtered
tempo = tempo - tempo(1) ;
figure, plot( tempo/1000, data_finger, 'b', tempo/1000, data_input, 'r' )
title('Reference and finger position'), grid on
%% 1. Filtering outliers
% [filtrare i salti dovuti a scarsa pressione del dito]
meanF = mean (f1(IIf) + f2(IIf) + f3(IIf)) ; % mean of the load
figure, plot( tempo/1000, data_finger, 'b', tempo/1000, (f1(IIf) + f2(IIf) + f3(IIf) - meanF) *10 + 300, 'r' )
title('Finger position and applied force'), grid on
% []
soglia_Dx = 100 ;
data_finger = FiltraOutliers_CELLE(data_finger, data_input, soglia_Dx) ;
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Class work
%% 2. Trasfer Function estimation
data_input = data_input - mean(data_input) ;
data_finger = data_finger - mean(data_finger) ;
% FFT computation
F_Iinput = fft(data_input) / length(data_input) ;
F_Ooutput = fft(data_finger) / length(data_finger) ;
% plot of the transform ratio
Hs = F_Ooutput ./ F_Iinput ;
Hs(1) = 1 ; % (to recover the fact that the mean values were just eliminated)
ffTF = 1000 * ( 0:(length(data_input)-1) ) / tempo(end) ; % Frequency vector [Hz]
figure, plot(ffTF, abs(F_Iinput), 'r'), hold on
plot(ffTF, abs(F_Ooutput))
plot(ffTF, abs(Hs), 'c')
legend('Input','Output','Hs')
xlabel ('Frequency [Hz]')
% []
% [to filter the experimental transfer function 'Hs' just obtained by FFT ratio]
plotta = 1 ;
Hs = Filtro_Hs( Hs, F_Iinput, F_Ooutput, ffTF, plotta ) ;
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Class work
%% just rename the variables:
Iinput = data_input ;
Ooutput = data_finger ;
%% 3. FITTING modulus with lsqnonlin
% []
% write a function 'FittingFrequenza'
% par_ini = [0 2*pi*0.2 2*pi*0.1 2*pi*2] % solo primo ordine, 4 par
par_ini = [0 2*pi*0.2 2*pi*0.1 0.7 2*pi*2] % anche secondo ordine, 5 par
if length(par_ini) == 4 % 1th order
par_ott = lsqnonlin(@(par) FittingFrequenza(par, Hs, ffTF, 0), par_ini, ...
[0 0 0 0], [100 100 100 100]) ;
elseif length(par_ini) == 5 % 2nd order
par_ott = lsqnonlin(@(par) FittingFrequenza(par, Hs, ffTF, 0), par_ini, ...
[0 0 0 0 0], [100 100 100 100 100]) ; % con [0 100 90 0 0] si fa 2d ordine
end
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Class work
%__________________________________
%
% 4. estimate the parameter delay
%__________________________________
% []
% write a function simulink 'CompDinamica' that simulates the model without delay
% use the function 'corr' to estimate the delay
% 0. neglect the mean values
Iinput = Iinput - mean(Iinput) ;
Ooutput = Ooutput - mean(Ooutput) ;
% 1. dynamical simulation without delay
par = par_ott ;
if length(par) == 4 % solo primi ordini
sim('CompDinamica_1ord')
elseif length(par) == 5 % secondo ordine sottosmorzato
sim('CompDinamica_2ord')
end
Comp_Iinput = interp1(time, Comp_Iinput, tempo/1000)' ;
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Class work
% 2. correlation of the output with the simulated output (without delay)
% []
% [use the function 'corr']
tau = 0 ;
par_ott(1) = tau ;
% plot results
FittingFrequenza(par_ott, Hs, ffTF, 1) ; % !!!!!!!!!!!!!!!!!!!!!!!!!
ModelloHTF(par_ott, ffTF, 1) ;
%% SIMULATION OF A STEP INPUT WITH THE HTF
par = par_ott ;
if length(par) == 4 % 1th order
sim('simulazione_1ord')
elseif length(par) == 5 % 2nd order
sim('simulazione_2ord')
end
figure, plot(time, step, time, step_out), title('Step input simulation')
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
Class work
M. De Cecco - Lucidi del corso di Measurement Systems and Applications
```