Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB Everything I need is in 7. What to Submit I need the FCN.m file, Quadr.m file, and TrapzRule file. Thank you, in advance, for

MATLAB
image text in transcribed
Everything I need is in "7. What to Submit"
I need the "FCN.m" file, "Quadr.m" file, and "TrapzRule" file.
Thank you, in advance, for help.
Quadrature Rules Finding Pi The goal is to implement and compare the basic Quadrature Rules for I-i, Fox) dx the integral of a given function Fox over an interval [a,bl, using M subintervals. The integrant F(x) should be coded as a Matlab function FCN in a separate file FCN m 1. Implement the Rectangle Rule as a Matlab function in a code RectRule.m. with both Left and with Right Heights. a. Inputs to the function RectRule should be a, b, M b. The code should print out: M and RL-Rectangle Rule approximation using Left heights and RR Rectangle Rule approximation using Right heights c. Debug on lei 3 dx with M-4. d. Debug on Jo' (2x-1) dx with M- 4. e. Test it on joi 301-x2)dx with M-1000. Looks like rather large M is needed to get a decent approximation... 2. Implement the Midpoint Rule as a Matlab function in a code MidptRule.m Repeat a e above to debug and test the Midpoint Rule. 3. Implement the Trapezoidal Rule as a Matlab function in a code TrapzRule.m Repeat a e above to debug and test the Trapezoidal Rule. 4. Create a Matlab function Quadr.m with input arguments a, b, M. which A. calls each of your quadrature rules (with the same a, b, M), B. computes the error of each rule by comparing with I exact (see below) C. prints a (nicely formatted) table like: Comparison of Quadrature Rules using M subintervals: Rule Value Error 5. Value of Pi: How can we produce t (to machine accuracy) if we need it in a computation, in any language Very easily, from the arctan(x) function: since tan(n/4) 1, we have: Pi-4*atan(1.0) In fact, this is the best way to set the value of Pi- in a code, in any language. insert the formula as I exact in your "Quadr.m" so can compute and print the errors. 6. Use your Quadr.m to find an approximation to the number Pi from the formula: a. Using M- 1000, how many correct digits does TrapzRule produce b. Using M 100000, how many comect digits does TrapzRule produce c. What is the connection between the formulas for Pi in 5. and in 6. 7. What to submit: In a single plain text file "labl4.txt" insert the following: l. Answers to questions 6a, 6b, 6c your results are unexpected, any guesses as to what may be happening If (separator) 2. your "FCN.m" file, showing coding for integral for in 6. (separator) 3. your "Quadrm" file (separator) 4, your ule.m" file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions