USING MATLAB ONLY PLEASE COMMENT CODE IN DETAIL SHOW OUTPU
USING MATLAB ONLY - PLEASE COMMENT CODE IN DETAIL & SHOW OUTPUT
Write an M-file.
Write a function that will accept two number and return the smaller one. Assume the numbers are distinct.
Solution
%define function with one return value and 2 parameter
function num_small = smaller(a,b)
%check if b less than a
if(a>b)
%true then return b
num_small=b
else
%false,then return a
num_small=a
end
%end if
% end function
end
