%Compound trapezoid formula复化梯形法function y = traint(a,b,n,f)h = (b - a) / n;x = linspace(a,b,n+1);y1 = h * feval(f,x);y1(1) = y1(1) / 2;y1(n+1) = y1(n+1) / 2;y = sum(y1);%compound Simpson formula...
用MATLAB程序编写复化梯形公式和复化simpsion公式求解积分
%Compound trapezoid formula复化梯形法function y = traint(a,b,n,f)h = (b - a) / n;x = linspace(a,b,n+1);y1 = h * feval(f,x);y1(1) = y1(1) / 2;y1(n+1) = y1(n+1) / 2;y = sum(y1);%compound Simpson formula...