force panel identification of human transfer function

32
M. De Cecco - Lucidi del corso di Measurement Systems and Applications Force Panel IDENTIFICATION OF HUMAN TRANSFER FUNCTION

Upload: roger

Post on 26-Jan-2016

64 views

Category:

Documents


3 download

DESCRIPTION

Force Panel IDENTIFICATION OF HUMAN TRANSFER FUNCTION. 2. Human Transfer Function. H( w ). Reference position (to be followed by the finger). Actual finger position. 3. Modelling. The considered HTF to find are:. 1). 2). 3). Class work Identification in frequency. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Force Panel

IDENTIFICATION OF HUMAN

TRANSFER FUNCTION

Page 2: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

2

Human Transfer Function

Page 3: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

3

Modelling

H()Reference position (to be followed by the finger)

Actual finger position

Page 4: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

1+iω

ωZ

1+iω

ωP

⋅1

1+2iωζ

ωN

+iω

ωN

⎝ ⎜

⎠ ⎟

2 ⋅e−− iωτ

The considered HTF to find are:

1+iω

ωZ

1+iω

ωP1

⋅1

1+iω

ωP2

⋅e−− iωτ€

1

1+iω

ωP

⋅e−− iωτ

1)

2)

3)

Page 5: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Class work

Identification in frequency

Page 6: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 1 filter outliers

1th work in class: filter outliers due

to low finger pressure

Page 7: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Page 8: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Show and run the file “PROPEDEUTICO_Filtra Outliers.m”

Main steps – 1.a Filter outliers with heuristics

Page 9: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Possible ideas to identify outliers:- Identify them with an upper value [use ‘find’]- identify them with the derivative [use ‘diff’]

To replace the outliers values:- With the previous value- with the mean value between the previous and the following- interpolating

After outliers compensation compare the FFT of the original and the filtered signal [use ‘fft’]

Main steps – 1.a Filter outliers with heuristics

Page 10: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

http://users.rowan.edu/~polikar/WAVELETS/WTpart1.html

Main steps – 1.b Filter outliers with Wavelets

A stationary signal

x(t)=cos(2*pi*10*t)+cos(2*pi*25*t)+cos(2*pi*50*t)+cos(2*pi*100*t)

Page 11: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 1.b Filter outliers with Wavelets

a signal with four different frequency components at four different time intervals, hence a non-stationary signal. The interval 0 to 300 ms has a 100 Hz sinusoid, the interval 300 to 600 ms has a 50 Hz sinusoid, the interval 600 to 800 ms has a 25 Hz sinusoid, and finally the interval 800 to 1000 ms has a 10 Hz sinusoid.

Why wavelets? They are extremely useful in non-stationary signals

Page 12: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 1.b Filter outliers with Wavelets

Why wavelets? They are extremely useful in non-stationary signals

Page 13: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 1.b Filter outliers with Wavelets

How can appear a wavelet:

the Morlet wavelet shown is defined as the product of a complex exponential wave and a Gaussian envelope:

http://paos.colorado.edu/research/wavelets/wavelet2.html

Page 14: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 1.b Filter outliers with Wavelets

we now need some way to change the overall size as well as slide the entire wavelet along in time. We thus define the "scaled wavelets" as:

We are given a time series X, with values of xn, at time index n. Each value is separated in time by a constant time interval dt. The wavelet transform Wn(s) is just the inner product (or convolution) of the wavelet function with our original timeseries:

W(s, n)

Page 15: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 1.b Filter outliers with Wavelets

The above integral can be evaluated for various values of the scale s (usually taken to be multiples of the lowest possible frequency), as well as all values of n between the start and end dates. A two-dimensional picture of the variability can then be constructed by plotting the wavelet amplitude and phase.

Page 16: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 1.b Filter outliers with Wavelets

The wavelets allow to decompose a signal as follows: the DWT (Discrete Wavelet Transform)

The DWT analyzes the signal at different frequency bands with different resolutions by decomposing the signal into a coarse approximation and detail information. DWT employs two sets of functions, called scaling functions and wavelet functions, which are associated with low pass and highpass filters, respectively. The decomposition of the signal into different frequency bands is simply obtained by successive highpass and lowpass filtering of the time domain signal.

The original signal x[n] is first passed through a halfband highpass filter g[n] and a lowpass filter h[n]. After the filtering, half of the samples can be eliminated according to the Nyquist's rule, since the signal now has a highest frequency of p /2 radians instead of p . The signal can therefore be subsampled by 2, simply by discarding every other sample.

Page 17: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 1.b Filter outliers with Wavelets

