clcclearclose allx = linspace(0,100);y = x.^cos(x);plot(x,y);a = trapz(x,y);y = @(x)x.^cos(x);b = integral(y,0,100);c=a-b;
MATLAB: Trapz or integral which one is more accurate
integraltrapz
integraltrapz
clcclearclose allx = linspace(0,100);y = x.^cos(x);plot(x,y);a = trapz(x,y);y = @(x)x.^cos(x);b = integral(y,0,100);c=a-b;
Best Answer