problem with function sinc

86 visualizaciones (últimos 30 días)
dert sgt
dert sgt el 27 de Mzo. de 2020
Editada: dert sgt el 27 de Mzo. de 2020
hello everyone
i have a problem with the function sinc (i'm not so expert i started to use mathlab 3 months ago) and i wrote this:
x = 0:pi/100:2*pi;
y=sinc(x);
but i have an error:
Undefined function 'sinc' for input arguments of type 'double'.
someone can help me? thanks

Respuesta aceptada

Birdman
Birdman el 27 de Mzo. de 2020
Editada: Birdman el 27 de Mzo. de 2020
Adapt its formula as follows:
x = 0:pi/100:2*pi;
y=sin(pi*x)./(pi*x);%sinc function
plot(y)
  7 comentarios
Jack
Jack el 27 de Mzo. de 2020
While the singal processing toolbox has sinc() defined explicitly, you can always create a function that does this -- e.g. put the following in a file called sinc.m somewhere in your current path (or in ~/Documents/MATLAB/ or My Documents\MATLAB\)
function out = sinc(x)
% Deal with the removable singularity at 0 explicitly.
out = sin(x)./x;
out(x == 0) = 1;
end
dert sgt
dert sgt el 27 de Mzo. de 2020
thanks so much again you're fantastic!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by