# P15_5 - x xu(1,1) = 3; x i = 1; i Ea = 0.00001; E while Err...

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

%Problem 15.5 % function P15_5 f x = [1 2 3 4 5 6 7]; x y = [3.6 1.8 1.2 0.9 0.72 1.5 .51429]; y xest = [1 2 3 4]; x yest = [3.6 1.8 1.2 0.9]; y coefs = polyfit(xest, yest, 3) c F = coefs(1,4) + coefs(1,3).*X + coefs(1,2).*X.^2 + coefs(1,1).*X.^2; F %bracket between x = 2 and x = 3 % xl = zeros(10,1); x xu = zeros(10,1); x fxl = zeros(10,1); f fxr = zeros(10,1); f fx1fxr = zeros(10,1); f xl(1,1) = 2;

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.

Unformatted text preview: x xu(1,1) = 3; x i = 1; i Ea = 0.00001; E while Err > Ea xr(i,1) = (xl(i,1) + xu(i,1))/2; fxl(i,1) = F(xl(i,1)); fxr(i,1) = F(xr(i,1)); fxlfxr(i,1) = fxr(i,1)*fxl(i,1); if fxlfxr(i,1) < 0 xu(i+1,1) = xr(i,1); xl(i+1,1) = xl end e function new = F(X) f new = coefs(1,4) + coefs(1,3).*X + coefs(1,2).*X.^2 + coefs(1,1).*X.^2...
View Full Document

## This note was uploaded on 09/21/2011 for the course EGM 3344 taught by Professor Raphaelhaftka during the Spring '09 term at University of Florida.

### Page1 / 2

P15_5 - x xu(1,1) = 3; x i = 1; i Ea = 0.00001; E while Err...

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

View Full Document
Ask a homework question - tutors are online