1. What do you think this function is for? 2. Explain the inputs and outputs. 3. What would you write in the error state
Posted: Tue Apr 26, 2022 6:02 pm
1. What do you think this function is for? 2. Explain the inputs and outputs. 3. What would you write in the error statement in line 13? 4. What is a way that a user can abuse this function and get an invalid result without triggering the error? Inspect the Matlab function below and answer the above questions IN YOUR OWN WORDS. function [x, i] myMatlabFunc(f, x0 ,x1) = i=0; while abs (x0-x1) >10^(-10) f(x1)*(x1-x0)/(f(x1)-f(x0)) xnext = x1 x0=x1; x1=xnext; i=i+1; if i==100 error ("???????") end end x = x1; end