%Function for problem set 2 part one.  
function[fx]=ps2fun1(x)
if ((x(1)<=2)&(x(2)<=2))
    fx=4.*x(1)+3.*x(2); %case 1 for the function
elseif ((x(1)>2)&(x(2)>2))
    fx=x(1).^2+x(2).^2; %case 2 for the function
else
    fx=0; %case 3 for the function
end
    