Function Calls Given the following functions test 1 and test
Function Calls Given the following functions test 1 and test 2, function res = test1(x, y) res = squareroot (x.^2 + y.^2); end function res = test2(x, y) narginchk(1, 2) if nargin == 2 res = squareroot (x.^2 + y.^2); else res = x; end end determine whether the function calls below are correct or not. If they are correct, indicate the value of the variable out. If they are in error, specify what is wrong with them. You must \"desk-check\" your answers and write them out below by hand. You should not use MATLAB for this problem, unless it is to check your hand-work after you\'ve finished. out = test1 (); out = test1(6); out = test1(3, 4) out = test2(12); out = test2(6, 8) out = test2(8, 10, 12)
Solution
ANSWER:
a. out =0 as it takes default aruguments as zero
b. out=6 as it takes x=6 and y=0
c. out =5 as it takes x=3, y=4
d. out =12 as it excecutes else apart as arguments are not matching and takes x as 12
e. out=10 as it takes x=6, y=8
f. out= 8, as it excecutes else apart as arguments are not matching and takes x as 8
