MATLAB: Problem in plotting a sinc function

sinc plot

when i run this code.. it shows me an error
Error in ==> plotsinc at 2
y = sinc(x);
what that means...
iam using this code ..to plot a basic sinc function
x = linspace(-5,5);
y = sinc(x);
plot(x,y)

Best Answer

The code you posted runs for me without error.
The sinc function is part of the Signal Processing Toolbox.
If don’t have the Signal Processing Toolbox, you can create your own version of sinc easily enough:
sincx = @(x) sin(pi*x+1E-8)./(pi*x + 1E-8);
x = linspace(-5,5);
y = sincx(x);
plot(x,y)