Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Requirements: Write a script and 3 functions. Write the program to cycle until the users chooses to stop. The script will have an outer while
Requirements:
Write a script and functions. Write the program to cycle until the users chooses to stop.
The script will have an outer while loop and use dialog boxes and switch case statements as described below.
The three functions are as follows:
note a below is the left value of and is the right value of in the interval of interest
a Integrate a function using the Trapezoidal Method, inputs are function, and # of slices output is the
integral value.
b Integrate a function using the Simpson Method, inputs are function, and # of slices output is the
integral value.
c Find the ROOT of a function using the ROOTS algorithm, inputs are function, and epsilon a small #
output is the final root of
Script flow should be as follows:
Using a Dialog button with buttons see Forvs While.m file have the user chose one of the anonymous
functions. The selected Anonymous function will be used in the three Programmed functions Integral by
Trapezoidal Method, Integral by Simpson Method, or Root by BiSection Method.:
aNOTE integral about root about Method can affect accuracy for both
solutions use slices and epsilon of your choice but greater than I recommend
bNote you should be able to set any range for integral and a specific range for one of the
roots
c You pick the but be sure you can define a range for the roots
Using an input statement ask the user to pick Trapezoidal, Simpson, or ROOT. Make sure you are consistent
with string or number. You can use what you are comfortable with. The input variable will then be used in a
switch case statement. Each case will do the following:
a First case Trapezoidal Integral
i Ask the user for the inputs and function was already chosen in
ii Call the function with parameters is from the anonymous selection above.
iii. Use fprintf to output the answer
b Second case Simpson Integral
i Ask for the three inputs and function was already chosen
ii Call the function with parameters is from the anonymous selection above.
iii. Use fprintf to output the answer
c Third case ROOTs
i Ask for the three inputs and function was already chosen
ii Call the function with parameters is from the anonymous selection above.
Remenber e is a very small # eg or
Special NOTE use and on different runs to compare the accuracy of the
answer you get.
iii. Use fprintf to output the answer
Write three functions:
a Integral by Trapezoidal method
b Integral by Simpson Method
c Find Root
These functions inputs and output are described above. The INTEGRATION & ROOT doc describes the algorithm
inside these functions.
EXTRA CREDIT pts: For Item instead of input statement use a second dialog box with buttons.
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