{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lab5 - Doug Rivas ME218 Lab 5 M 5-7 5.1 M-File...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Doug Rivas ME218 Lab 5 M 5-7 5.1 M-File : onevariable.m x= [-10:.01:20]; plot(x, f(x)) title( 'Doug Rivas' ) xlabel( 'X' ) ylabel( 'F' ) 5.2 I made a slight modification to the m- file in order to see the zeros better: x= [-10:.01:20]; plot(x, f(x), x , 0) title( 'Doug Rivas' ) xlabel( 'X' ) ylabel( 'F' )
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Based on this screen, the root to 2 significant digits is 17.13. 5.3 #i nclude<stdio.h> int i=0 ; float a ; float b ; float xm ; while (i< 20) { a= 14.0; b= 20.0 xm = .5*(a+b); if (-.0001< f(xm) < .0001) { xm= .5*(a+b); break }
Image of page 2
else if (f(xm)>0) { b= xm; } else if (f(xm)<0) { a= xm; } i= i++ } xm 5.4 Calculate the value of the calculated root from the bisection method for that particular function and see how close it actually is to 0. 5.5 xm is equal to 5, since there is not root in this interval, the method fails. The value of f(xm) in this interval is never close to zero because a zero does not exist between the two boundary values. 5.6 x=3, x*= 1.5331 x= 7, x*= -1.3672 x= 20, x*= 17.131 5.7 With x= 12.0, the Newton method does eventually converge to the 17.13 root, but with x= 11.5, it does not converge to 17.13 after MANY executions. This is because there
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern