demoxcosx.m

来自「这是《Numerical Methods with MATLAB: Imple」· M 代码 · 共 13 行

M
13
字号
function s = demoXcosx(n)
% demoXcosx  Use an inline function object with the fsum function
%
% Synopsis:  s = demoXcosx
%
% Input:     n = number of points at which x*cos(x) is evaluated
%                in the interval 0 <= x <= 2*pi
%
% Output:    s = sum of x*cos(x) at n points

xcosx = inline('x.*cos(x)');
s = fsum(xcosx,0,3*pi,n);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?