MATLAB: Else if Question with function

elseifxy

??
Write a program to evaluate the function f (x, y) for any two values x and y, where the function f (x, y) is defined as follows; f (x, y) = x+y if x and y are greater than or equal to 0, f (x, y) = x+y^2 if x is greater than or equal to 0 and y is less than 0, f (x, y) = x^2+y if x is less than 0 and y is greater than or equal to 0 and f (x, y) = x^2+y^2 if x and y are less than 0.

Best Answer

Check
function
if
elseif
To start with
function op = f(x,y)
if (x>=0 && y>=0)
op=x+y;
elseif(x>=0 && ...
....%If you want to deserve your marks, you should fill this up!
....
end
edited output to op.