Trapezoidal Rule
Trapezoidal Rule
clc
syms x
%trapezoidal rule
L=vpa(((b-a)/2)*(subs(f,a)+subs(f,b)),8)
f = (sym)
a=1
b=2
L = (sym) 0.75000000
# Approximate the value of the following integral using the Trapezoidal's rule
clc
syms x
%trapezoidal rule
L=vpa(((b-a)/2)*(subs(f,a)+subs(f,b)),8)
f = (sym) sin(x)
a=0
b = 1.5708
# Approximate the value of the following integral using the Trapezoidal's rule
clc
syms x
%trapezoidal rule
L=vpa(((b-a)/2)*(subs(f,a)+subs(f,b)),8)
f = (sym)
-x
a=0
b=1
L = (sym) 0.68393972
# Approximate the value of the following integral using the Trapezoidal's rule
clc
syms x
%trapezoidal rule
L=vpa(((b-a)/2)*(subs(f,a)+subs(f,b)),8)
f = (sym) atan(x)
a=0
b=1
L = (sym) 0.39269908