{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

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' )

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

View Full Document
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 }
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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern