Accelerating the pace of engineering and science

# diric

Dirichlet or periodic sinc function

y = diric(x,n)

## Description

y = diric(x,n) returns a vector or array y the same size as x. The elements of y are the Dirichlet function of the elements of x. n must be a positive integer.

The Dirichlet function, or periodic sinc function, is

$D\left(x\right)=\left\{\begin{array}{ll}\frac{\mathrm{sin}\left(Nx/2\right)}{N\mathrm{sin}\left(x/2\right)}\hfill & x\ne 2\pi k,\text{ }k=0,±1,±2,±3,...\hfill \\ {\left(-1\right)}^{k\left(N-1\right)}\hfill & x=2\pi k,\text{ }k=0,±1,±2,±3,...\hfill \end{array}$

for any nonzero integer n. This function has period 2π for n odd and period 4π for n even. Its peak value is 1, and its minimum value is -1 for n even. The magnitude of this function is (1/n) times the magnitude of the discrete-time Fourier transform of the n-point rectangular window.

## Diagnostics

If n is not a positive integer, diric gives the following error message:

```Requires n to be a positive integer.
```