DOING PHYSICS WITH MATLAB
MATHEMATICAL ROUTINES
THE UNNORMALIZED SINC FUNCTION
Ian Cooper
School of Physics, University of Sydney
[email protected]
DOWNLOAD DIRECTORY FOR MATLAB SCRIPTS
math_sinc_function.m
mscript used to investigate the sinc function. The mscript is divided into a number of
cells that should be run independently by hitting the Ctrl and Enter keys together.
simpson1d.m
Function to give the integral of a function using Simpsons 1/3 rule.
turningPoints.m
Function to find the zero crossings of a function and its maxima and minima.
THE UNNORMALIZED SINC FUNCTION
The sinc function is widely used in optics and in signal processing, a field which
includes sound recording and radio transmission.
In mathematics, physics and engineering, the unnormalized cardinal sine function
or sinc function, denoted by sinc(x) is defined by
y x
sin x
x
At x = 0 the sinc function has a value of 1.
y 0
sin 0
1
0
Figure (1) shows a plot of the sinc function.
Doing Physics with Matlab
The sinc function is the zeroth order spherical Bessel function of the first kind
j0 x
sin x
x
All the zero of the sinc function occur at non-zero integer multiples of
y m 0
m 1, 2, 3,
Hence, the zeros of the sinc function are evenly spaced, the spacing being equal to
as shown in figure (2).
The local maxima and minima of the sinc function correspond to its intersections with
the cosine function.
y xm
sin xm
cos xm
xm
maxima and minima
where the derivative of sin(x)/x is zero and thus a local extremum is reached as shown
in figure (2).
Fig. 1. The unnormalized sinc function y x
Doing Physics with Matlab
sin x
plotted against x.
x
Fig. 2. The unnormalized sinc function y x
sin x
plotted against x / .
x
x
The zeros occur at = 1, 2, 3, . The magenta curve is the cosine
function cos(x).
Table 1. x / values for the max and min values of ym sin x / x and
ym 2 sin x / x as shown in figures (2) and (3).
2
x/
ym
ym2
1.429
1.000
- 0.2172
1.000
0.0472
2.462
3.470
4.478 5.486
0.1284 - 0.0913
0. 0709 - 0.0580
0.0165
0.0050
0.0083
0.0034
The values for the zero crossings and minima and maxima were found using the
function turningPoints.m .
View document of Turning points of a function
Doing Physics with Matlab
The square of the sinc function sin x / x gives the intensity distribution on a screen
2
for the Fraunhoffer diffraction for a single slit.
sin x
Fig. 3. The y x
plotted against x / .
x
2
The gradient of the sinc function can be found using the Matlab gradient command
xMin = -20;
xMax = 20;
N = 999;
x = linspace(xMin, xMax, N);
y = sin(x+eps) ./(x+eps);
yC = cos(x);
dy_dx = gradient(y);
Doing Physics with Matlab
% range for x values
% x values
% y values sinc(x)
% cosine function
% gradient of sinc function
The integral of the sinc function is
1
sin x
dx 1
x
This integral can be computed using the function simpson1d.m. In executing the
function simpson1d.m the limits of the integral and the number of partitions can be
increased until the answer converges.
%% integral of sinc and (sinc)^2
clear all
close all
clc
xMin = -1500;
% range for x values
xMax = 1500;
N = 99999;
% number of partitons
x = linspace(xMin, xMax, N); % x values
y = sin(x+eps) ./(x+eps);
% y values sinc(x)
integral = simpson1d(y,xMin,xMax)/pi
xMin = -1500
xMax = +1500
N = 9999
integral = 1.0000
xMin = -1000
xMax = +1000
N = 999
integral = 0.9996
xMin = -200
xMax = +200
N = 99
integral = 1.6703
xMin = -200
xMax = +200
N = 999
integral = 0.9985
View document of Simpsons 1/3 rule
Doing Physics with Matlab