Compute the area bounded by the function 50*sin(10*x^3-.5) and the x-axis from x = π/6 to x = π/3 (Use 100 trapezoids). Write the value below as the one displayed when you issue "format short" in MATLAB.
clc;
clear all;
format short
f=@(x)50*sin(10*x^3-.5); %function
a=pi/6; %lower limit
b=pi/3;%upper limit
n=100; % number of nodes
h=(b-a)/n; % step length
x=a:h:b;% x is running from a tob b
for i=1:length(x)
y(i)=f(x(i));
end
% Trapezoid formula
l=length(x);
Th=((h/2)*((y(1)+y(l))+2*(sum(y)-y(1)-y(l))));
disp('Integral value by Trapezidal rule')
Th
Get Answers For Free
Most questions answered within 1 hours.