# Calculating value of $\text{sinc}(x)$, WolframAlpha and MATLAB give two different answers.

I need to evaluate the following: $$\frac{2}{3}\text{sinc}\bigg(\frac{2\pi}{3}(n-4)\bigg)-\frac{1}{3}\text{sinc}\bigg(\frac{\pi}{3}(n-4)\bigg)$$

for $$n=[0,...,8]$$

I don't have the sinc function in my casio fx so I wanted to use the fact that $$\text{sinc}(x)=\frac{\text{sin}(x)}{x}$$ and that $$\text{sinc}(0)=1$$ Hence, for $$n=0$$ I got $$\frac{2}{3}\text{sinc}\bigg(\frac{2\pi}{3}(-4)\bigg)-\frac{1}{3}\text{sinc}\bigg(\frac{\pi}{3}(-4)\bigg)=0.1378....$$

This seems to agree with wolfram alpha:

But then I checked the mark scheme on my past paper that the question is taken from, and there it says that I should've got $$0.0093$$ so i put it in MATLAB:

...and it also says $$0.0093$$.

So... which one of the two is correct? What's going on?

• There is a problem for $n=4$. – Michael Rozenberg Dec 28 '18 at 18:16
• Matlab includes a factor of Pi in it's definition of sinc. mathworks.com/help/signal/ref/sinc.html – Josh B. Dec 28 '18 at 18:18
• @JoshB. That is criminal. I need to write an angry email to Matlab. – DudeMan Dec 28 '18 at 18:19
• I see. They use something called normalized sinc. And it would make senses cause Wiki says: In digital signal processing and information theory, the normalized sinc function is commonly defined for x ≠ 0 by bla bla bla. And the course I am doing is signal processing. – Scavenger23 Dec 28 '18 at 18:20
• This function is not part of core Matlab but rather the Signal Processing Toolbox. As @EeveeTrainer points out below, this normalized sinc function is commonly used in signal processing applications that this toolbox was designed for. You can easily create a non-normalized version, e.g.: sinc2=@(x)sinc(x/pi);. – horchler Dec 28 '18 at 20:13

As it happens, there are apparently two different conventions for what the $$\text{sinc}(x)$$ function actually denotes in terms of the $$\sin(x)$$ function. (I ran into this same confusion on my class on Fourier analysis.) The conventions you might see are

$$\text{sinc}(x) = \frac{\sin(x)}{x} \;\;\; \text{or} \;\;\; \text{sinc}(x) = \frac{\sin(\pi x)}{\pi x}$$

The latter is known as the "normalized sinc function," per Wikipedia. I don't know much about which is used more when, so I'll leave you with the Wikipedia article in that respect.

Checking your functions if interpreted in the latter way, i.e. for $$n=0$$

$$\frac{2}{3} \left( \frac{-3}{8\pi^2} \right) \sin \bigg(\frac{-8\pi^2}{3}\bigg)-\frac{1}{3} \left( \frac{-3}{4\pi^2} \right) \sin \bigg(\frac{-4\pi^2}{3}\bigg)$$

Wolfram Alpha gives a value of $$0.0093...$$, in agreement with your MATLAB answer. Indeed, as noted by Josh B. in the comments, MATLAB uses the latter convention.

I would assume, then, this is the source of the discrepancy.

• Yeah I had a read about it now. Looks like I need to have a discussion with my professor. Couple of weeks ago he defines it in a "standard way" and then suddenly in the past paper it is in the "normalized way". – Scavenger23 Dec 28 '18 at 18:26

Matlab defines $$\mathrm{sinc}_{\text{Matlab}} = \begin{cases} \frac{\sin(\pi t)}{\pi t} & t \neq 0, \\ 1 & t = 0 \end{cases} \text{.}$$

Wolfram (in the Details section) and the rest of the world define $$\mathrm{sinc}_{\text{everyone else}} = \begin{cases} \frac{\sin t}{t} & t \neq 0, \\ 1 & t = 0 \end{cases} \text{.}$$

Using Matlab's nonstandard definition of this function, the value of your $$n=0$$ expression is $$0.009321942713359250447 \dots$$.

• Yup. Looks like matlab is a rebel. – Scavenger23 Dec 28 '18 at 18:37