Solution+to+HW4 - EGM3344 Solution to HW4 Fall 2010 6.4(a...

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: EGM3344 Solution to HW4 Fall 2010 6.4 (a) Graphical >> x = linspace(0,4); >> y = 8*sin(x).*exp(-x)-1; >> plot(x,y);grid 6.11 S1 a) >> format long >> x0=0.5; %Initial Guess >> x = fzero(@(x)x^2*abs(sin(x))‐4,x0) x = 3.478508515574645 b) %False Position Mehtod clear all clc x0 = 0; %initial Guess xf=4; % Final Guess error = 1; i=0 while(error > (5*10^(‐7))) i=i+1 f0 = x0^2*abs(sin(x0))‐4; ff = xf^2*abs(sin(xf))‐4; if(f0*ff<0) x2 = x0‐f0*(xf‐x0)/(ff‐f0); %Secant Part end f_x2 = x2^2*abs(sin(x2))‐4 if(f0*f_x2<0) xf=x2; end if(f_x2*ff<0) x0=x2; end error = abs(f_x2); end ...
View Full Document

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

Ask a homework question - tutors are online