subject
Mathematics, 14.11.2019 05:31 ugtguytu8528

We want to write a matlab function to solve the non-linear equation f(x) = 0 using any of the methods we learned in section-4. let's define our function as: (xsol, nit, error] = nonlin_lastname(solver, f, a, b, tol, nmax). the first input, solver, is an integer between 1 and 4 which will determine which method should be used, i. e. bisection method if solver=1; regula falsi method if solver=2; newton's method if solver=3; secant method if solver-4. the next input f is an anonymous function. the initial guess values are input by a and b: for the bracketing methods, a and b are the bounding points; for newton's method, a is the initial guess and b should be ignored (but still needs to be used when calling the function); and for the secant method, a and b are initial solution guesses. for bracketing methods, if the initial interval does not bracket a solution, your functions should return with an error message. the convergence tolerance and the maximum number of iterations are input by tol and nmax, respectively. for the newton's method, use the procedure in problem 2.b for estimating the derivative. the function has three outputs: the approximate numerical solution xsol, the integer nit which is the number of iterations it took for the solution to converge, and the error in your solution, i. e. f(x nit)=f(xsol). the iterations should stop if any of the following convergence criteria is met:
i) ii) if(xn)] iii) n > nmax (or in other words we should do nmax iterations at most) optional: if you want to examine the trend of the iterations, you may have your function print all the information of the iteration results to the screen using: fprintf('n=%i: \tx%i = %e it f(x%i)=%e \n',n, n,x, n,f(x)); where n is the current iteration counter, x is the current approximation and f(x) is the function value at x. now write a script to test your function for different nonlinear equations given below with their specified initial guess values. use a tolerance of 10-11 and nmax = 1000.
a. *4 = 3x2 + 2; a = -1.5; b = 10
b. 1 = (2x2 – 1.2)2(2(x – 2.5))*; a = 1.5; b = 2.5
c. tan (x)tan (x) = 1000; a = 1.2; b = 1.45 d. xe* = 10; a = -3; b = 3 e. [x]= 0.3; a = -1; b = 0 f. cos(x) = x; a = -1.579; b = 2 for each of the nonlinear equations, report your results in a separate table with the general format below and using four decimal digits. you may use 'format short; ' in your matlab script to automatically round the numbers to four decimal places. then for each nonlinear equation, plot the function f in the range [2a - b, 2b - a) and use the plots to explain the behavior of each method. method nit xsol error bisection regula falsi newton's secant

ansver
Answers: 2

Another question on Mathematics

question
Mathematics, 21.06.2019 15:30
The value √10 and √15 are plotted on the number line
Answers: 2
question
Mathematics, 21.06.2019 16:00
The scatter plot graph shows the average annual income for a certain profession based on the number of years of experience which of the following is most likely to be the equation of the trend line for this set of data? a. i=5350e +37100 b. i=5350e-37100 c. i=5350e d. e=5350e+37100
Answers: 1
question
Mathematics, 21.06.2019 17:30
What is the shape of the height and weight distribution
Answers: 2
question
Mathematics, 21.06.2019 18:00
Aschool puts on a play. the play costs $1,200 in expenses. the students charge $4.00 for tickets. there will be one performance of the play in an auditorium that seats 500 people. what is the domain of the function that shows the profit as a function of the number of tickets sold?  
Answers: 2
You know the right answer?
We want to write a matlab function to solve the non-linear equation f(x) = 0 using any of the method...
Questions
question
English, 12.10.2020 02:01