Answered step by step
Verified Expert Solution
Question
1 Approved Answer
matlab programming General Integrator Develop a general purpose Matlab integrator that will integrate an arbitrary bounded function on an arbitrary interval. Your function should be
matlab programming
General Integrator Develop a general purpose Matlab integrator that will integrate an arbitrary bounded function on an arbitrary interval. Your function should be called as follows: >> integrator('sin(x)', [01], le-6) where the third argument as an upper bound on the absolute error. The last argument should be optional (with le-6 being the default). The main challenge in this project is error control since you don't know the true answer So start the following by letting h=0.01 and using Simpson's rule. Then proceed to divide h by 2. When the answer states changing by less than 0.1*(requested error), consider that is the area of the answer. If that never starts happening, which means that the input function is too complex, display an error. Keep track of how long the previous step took and if the following step would take more than 5 minute prompt the user on whether to proceed. Save time by subdividing the segment into 2 halves and working with cach half separately. Make your function recursive (you will need to write a sub-function), but don't allow the recursion depth to exceed more than 100. Optional (10% extra mark): The fourth parameter should let the user choose what integration method to use and should be either something like 'ne 12which would mean Newton-Cotes 12-th order, or something like 'g12' which would mean Gauss 12-point integration. write the code for MATLAB Prepare a report explaining the codes and why you chose them (in notepad or word) Refrence Numerical Methods for Engineers Steven C. Chapra or...)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