Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need Help on Matlab plz!! NUMERICAL INTERPOLATION. Develop a function in Matlab

ID: 3689563 • Letter: N

Question

Need Help on Matlab plz!!

NUMERICAL INTERPOLATION. Develop a function in Matlab that implements the Iterative (recursive) trapezoidal rule technique, in which points are added "in between" existing points to reach a desired level of accuracy. The function should take 4 arguments: a function handle that returns the mathematical function value at a desired point [func = @(x)...], the bounds of integration (a, b), and the desired relative error (eps =1e-6). It should return the value of the integral. Use this code to integrate two functions. sin(x) over the interval (a, b) = (0, pi) cos(6 pi x) exp(-4 x) over the interval (a, b) = (0, 11/2). Have the code indicate how many iterations are required. Submit the code, the number of iterations required for each function, and the integrated values.

Explanation / Answer

the above is the required function with four arguments

INT{0 to pi} sinx dx =2

INT{0 to pi} sinx dx is approx (by the trapezoidal rule)
(pi/8)[sin(0) + 2sin(pi/4) + 2sin(pi/2) + 2sin(3pi/4) + sin(pi)] =
(pi/8)[0 + sqrt(2) + 2 + sqrt(2) + 0] = pi[1 + sqrt(2)]/4 = 1.89611...
actual error is 2 - 1.896... = 0.10388...

since f(x) = sinx, f"(x) = -sin(x)
|f"(x)| = |-sin(x)| <= 1 for all x in the interval [o,pi]
so, worst case is k = 1

|error| <= 1(pi - 0)^3/(12*4^2)
|error| <= .16149...

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote