Error with sinc command

7 visualizaciones (últimos 30 días)
Robert Madonna
Robert Madonna el 11 de Jul. de 2022
Respondida: John D'Errico el 11 de Jul. de 2022
I have enclosed the code I used, and matlab returns the error "Check for incorrect argument data type or missing argument in call to function 'sinc'."
I tried the code in Octave online and it works flawlessly. Is there a problem with my Matlab code or some error I'm not seeing?
t = linspace(-5,5,100);
X = sinc(t);
y = fft(X);
mag = abs(fftshift(y));
f = linspace(0,100);
figure(1)
plot(t,X)
title('Figure 1')
figure(2)
plot(f,mag)
title('Figure 2')
Check for incorrect argument data type or missing argument in call to function 'sinc'.
  3 comentarios
Torsten
Torsten el 11 de Jul. de 2022
Editada: Torsten el 11 de Jul. de 2022
Isn't it ridiculous that one must licence a toolbox to have access to such a simple function ?
Of course, it's easy to program it on ones own, but nevertheless ...
Robert Madonna
Robert Madonna el 11 de Jul. de 2022
Thank you. I have a license for that, but it did not install in my student version. After I got it installed it worked perfectly.

Iniciar sesión para comentar.

Respuestas (1)

John D'Errico
John D'Errico el 11 de Jul. de 2022
sinc is also present in the symbolic toolbox, though it would not be of use here. You need the signal processing toolbox for the code you wrote to work.
which sinc -all
/MATLAB/toolbox/signal/signal/sinc.m /MATLAB/toolbox/signal/signal/@tall/sinc.m % Shadowed tall method /MATLAB/toolbox/symbolic/symbolic/@sym/sinc.m % Shadowed sym method
However, the error message you got is not the one I expect to see for a missing function. For example, if I do this:
t = 1:5;
hwrthwrhwyh(t)
Unrecognized function or variable 'hwrthwrhwyh'.
where there is no function of that name in MATLAB, it will throw an error, but not the one you got. But if you have ONLY the symbolic toolbox and NOT the signal processing toolbox, as is my case) then you will get this error:
sinc(1:5)
Check for incorrect argument data type or missing argument in call to function 'sinc'.
And that is the error message you got. That leads me to suspect that you lack the signal processing TB, and do have the symbolic TB.
So if you want that code to work in MATLAB, you need to buy the signal processing toolbox.

Categorías

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

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by