Message Boards Message Boards

0
|
5909 Views
|
3 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Sinc function definition in Wolfram Language

Posted 4 years ago

Why is the sinc function in Mathematica is different from Matlab

e.g. sinc(pi/2) in Matlab gives -0.1977 however in Mathematica it gives Sinc[Pi/2] = -0.0544021

Also the plotting results were totally different. In Matlab here is the code clc clear all close all

t=linspace(-10,10,2000+1); t(end)=[]; y=sinc(t); figure hold on plot(t,y)

///////////////////////////////////////////////////// in Mathematica Plot[Sinc[x],{x,-10,10}] enter image description here

enter image description here

POSTED BY: Sheng Dai
3 Replies

Because in Mathematica: Sinc[z] is equivalent to Sin[z]/z for z!=0, but is 1 for z=0.

A workaround:

  x = Pi/2; Sinc[Pi*x] // N
  (*-0.197651*)
  Sin[Pi x]/(Pi x) // N
  (*-0.197651*)

  Plot[Sinc[Pi x], {x, -10, 10}, PlotRange -> All, AxesOrigin -> {-10, -0.4}]
POSTED BY: Mariusz Iwaniuk

Doing some minimal research might help, e.g. Wikipedia !

POSTED BY: Henrik Schachner

Mathematica uses radians as the input and Matlab uses a “Normalized” sinc function. Matlab has a unitless input and multiplies it by Pi to get radians. Matlab definition is Sin(pix)/(pix).

Regards,

Neil

POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract