1. What do you think this function is for? 2. Explain the inputs and outputs. 3. What would you write in the error state
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
1. What do you think this function is for? 2. Explain the inputs and outputs. 3. What would you write in the error state
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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!