% computes the motion velocity, u, between two one dimensional ``images''
%
% since u = dx/dt, it has units of pixels/frame
% in other words, u is the delay in samples of the new function wrt old func
%
% sampling is between each on a 4 by 4 matrix, so if E1 and E2 both 1 by 8
% (ie if movie is 2 by 8) result is 1 by 7, centered
%
% 1 2 3 4 3 2 1 0
% @ @ @ @ @ @ @
% 9 8 7 6 5 4 3 2
function u = dummy_name(E1,E2)
if length(E1) ~= length(E2)
disp('LENGTHS OF THE TWO FUNCTIONS ARE DIFFERENT');
end%if
N = length(E1);
Ex = (diff(E1) + diff(E2))/2; % dim. 1 by N
now = (E1(1:N-1) + E1(2:N))/2; % interpolate to between pixels
later = (E2(1:N-1) + E2(2:N))/2;
Et = later - now;
u = - sum(Et.*Ex)/sum(Ex.*Ex); % velocity in X direction