Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a matlab code using all the root finding methods. Problem Description This

ID: 3592691 • Letter: W

Question

Write a matlab code using all the root finding methods.

Problem Description This homework problem is designed to help you achieve the following course objective: Find roots of equations using bracketing and open methods; explain the differences between the two methods and point out the advantage of each method. Problem Description: Develop a MATLAB function to find the root of a user-specified function using a user-specified computational method. Implement all of the following methods: (a) the bisection method (b) the false position method (c) the built-in "fzero" function with an initial bracketing interval (d) the fixed point iteration method (e) the Newton-Raphson method (f) the built-in "fzero" function with an initial guess Read the function template for more details. Note that (c) and (f) have already been implemented in the template. Therefore you only need to enable (a), (b), (d) and (e) Hint: You may re-use functions and subfunctions developed in the past.

Explanation / Answer

function [z] = find_roots() x = 0.01:0.01:(20*pi/2)-0.01; plot(x,tan(x)+5.6*x), grid on f = @(x) tan(x)+5.6*x; N = 250; % Fineness of the search, bigger is finer z = zeros(1,N); for jj = 1:30 for n=1:N try z(n) = fzero(f,jj+[(n-1)/N n/N]); if abs(f(z(n)))>1e-8 z(n) = 0; else fprintf('Found a root at: %.5f ',z(n)) end catch end end end x = 0:pi/50:10*pi; y = f(x); plot(z,zeros(1,length(z)),'o',x,y,'-') line([0 10*pi],[0 0],'color','black') axis([0 10*pi -1000.0 3000.0]) z = sort(z(z~=0)); % Return only the needed values

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote