MATLAB sinc(0)
will return 1 as it should. But sinc(K)
of some symbol K
for which a value of zero is substituted will return NaN.
The following code illustrates the above:
sinc(0) % calculate sinc of 0, this will return 1
K = sym('K'); % define symbol K
% try to substitute value 0 for K in sinc(K), this will return NaN
subs(sinc(K), K, 0)
Can I force sinc
to return 1 in the symbolic case (without knowing the value of K
in advance)?
MATLAB Version: 8.0.0.783 (R2012b)
Symbolic Math Toolbox Version 5.9 (R2012b)
You are diving
0/0
, i.e.NaN
by direct substitution insin(pi*K)/(K*pi)
.This is what
sinc
is actually doing to circumvent that.You can get the same effect by adding a small regularizer to your values: