sin/x求定积分,x从1到5我用matlab编写程序求解过程如下,fun=@(x)sin(x)/x;a=1;b=5;epsilon=1e-5;n=1;h=(b-a)/2;y0=h*(feval(fun,a)+feval(fun,b));yiter=y0;while 1f=sum(feval(fun,a+(1:2:5*n-1)*h));y=y0/2+h*f;if abs(y-y0)
问题描述:
sin/x求定积分,x从1到5
我用matlab编写程序求解过程如下,
fun=@(x)sin(x)/x;
a=1;
b=5;
epsilon=1e-5;
n=1;
h=(b-a)/2;
y0=h*(feval(fun,a)+feval(fun,b));
yiter=y0;
while 1
f=sum(feval(fun,a+(1:2:5*n-1)*h));
y=y0/2+h*f;
if abs(y-y0)
答
0.603848