Matlab问题!用辛普森公式求数值积分..f=@(x)2/(1+x.^2);I=quad(f,-1,1)出错:Error using ==> mrdivideMatrix dimensions must agree.Error in ==> quad at 62y = f(x,varargin{:});-------------------------------------------------------------------

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 09:51:03
Matlab问题!用辛普森公式求数值积分..f=@(x)2/(1+x.^2);I=quad(f,-1,1)出错:Error using ==> mrdivideMatrix dimensions must agree.Error in ==> quad at 62y = f(x,varargin{:});-------------------------------------------------------------------
x)M,ILz9}E3OYbg3=[i뚧{mlz6uӆ=ϗѦfQia]gii[Xkc})3\J3lmrR22SReV(dg+($A4eu UH,Q03TUHӨ)K,J,J̫մ֥$}&0X@h\;H*p XkeB޶˚͛lzhh<ݰɎ'{fABBv6#>A*(<0yNl)J 1#O

Matlab问题!用辛普森公式求数值积分..f=@(x)2/(1+x.^2);I=quad(f,-1,1)出错:Error using ==> mrdivideMatrix dimensions must agree.Error in ==> quad at 62y = f(x,varargin{:});-------------------------------------------------------------------
Matlab问题!用辛普森公式求数值积分..
f=@(x)2/(1+x.^2);
I=quad(f,-1,1)
出错:Error using ==> mrdivide
Matrix dimensions must agree.
Error in ==> quad at 62
y = f(x,varargin{:});
---------------------------------------------------------------------------------------------
但如果是f=@(x)2*(1+x.^2)的话,就不会出错...

Matlab问题!用辛普森公式求数值积分..f=@(x)2/(1+x.^2);I=quad(f,-1,1)出错:Error using ==> mrdivideMatrix dimensions must agree.Error in ==> quad at 62y = f(x,varargin{:});-------------------------------------------------------------------
f=@(x)2./(1+x.^2); % 少点
I=quad(f,-1,1)