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 Kommentare

Torsten
Torsten am 11 Jul. 2022
Works.
Do you have a licence for the Signal Processing Toolbox such that you can use the "sinc" function ?
Torsten
Torsten am 11 Jul. 2022
Bearbeitet: Torsten am 11 Jul. 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 am 11 Jul. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

John D'Errico
John D'Errico am 11 Jul. 2022

0 Stimmen

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.

Produkte

Version

R2022a

Tags

Gefragt:

am 11 Jul. 2022

Beantwortet:

am 11 Jul. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by