📄 simpsonc.m
字号:
function [Isic]=simpsonc(a,b,M,f,varargin)%SIMPSONC Composite Simpson numerical integration.% ISIC = SIMPSONC(A,B,M,FUN) computes an approximation of the integral % of the function FUN via the Simpson method (with M equispaced intervals).% FUN accepts real scalar input x and returns a real scalar% value. FUN can also be an inline object.H=(b-a)/M;x=linspace(a,b,M+1);fpm=feval(f,x,varargin{:});fpm(2:end-1) = 2*fpm(2:end-1);Isic=H*sum(fpm)/6;x=linspace(a+H/2,b-H/2,M);fpm=feval(f,x,varargin{:});Isic = Isic+2*H*sum(fpm)/3; return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -