Not enough input arguments

Hi there,
I need some help figuring out why I keep getting a "Not enough input arguments" error for the following code.
Thanks in advance
Here is the error message:
Not enough input arguments.
Error in functionhandle>@(x,y)x.*y+10*sin(x).*cos(y) (line 32)
f = @(x,y) x.*y + 10*sin(x).*cos(y);

2 Kommentare

Bhanu Prakash
Bhanu Prakash am 15 Mär. 2023
Hi Daniel,
Can you post the complete code, so that the error can be understood clearly?
Askic V
Askic V am 15 Mär. 2023
Bearbeitet: Askic V am 16 Mär. 2023
You didn't post the relevant code. Most probably this line
f = @(x,y) x.*y + 10*sin(x).*cos(y);
is inside the function and you're trying to execute function as a script i.e. just pressing the green play button in the editor.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 15 Mär. 2023

1 Stimme

f = @(x,y) x.*y + 10*sin(x).*cos(y);
x = linspace(0,2*pi) ;
y = linspace(0,2*pi) ;
[X,Y] = meshgrid(x,y) ;
Z = f(X,Y) ;
surf(X,Y,Z)

Kategorien

Mehr zu Entering Commands finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 15 Mär. 2023

Bearbeitet:

am 16 Mär. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by