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

Info iconThis 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' )
Background image of page 1

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

View Full DocumentRight 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 }
Background 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
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
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 Right Arrow Icon
Ask a homework question - tutors are online