Computes sin(x) ./ x entrywise, such that sin(0) / 0 yields 1. function y = sinxoverx(x) The function sinc from the Signal Processing Toolbox is related to this function via sinc(x) = sinxoverx(pi*x). See also: sinc
0001 function y = sinxoverx(x) 0002 % Computes sin(x) ./ x entrywise, such that sin(0) / 0 yields 1. 0003 % 0004 % function y = sinxoverx(x) 0005 % 0006 % The function sinc from the Signal Processing Toolbox is related to this 0007 % function via sinc(x) = sinxoverx(pi*x). 0008 % 0009 % See also: sinc 0010 0011 % This file is part of Manopt: www.manopt.org. 0012 % Original author: Nicolas Boumal, Jan. 12, 2022. 0013 % Contributors: 0014 % Change log: 0015 0016 y = sin(x) ./ x; % By default, divisions by zero trigger no warnings. 0017 y(x == 0) = 1; 0018 0019 end