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

Please use Matlab to solve and comment i·m, \"y be output in Macia ing fprintf t

ID: 3670031 • Letter: P

Question


Please use Matlab to solve and comment

i·m, "y be output in Macia ing fprintf to consolidate. NOTE: The midterm exam will include material covered in this homework Find the point of intersection of the following two equations x)-8sinl Do this a) Using the bisection method using initial guesses of O and 4n b) Using the Newton-Raphson method using initial guesses of O the secant method using initial guesses of 0 and Using the false-position method using initial guesses of 0 and 4n For a)-d), itera for each part te until you have at least 3 sign ) The number of iterations needed to converge on the intersection. i) Make a plot showing where each guess was (4 plos total, I per method) e) Why did some methods converge faster than others for this exa ter than others for this example

Explanation / Answer

a)using bisection method

         f=@(x)-5*x.^2-2;

          a=0;

           b=12.57142;

       for i=1:100

               c=(a+b)/2;

                if f(c)>0

                      b=c;

               else

                       a=c;

               end

        end

fprintf('Approxinmation Root is %f',c);

  

b) using newton raphson method:

                f=@ 8* sin(x.^2-2)

                df=@(x)-5*x.^2-2

                a=0;b=0;

                x=a;

               for i=1:1:100

                  x1=x-(f(x)/df(x));

                 x=x1;

              end

         sol=x;

         fprintf('Approximate Root is %f',sol)