quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryعلوم الحاسوب schoolبكالوريوس event_available2026-07-15

السؤال

Transcribed Image Text:

Problem 8.1 A Matlab m-function Simpson.m that implements the composite Simpson's rule and an m-script testSimpson.m that tests Simpson are on Canvas for download. Run testSimpson and discuss the results. Expand test Simpson to use Simpson with n = 2 and n = 200 subintervals to approximate the definite integral I(f) = (x² - ex+ √2)dx Use fprintf to display the approximated values computed by the composite Simpson's rule and the absolute errors of the approximations. Why do you think the errors are reasonable? Write a Matlab m-function that computes the integral of f(x) in the interval [a,b], using the composite trapezoidal rule with equally spaced nodes x0,x1,...,xn (x0 = a, x₁ = b). The interface should be function T Trapezoidal (func, a, b,n) where n is the number of subintervals, a and b are the endpoints, and func is a function handle used to pass a function. Referring to test Simpson.m, write an m-script testTrapezoidal.m that uses Trapezoidal to approximate the integral 1(ƒ) () = [', sin(xx) exp(x) dx = . = (e-) 1+π² using uniform partition Ph with n 10, 20,..., 1280 subintervals. To avoid repetitions in your code, define an array n= [10,20,40,80,160,320,640,1280] and write a for-loop. Display your results from the trapezoidal rule in a table. Each row of the table consists of the values of h, the approximation T (f; Ph), the error E = 1(f) -T(ƒ;P), and the ratio |ETE (note that the ratio for the row for n = 10 is not available, so leave it blank). Discuss the results.

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top