Question: Need help with number 2. Write a script file that employs any combination of the flow control commands to generate the given matrix. B =
Write a script file that employs any combination of the flow control commands to generate the given matrix. B = [1 1 0 0 0 0 0 -2 2 0 0 0 -1 0 3 3 0 0 0 1 0 -4 4 0 0 0 -1 0 5 5 0 0 0 1 0 -6] Write a user-defined function with function call [opt, k]-opt_finder(fp, x0, kmax, tol) where fp is the derivative (as an inline function) of a given function f, x_0 is a specified value, kmax is the maximum number of iterations, and tol is a specified tolerance. The function sets x_1 =x_0, calculates |fp(x_1)|, and if it is less than the tolerance, then x_1 approximates the critical point opt at which the derivative is near zero. If not, it will increment x, by 0.1 to obtain x_2, repeat the procedure, and so on. The process terminates as soon as |fp(x_k)|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
