func5p1.asv
上传用户:zhdd911129
上传日期:2007-05-11
资源大小:722k
文件大小:0k
源码类别:

matlab例程

开发平台:

Matlab

  1. %Integration,using N-L methom
  2. I1=4*(atan(1)-atan(0))
  3. %Trapz Rule
  4. I2=1/2*(sub5p1(1)+sub5p1(0))
  5. %Simpson Rule
  6. I3=1/6*(sub5p1(1)+4*sub5p1(1/2)+sub5p1(0))
  7. %Composite Trapezoidal Rule
  8. x=linspace(0,1,100)
  9. I4=0
  10. for i=1:99
  11. I4=I4+sub5p1(x(i))+sub5p1(x(i+1))
  12. end
  13. I4=I4/2/100
  14. %3.1416,3, 3.1333,3.1102