Lemon Li
Upload ZuCo1.0 dataset
cdde0b0 verified
Raw
History Blame Contribute Delete
1.48 kB
function v = vecvel(xx,SAMPLING,smoothtype) %------------------------------------------------------------ % FUNCTION vecvel.m % Calculation of eye velocity from position data % Please cite: Engbert, R., & Kliegl, R. (2003) Microsaccades % uncover the orientation of covert attention. Vision Research % 43: 1035-1045. % % (Version 1.2, 01 JUL 05) %------------------------------------------------------------- % % INPUT: % % xy(1:N,1:2) raw data, x- and y-components of the time series % SAMPLING sampling rate (number of samples per second) % smoothtype 0: no smoothing % 1: 3-point smoothing % 2: 5-point smoothing (default) % % OUTPUT: % % v(1:N,1:2) velocity, x- and y-components % %------------------------------------------------------------- % modified by olaf.dimigen@hu-berlin.de, Oct-1-2013 for EYE-EEG toolbox N = length(xx); % length of the time series v = zeros(N,2); if nargin<3 % default is 5-point smoothing smoothtype = 2; end switch smoothtype case 0 % no smoothing v(2:N,:) = SAMPLING*diff(xx); case 1 % 3-point smoothing v(2:N-1,:) = SAMPLING/2*(xx(3:end,:) - xx(1:end-2,:)); case 2 % 5-point smoothing (default) v(3:N-2,:) = SAMPLING/6*(xx(5:end,:) + xx(4:end-1,:) - xx(2:end-3,:) - xx(1:end-4,:)); v(2,:) = SAMPLING/2*(xx(3,:) - xx(1,:)); v(N-1,:) = SAMPLING/2*(xx(end,:) - xx(end-2,:)); end