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{:});-------------------------------------------------------------------
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)