% SINC The mathematical sinc function % % y = sinc(x) computes sin(x)/x. Parameter x can be a scalar or vector. % function y = sinc(x) i = find(x==0); % Detect any zero arguments if i~=0 % and make them 1 to avoid x(i) = 1; % dividing by zero. end; y = sin(x)./x; % Compute the function if i~=0 % Go back and adjust y(i) = 1; % the sinc(0) cases. end;