MAKE A FLOWCHART PLEASE  clc; clear; function [] = Bisection(xl,xu,es,imax) ea = 100 xr = (xu+xl)/2; x=xr fr=evstr(f) while (ea>es) a=fl-fu; if (a==0) then mprintf("Error: Division by Zero") abort end test = fl * fr; mprintf(" %d %10f %10f %10f %12.7f %12f %12.f %10.7f\n",iter,xl,xu,xr,fl,fu,fr,ea); if (test<0) then xu=xr; elseif (test>0) then xl=xr; elseif (test==0) then mprintf("\n\nThe root of the equation is %f",xr) abort end x=xl fl=evstr(f) x=xu fu=evstr(f) xrold=xr xr=(xu+xl)/2; x=xr fr=evstr(f) ea=abs((xr-xrold)/xr)*100; iter=iter+1; test=fl*fr if ea < es then mprintf(" %d %10f %10f %10f %12.7f %12.f %12.f %10.7f\n",iter,xl,xu,xr,fl,fu,fr,ea); mprintf("\n\nThe approximate root for the given function is %f",xr) abort end if iter > imax mprintf("The approximate root for the given function is %f",xrold) mprintf("\nSlowly converges. It is suggested that the initial values should be change"); abort end end endfunction //main disp("This program will solve/give the approximate root of any given nonlinear algebraic equations using the Bisection Method") f=input("Input the function to be evaluated: ",'string') xl=input("Enter the lower limit: ") x=xl fl=evstr(f) if (fl==0) then mprintf("Lower limit is the root. ") end xu=input("Enter an upper limit: ") x=xu fu=evstr(f) if (fu==0)then mprintf("Upper limit is the root. ") abort end b = fl*fu; if (b>0) then mprintf("The initial guesses are invalid. f(xl)*f(xu) should be less than zero"); abort end es=input("Input the value of accepted tolerance of error (es): ") imax=input("Enter the desired number of iterations: "); iter=1 mprintf(" iter \t\txl \t \t xu \t xr \t f(xl) \t f(xu) \t\t\tf(xr) ea\n");//for output table Bisection(xl, xu, es, imax)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

MAKE A FLOWCHART PLEASE 

clc;
clear;

function [] = Bisection(xl,xu,es,imax)
ea = 100
xr = (xu+xl)/2;
x=xr
fr=evstr(f)
while (ea>es)
a=fl-fu;
if (a==0) then
mprintf("Error: Division by Zero")
abort
end
test = fl * fr;
mprintf(" %d %10f %10f %10f %12.7f %12f %12.f %10.7f\n",iter,xl,xu,xr,fl,fu,fr,ea);
if (test<0) then
xu=xr;
elseif (test>0) then
xl=xr;
elseif (test==0) then
mprintf("\n\nThe root of the equation is %f",xr)
abort
end
x=xl
fl=evstr(f)
x=xu
fu=evstr(f)
xrold=xr
xr=(xu+xl)/2;
x=xr
fr=evstr(f)
ea=abs((xr-xrold)/xr)*100;
iter=iter+1;
test=fl*fr
if ea < es then
mprintf(" %d %10f %10f %10f %12.7f %12.f %12.f %10.7f\n",iter,xl,xu,xr,fl,fu,fr,ea);
mprintf("\n\nThe approximate root for the given function is %f",xr)
abort
end
if iter > imax
mprintf("The approximate root for the given function is %f",xrold)
mprintf("\nSlowly converges. It is suggested that the initial values should be change");
abort
end
end
endfunction

//main

disp("This program will solve/give the approximate root of any given nonlinear algebraic equations using the Bisection Method")
f=input("Input the function to be evaluated: ",'string')
xl=input("Enter the lower limit: ")
x=xl
fl=evstr(f)
if (fl==0) then
mprintf("Lower limit is the root. ")
end
xu=input("Enter an upper limit: ")
x=xu
fu=evstr(f)
if (fu==0)then
mprintf("Upper limit is the root. ")
abort
end
b = fl*fu;
if (b>0) then
mprintf("The initial guesses are invalid. f(xl)*f(xu) should be less than zero");
abort
end
es=input("Input the value of accepted tolerance of error (es): ")
imax=input("Enter the desired number of iterations: ");
iter=1
mprintf(" iter \t\txl \t \t xu \t xr \t f(xl) \t f(xu) \t\t\tf(xr) ea\n");//for output table

Bisection(xl, xu, es, imax)



Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education