Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function final = fxy4C_name(x, y)
- %--------CALCULATIONS--------
- %If x and y are more than or equal to 0.
- if (x >= 0) && (y >= 0)
- final = x^2 + y;
- end
- %If x is more than or equal to 0 and y is less than 0.
- if (x >= 0) && (y < 0)
- final = x * y;
- end
- %If x is less than 0 and y is more than or equal to 0.
- if (x < 0) && (y >= 0)
- final = x + y^2;
- end
- %If x and y are less than 0.
- if (x < 0) && (y < 0)
- final = x^2 / y^2;
- end
- %--------OUTPUTS--------
- %Prints out results.
- fprintf('f(%d,%d) = %0.2f', x, y, final)
Advertisement
Add Comment
Please, Sign In to add comment