MatLab program:
clear
clc
% function
f=@(x) 0.2+25*x-200*x^2+675*x^3-...
900*x^4+400*x^5;
% limits
a=0.5;
b=1.5;
A=49.3667;
fprintf('\nSolution by analytical method');
fprintf(' is %f',A);
% no. of segments
nn=[1 2 3];
for k=1:length(nn)
n=nn(k);
h=(b-a)/n;
for i=1:n+1
x(i)=a+(i-1)*h;
y(i)=f(x(i));
end
I=0;
%formula I=(h/2)*(y0+yn+2(y1+y2+.....yn-1)
I=(h/2)*(2*sum(y(2:end-1))+y(1)+y(n+1));
fprintf('\n\nn=%d\n',n);
fprintf('\nSolution I=%f',I);
Er=abs((A-I)/A)*100;
fprintf('\nTrue percent error is %f%%',Er);
end
Screenshot:
Save the above program and execute it.
Result:
I hope this will help you.
1. Use the Trapezoidal Rule to numerically integrate the following polynomial from a = 0.5 to...
2. Use the Trapezoidal Rule to numerically integrate the following polynomial from a tob 1.5 f(x) = 0.2 + 25x-200x' + 675xs_ 900x. + 400x5 Use three different numbers of segments (n- 2, n 3, and n 4) and show the effect of the number of segments on relative error considering the exact value of the integral which is 48.7719. (Note: Show the steps of calculation).
Question 1: Numerically integrate function f(x) given on the right from x=0 to x=10. Use the f(x)= x2 - 6x + 16 Trapezoidal Rule and the Simpson's 1/3 Rule and compare the results. Use at least 4 50 + 15x - ye? decimal digits in your calculations and reporting. Organize and report each one of your solutions in a calculation table and identify your result clearly. a) Divide the interval into 5 subdivisions. Calculate the integral first using the Trapezoidal...
Evaluate the integral integral_0 15^2x dx analytically, using the Trapezoidal Rule (1-segment), and Simpson's 1/3 Rule (1-segment). Then use the Matlab trap() function presented in class to find a solution exact to 4 decimal places. How many segments were required for this accuracy?
USE MATLAB ONLY NEED MATLAB CODE MATLAB 21.4 Integrate the following function analytically and using the trapezoidal rule, with - 1,2,3, and 4: 0 (x + 2/x dx 0 Use the analytical solution to compute true percent relative crrors to evaluate the accuracy of the trapezoidal approximations. 0
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)...
Complete the following problems in Matlab environment. Copy your com mand and final answer from MATLAB command window and paste them in a word document. Submit a single word document file for the entire HW Problems: Code your own MATLAB program to find the approximate value of the integral J e dr with Trapezoidal rule for N 20, .e., 2 (formula 4.21 on Page 201 YS). Also give the relative error of t2o with de-1. (Hint: For-end loops or Elementwise...
help wanted?? thank you explain correctly Problem 1 Use the trapezoidal rule technique to approximate the following integrals: a) 「(x2+1)dr(Note: use 0.5 increments forx) b) sina d INote: use a MATLAB function to subdivide the interval into eight equal parts) c e dx (Note: use 0.25 increments for x Problem 2 Use the Simpson's rule to evaluate the following integrals aDdr Problem 3: Given the polynomial: x3-6x2 + 30-0, Use MATLAB to find all roots of this polynomial. Use MATLAB's...
Im not sure if this site uses MATLAB, but ill post the question anyway. MidPoint Rule In this phase, we will evaluate the integral numerically using the definition by Riemann sum. For numerical calculations, we will use MATLAB software 3. First, use MATLAB to evaluate this time a definite integral x ехах For that, type directly into command window in MATLAB: syms x; int(x*exp(x),0,2). Get the answer in a number with at least four decimals. . Download an m-file, midPointRule.m,...
How would you code this on matlab? Wirite a code to find an approximation for the composite trapezoidal rule. dr witiferent mumber of sabintervals using Use the following number of subintervals namely, n 10,n 20,n-40 andn 100 and calculate the global errors in each case. Wirite a code to find an approximation for the composite trapezoidal rule. dr witiferent mumber of sabintervals using Use the following number of subintervals namely, n 10,n 20,n-40 andn 100 and calculate the global errors...
Use Simpson's 1/3 rule with n segments to approximate the integral of the following function on interval [1, 13] f(t) = 1.945 · sin (27) The exact value of the integral is Teract = 15.4821 Fill in the blank spaces in the following table. Round up your answers to 4 decimals. Relative error et is defined as I - Ieract * 100% Et = Texact n, segments I, integral Et(%) 2 8