MATLAB_Function_Report_Expanded
MATLAB_Function_Report_Expanded
Question 1:
What does the `addTwoNumbers` function do, and what will it return if we input the numbers 3 and 5
into it?
Answer:
This function simply takes two input numbers, adds them together, and returns the result. If we call
`addTwoNumbers(3, 5)`, the function adds 3 and 5 to give 8 as the output. It demonstrates basic
arithmetic in MATLAB and helps in practicing how to write and use functions with input and output
parameters.
Question 2:
What is the output of calling the `squareNumber` function with the input value 4?
Answer:
This function calculates the square of the given input number. When we call `squareNumber(4)`, the
function computes 4 raised to the power of 2, which is 16. It is useful in many mathematical
applications and is a good example of using mathematical operators inside MATLAB functions.
Question 3:
What will happen when the `checkSign` function is executed with an input of -10?
Answer:
The function checks whether a number is positive, negative, or zero. It uses an if-elseif-else
conditional structure. When we call `checkSign(-10)`, the number -10 is less than 0, so the function
will display the message: 'Negative number'. This function is helpful to understand conditionals and
decision-making in MATLAB programming.