This constitutes one level of decomposition and can mathematically be expressed as follows:

(where yhigh[k] and ylow[k] are the outputs of the highpass and lowpass filters, respectively, after subsampling by 2)

Page 18: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 1.b Filter outliers with Wavelets

The above procedure, which is also known as the subband coding, can be repeated for further decomposition. At every level, the filtering and subsampling will result in half the number of samples (and hence half the time resolution) and half the frequency band spanned (and hence double the frequency resolution).

Approximation of level 3

Detail of level 1

Detail of level 2

Detail of level 3

Page 19: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 1.b Filter outliers with Wavelets

One important property of the discrete wavelet transform is the relationship between the impulse responses of the highpass and lowpass filters. The highpass and lowpass filters are not independent of each other, and they are related by

where g[n] is the highpass, h[n] is the lowpass filter, and L is the filter length (in number of points). Note that the two filters are odd index alternated reversed versions of each other. Lowpass to highpass conversion is provided by the (-1)n term. Filters satisfying this condition are commonly used in signal processing, and they are known as the Quadrature Mirror Filters (QMF).

Page 20: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 1.b Filter outliers with Wavelets

a quadrature mirror filter is a filter whose magnitude response is mirror image about of that of another filter. Together these filters are known as the Quadrature Mirror Filter pair.

The filter responses are symmetric about :

The analysis filters are often related by the following formulae in addition to quadrate mirror property:

In this way they are also complemetary and there fore the signal is not distorted!!!

Page 21: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 1.b Filter outliers with Wavelets

Show an example with wavemenu

Page 22: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 2 filter the FFT ratio

2th work in class: filter the frequency

ratio (that is too noisy to be used

as it is)

zoom Zoom of the zoom

Page 23: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 2 filter the FFT ratio

Page 24: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 3 fit the modulus of the HTF

3th work in class: fit the modulus

Page 25: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

Main steps – 4 find the HTF delay ()

4th work in class: find the phase

Page 26: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

% program to complete in class% [to do between square brackets]% so, find '[]' to localize where to write code (or functions) clear allclose all;clc; %% Load DATA % [1.]% [copy the filename to elaborate and its directory]im = strcat('Dati/Segnale_5/fp_acq_03_04_20111004115703.txt'); [header, hh, dd] = readColData(im,8,7,1); tempo = dd(:,1); % timex = dd(:,2); % x finger position red by arduino [ bit ]y = dd(:,3); % y finger position red by arduino [ bit ]f1 = dd(:,4); % first load cell red by arduino [ bit ]f2 = dd(:,5); % second load cell red by arduino [ bit ]f3 = dd(:,6); % third load cell red by arduino [ bit ]x_segnale = dd(:,7); % x reference of the vertical line [ pixel ] x_touch = x * 1.19 - 108.55 ; % x finger position with respect to LCD (calibration) [ pixel ]ID = dd (:, 8 ) ;

Class work

Page 27: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

% extract timetempo = tempo - tempo(1) ;Tc = tempo(end) / length(tempo) ;tempo = 0 : (length(tempo) - 1) ;tempo = tempo * Tc ; % filter repeated data on the ARDUINO IDIIf = find( [ 1; diff(ID)] ) ;data_finger = x_touch( IIf ) ; % x finger position filtereddata_input = x_segnale( IIf ) ; % x reference filteredtempo = tempo( IIf ) ; % time filteredtempo = 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 % [1.]soglia_Dx = 100 ;data_finger = FiltraOutliers_CELLE(data_finger, data_input, soglia_Dx) ;

Class work

Page 28: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

%% 2. Trasfer Function estimation data_input = data_input - mean(data_input) ;data_finger = data_finger - mean(data_finger) ; % FFT computationF_Iinput = fft(data_input) / length(data_input) ;F_Ooutput = fft(data_finger) / length(data_finger) ; % plot of the transform ratioHs = 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 onplot(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 ) ;

Class work

Page 29: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

%% 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 parpar_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

Class work

Page 30: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

%__________________________________%% 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 valuesIinput = Iinput - mean(Iinput) ;Ooutput = Ooutput - mean(Ooutput) ; % 1. dynamical simulation without delaypar = 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)' ;

Class work

Page 31: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications

% 2. correlation of the output with the simulated output (without delay)% []% [use the function 'corr']tau = 0 ; par_ott(1) = tau ; % plot resultsFittingFrequenza(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')

Class work

Page 32: Force Panel IDENTIFICATION OF HUMAN  TRANSFER FUNCTION

M. De Cecco - Lucidi del corso di Measurement Systems and Applications