Question: SUBJECT: MODIFIED FALSE POSITION METHOD. Please RESET: il and iu . it looks like I have an error under ELSE IF section (iu). % Modified

SUBJECT: MODIFIED FALSE POSITION METHOD. Please RESET: il and iu. it looks like I have an error under ELSE IF section (iu).

% Modified False Position

xl = 0; % xl = 1; xu = 5; % xu = 4; precision = 10^-5;% precision = 10^-5; f = @ (x) 3*(x^2)-5; % ea = approximate error

iteration_count = 0; fxl = f(xl); fxu = f(xu); xr = xu - (f(xu)*(xl-xu))/(fxl-f(xu)); ea = abs((xl-xu)/(xl+xu))*100; % ea = approximate error

il = 0; iu = 0;

while ea > precision xr = xu - (f(xu)*(xl-xu))/(fxl-f(xu)); ea = abs((xl-xu)/(xl+xu))*100; % ea = approximate error iteration_count = iteration_count + 1; if fxl * f(xr) < 0 xu = xr; iu = 0; il = il + 1; if il >= 2 fl = fl/2; il = 0; end elseif fxl * f(xr) > 0 xl = xr; il = 0; iu = iu + 1; if iu >= 2 fl = fl/2; iu = 0; end end end bisect = xr; fprintf(['Using the Modified False Position Method, the root is located at ' ... num2str(bisect) ' after ' num2str(iteration_count) ' iterations.']);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!