For problems 1 through 5, build a MATLAB function to evaluate the appropriate qu
ID: 3111291 • Letter: F
Question
For problems 1 through 5, build a MATLAB function to evaluate the appropriate quadrature rule. Specify the integrand, limits of integration and number of subintervals (if appropriate) as inputs. For each of the problems, apply the rule to the following 2 integrals. Report answers to at least 8 digits after the decimal. Note that integral (b) gives you an indication of the degree of accuracy of each quadrature rule - if d is high enough, you'll get the exact answer. (a) Integral^1_3 sin (2x) = 0.688158561598754 (b) Integral^4_1 x^3 - 3x^2 + 2 dx = 27/4 = 6.75 Implement the 3 point Gaussian rule, which has nodes and weights x = [- squareroot (3/5) 0 squareroot (3/5)]: w = [5/9 8/9 5/9]: by writing a function of the form G3(f, a, b).Explanation / Answer
PLEASE POST PROBLEM 5 AS SEPARATE QUESTION
(a) , (b)
MATLAB CODE:
---------------------------------------------------------------
F1 = @(x)sin(2*x)
Q1=integral(F1,-3,1)
F2 = @(x)x.^3 - 3*x.^2 + 2
Q2=integral(F2,1,4)
----------------------------------------------------------------------------------
OUTPUT:
F1 =
@(x)sin(2*x)
Q1 =
0.6882
F2 =
@(x)x.^3-3*x.^2+2
Q2 =
6.7500
DO THUMBS UP ^_^
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.