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
 Fall '09
 RAPHAELHAFTKA
 initial guess, False Position Mehtod

Click to edit the document details