newtcotes.m
来自「Integraton routines in matlab」· M 代码 · 共 28 行
M
28 行
%% newtcotes.m %% Compute the weights of the Newton-Cotes quadrature quadrature% on [0,1] with equidistant nodes.%%n = input(' Number n+1 of quadrature nodes n = ');% nodes h = 1/n;x = (0:h:1)';% the transpose of the system matrix A = ones(n+1,n+1);for i = 1:n A(:,i+1) = A(:,i).*x;end% right hand sided = 1./(1:n+1)';% Newton-Cotes quadrature weightsw = A'\d;disp(' Newton-Cotes quadrature weights ')disp(w')
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?