a)
function t=comptraprule(f,a,b,n)
h=(b-a)/n;
exactVal=log(b^2+2)-log(a^2+2);
sum=0;
for i=1:n-1
x(i)=a+i*h;
sum=sum+f(x(i));
end
Itrap=h*(f(a)+2*sum+f(b))/2;
disp(['Itrap:'' ',num2str(Itrap)]);
disp(['exactVal:'' ',num2str(exactVal)]);
end
b)
function s=simprl(f,a,b,n)
h=(b-a)/(2*n);
exactVal=log(b^2+2)-log(a^2+2);
s1=0;
s2=0;
for k=1:n
x=a+h*(2*k-1);
s1=s1+f(x);
end
for k=1:(n-1)
x=a+h*2*k;
s2=s2+f(x);
end
Isimp=h*(f(a)+f(b)+4*s1+2*s2)/3;
disp(['Isimp:'' ',num2str(Isimp)]);
disp(['exactVal:'' ',num2str(exactVal)]);
end
c) After saving both the above codes in the script window as (comptraprule.m) and simprl.m respectively (don't rule) and type the below code:

Write a MATLAB function/script that performs the following tasks. Approximate: 2+2 (a) Using the composite Trapezoidal...
4. Find the exact value of the integral. Then use composite trapezoidal rule and the composite Simpson's rule to approximate the integral below using n 4 and n 8. Round your results to four decimal places. .3 2a +3a2 dx
Use
Matlab code
Consider the following function sin(x) Using the following parameters in your functions: -func: the function/equation that you are required to integrate -a, b: the integration limits n: the number of points to be used for the integration I:Integral estimate a) Write a function capable of performing numerical integration of h(x) using the composite trapezoidal rule. Use your function to integration the equation with 9 points. Write a function capable of performing numerical integration of h(x) using the...
2 Problem 3 (25 points) Let I = ïrdz. a) [by hand] Use a composite trapezoidal rule to evaluate 1 using N = 3 subintervals. b) MATLAB] Use a composite trapezoidal rule to evaluate I using N - 6 subinterval:s c) by hand] Use Romberg extrapolation to combine your results from a) and b) and obtain an improved approximation (you may want to compare with a numerical approximation of the exact value of the integral
2 Problem 3 (25 points)...
Use the Trapezoidal Rule and Simpson's Rule to approximate the value of the definite integral for the given value of n. Round your answer to four decimal places and compare the results with the exact value of the definite integral. foxt dx, n = 4 (x + 2)2 Trapezoidal Simpson's exact The velocity function, in feet per second, is given for a particle moving along a straight line. v(t) = 2 - t - 132, 1sts 13 (a) Find the...
3. Evaluate the triple integral below (a) analytically, (b) using the composite trapezoidal rule with n 2, (c) a single application of Simpson's 1/3 rule, and (d) for each approximation, determine the true percent relative error based on (a). 2yz)dx dy dz
3. Evaluate the triple integral below (a) analytically, (b) using the composite trapezoidal rule with n 2, (c) a single application of Simpson's 1/3 rule, and (d) for each approximation, determine the true percent relative error based on...
Write a function which takes inputs x, y and n and integrates using Simpson's rule. Write the code in matlab to determine the value of n and h required to approximate So 1 dx to within 10^-5 and compute the approximation. Use Composite Simpson's rule.
DO THIS IN MATLAB PLEASE
DO THIS IN MATLAB
Create a script file that performs the following calculations. Your script will use the functions you create. Label all graphs appropriately. For this project, do not have your homemade functions fprintf anything, instead have all your fprintf commands within your script. Attach your published script file along with .m files for your functions. Exercise 1. A fundamental iterative method for finding the roots of equations of one-variable is known as Newton's...
2- Evaluate the following integral: 0.4 | Vcos(2x)dx a) By calculator, b) Composite trapezoidal rule (with segment no. n=4) and determine the true relative error, c) Composite Simpson's 1/3 with n =4 and determine the true relative error, d) Simpson's 3/8 rule determine the true relative error, e) Composite Simpson's rule, with n =5, determine the true relative error.
can i get some help with this ?
1. Approximate the following integral, exp(r) using the composite midpoint rule, composite trapezoid rule, and composite Simpeon's method. Each method should invol + l integrand evaluations, k 1: 20. On the same plot, graph the absolute error as a function of n. ve exactly n = 2k 2. Approximate the integral from Question 1 using integral, Matlab's built-in numerical integrator. What is the absolute error?
1. Approximate the following integral, exp(r) using...
(10 marks) Evaluate the integral [*r'e ce-dx; 1. Using Composite Trapezoidal rule with (n=4) 2. Estimate the error for the approximation in (a) 3. Using Composite 1/3 Simpson's Rule (n = 4).