2 Print and Submitl Write a MATLAB function that takes an in
     2. [Print and Submitl Write a MATLAB function that takes an input number, x, and returns an output number, y, that will be of the following form y Vx when x 0 y x2 when -1 sx s 0 y 3 x when x  
  
  Solution
% matlab code
function y = Recitation3Problem3(x)
 if x > 0
 y = sqrt(x);
 elseif x >= -1 && x <= 0
 y = x*x;
 else
 y = -1*x;
 end
 end
x = 3;
 y = Recitation3Problem3(x)
 %output: y = 1.7321
 x = -1;
 y = Recitation3Problem3(x)
 %output: y = 1
 x = -3;
 y = Recitation3Problem3(x)
 %output: y = 3

