function Y = influence3d(x, m, k, df, N); % influence(x, m, k, df, N) -- Compute influence based on distance factor % % The influence() function is deisgned to compute the influence of the xth % nearest neighbor to a fish, given that there are N fish in the school, % the maximum influence possible is m (usually 1), the "influence constant" % is k, and the distance factor (usually computed by a different function) % is df. The only required argument is x. Default values are m = 1, k = 0.1, % df = 1/2, and N = 16 fish. The influence function returns a fractional % number, by which the A/R function's result can then be multiplied. The % functional form of influence is: % % / m \ % Y = | ----------------------- | % \ 1 + k^(-X + df * N ) / % % Example: % ģInfl = influence(4, 1, .1, 1/8, 32) % Computes the influence of 4th NN % Infl = % % 0.5000 Y = m / ( 1 + k^( - (x - ( df * N )) ) );