试题详情
简答题 假设 ,采用for循环语句求 提示:每一个小曲边梯形的面积和为定积分的值,步长h=(3*pi-0)/1000。
  • 程序:
    a=0;b=3*pi;
    n=1000;
    h=(b-a)/n;
    x=a;s=0;
    f0=exp(-0.5*x)*sin(x+pi/6);
    fori=1:n
    x=x+h;
    f1=exp(-0.5*x)*sin(x+pi/6);
    s=s+(f0+f1)*h/2;
    f0=f1;
    end
  • 关注下方微信公众号,在线模考后查看

热门试题