2018/10/06

Matlab: Sinc function

The code below shows how to use the sinc() function of Matlab's Signal Processing Toolbox:

x = (-6:1/100:6);
y1 = sinc(x);
plot(x,y1);
y2 = sinc(2*x);
plot(x,y2);
xlabel('x');ylabel('sinc'); title('Sinc Function')
legend('sinx(x)', 'sinc(2x)')

Result:

Note:
The sinc() function here is defined as

    sinc(x) = sin(πx)/πx (normalized sinc function)

References:

sinc - sinc function (MathWorks)
MATLAB sinc issue (StackOverflow)