Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB question(do the No. 2 question) function ModRegFal = ModRegFal(a, b, n) format long; a = input('Enter a value for lower boundary a: '); b
MATLAB question(do the No. 2 question)
function ModRegFal = ModRegFal(a, b, n)
format long;
a = input('Enter a value for lower boundary a: '); b = input('Enter a value for upper boundary b: '); n = input('How small should should the error be (to what -power)? ');
if (f(a)*f(b) > 0 ) disp ('Invalid values of a and b. Program Closing') return; end;
F = f(a); G = f(b); w0 = a;
while (1) wn = (G*a-F*b)/(G-F); disp([a b wn w0]) %% just checking where the values are, and it they look correct if f(a)*f(wn) > 0 disp('ranif 1')%% just checking where the values are, and it they look correct b = wn; G = f(wn); if f(w0)*f(wn) > 0 F = F/ 2; end; disp('ranif 2')%% just checking where the values are, and it they look correct disp([a b wn w0])%% just checking where the values are, and it they look correct else a = wn; F = f(wn); if f(w0)*f(wn) > 0 disp('ranif 3')%% just checking where the values are, and it they look correct disp([a b wn w0])%% just checking where the values are, and it they look correct G = G/ 2; end; end disp([a b wn w0]) if (abs((wn - w0)/wn)plot (error)
grid on;
title('Plot of error');
xlabel('iterations');
ylabel('Error');
Modified Regula Falsi Method Frequently, in the regula falsi method, one of the endpoints of the interval stays the same in all iterations, while the other endpoint advances toward the root (Fig.1). In the modified regula falsi method, when this situation occurs, the straight line that connects the endpoints of the interval is replaced with a line that has a smaller slope. As shown in Fig.2, this is done by dividing by 2 the value of the function at the end point that stays the same. Consequently, the line intersects the x-axis closer to the root. f(x)t Abi) NS2 Actual62 solution Ka) Figure 1: Regula Falsi method
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started