代码如下:
clear ;clc;
syms x
f=8.5*10^(-7)*(exp(23.238-3841/(x-0.033*(x-283)^1.17-48.3))-exp(23.238-3841/(x-0.033*(x-283)^1.17-61.6)));
n=NewtonCotes('f',x,333,3);
ezplot(n,[-300,300])
function I = NewtonCotes(f,a,b,type)
%type = 1 科茨公式
%type = 2 牛顿-科茨六点公式
%type = 3 牛顿-科茨七点公式
I=0;
switch type
case 1,
I=((b-a)/90)*(7*subs(sym(f),findsym(sym(f)),a)+...
32*subs(sym(f),findsym(sym(f)),(3*a+b)/4)+...
12*subs(sym(f),findsym(sym(f)),(a+b)/2)+...
32*subs(sym(f),findsym(sym(f)),(a+3*b)/4)+7*subs(sym(f),findsym(sym(f)),b));
case 2,
I=((b-a)/288)*(19*subs(sym(f),findsym(sym(f)),a)+...
75*subs(sym(f),findsym(sym(f)),(4*a+b)/5)+...
50*subs(sym(f),findsym(sym(f)),(3*a+2*b)/5)+...</