You are diving 0/0
, i.e. NaN
by direct substitution in sin(pi*K)/(K*pi)
.
This is what sinc
is actually doing to circumvent that.
i = find(x==0);
x(i) = 1;
y = sin(pi*x)./(pi*x);
y(i) = 1;
You can get the same effect by adding a small regularizer to your values:
subs(sinc(K), K, 0+eps)
ans =
1