# Lab5 - 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

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

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.

## This note was uploaded on 04/07/2008 for the course ME 218 taught by Professor Unknown during the Spring '08 term at University of Texas at Austin.

### Page1 / 7

Lab5 - 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

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online