You are here : matlabSignal Processingdiric

diric() - Signal Processing

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.


Syntax

y = diric(x,n)


Example

Dirichlet FunctionOpen This Example
Compute and plot the Dirichlet function between 
 and 
 for N = 7 and N = 8.
x = linspace(-2*pi,2*pi,301);

d7 = diric(x,7);
d8 = diric(x,8);

subplot(2,1,1)
plot(x/pi,d7)
ylabel('N = 7')
title('Dirichlet Function')

subplot(2,1,2)
plot(x/pi,d8)
ylabel('N = 8')
xlabel('x / \pi')

The function has a period of 
 for odd N and 
 for even N.Periodic and Aperiodic Sinc FunctionsOpen This ExampleThe Dirichlet and sinc functions are related by 
. Illustrate this fact for 
.xmax = 2;
x = linspace(-xmax,xmax,1001)';

N = 6;

yd = diric(x*pi,N);
ys = sinc(N*x/2)./sinc(x/2);

subplot(2,1,1)
plot(x,yd)
title('D_6(x*pi)')
subplot(2,1,2)
plot(x,ys)
title('sinc(6*x/2) / sinc(x/2)')

Repeat the calculation for 
.N = 9;

yd = diric(x*pi,N);
ys = sinc(N*x/2)./sinc(x/2);

subplot(2,1,1)
plot(x,yd)
title('D_9(x*pi)')
subplot(2,1,2)
plot(x,ys)
title('sinc(9*x/2) / sinc(x/2)')


Output / Return Value


Limitations


Alternatives / See Also


Reference