Beginner matlab user here. I'm trying to write a function that multiplies a and b and returns the product if a and b is positive and -abs(a*b) if any of them is negative. This is what I've got.
function y = MulAnd(a,b)
%MULAND Summary of this function goes here
% Detailed explanation goes here
if(a<0||b<0)
y = -(abs(a*b));
else
y = a*b;
end
end
Matlab doesn't like it. What am I doing wrong?