Beruflich Dokumente
Kultur Dokumente
2) (5 points) There is a simpler way to accomplish what TestIfZeroList does in Problem 1 above. Write a new function
to accomplish the task in the following 3 steps:
Step 1: Square every number in L. The resultant list can only contain positive numbers and zeros.
Step 2: Add up every number in this new list. To do this, you may use MATLAB’s built-in “sum”
function.
Step 3: If the resultant sum is greater than 0, then there must have been at least one nonzero element in L.
Implement Steps 1-3, starting with the function header below.
end
3. (5 points) What is the output to the following function call, for the (incorrect) function BisectionMethod below? Note
that by default MATLAB’s sin function works in radians, not degrees.
>> [xllist, xulist] = BisectionMethod(@(x)sin(x), 3, 3)