MATLAB中求积分问题
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/11 20:06:57
MATLAB中求积分问题
clear
>> integrnd=@(x,y)0.2139*besselj(0,0.481*x)*cos(0.1465*y)*1.602*10^-9*y*0.2376*besselj(1,0.7710*x)*sin(0.2931*y);
>> xmin=-5;
>> xmax=5;
>> ymin=-10;
>> ymax=10;
>> result=dblquad(integrnd,xmin,xmax,ymin,ymax);
Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> quad at 62
y = f(x,varargin{:});
Error in ==> dblquad>innerintegral at 88
Q(i) = feval(quadf,intfcn,xmin,xmax,tol,trace,y(i),varargin{:});
Error in ==> quad at 62
y = f(x,varargin{:});
Error in ==> dblquad at 64
Q = feval(quadf,@innerintegral,ymin,ymax,tol,trace,intfcn,...
clear
>> integrnd=@(x,y)0.2139*besselj(0,0.481*x)*cos(0.1465*y)*1.602*10^-9*y*0.2376*besselj(1,0.7710*x)*sin(0.2931*y);
>> xmin=-5;
>> xmax=5;
>> ymin=-10;
>> ymax=10;
>> result=dblquad(integrnd,xmin,xmax,ymin,ymax);
Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> quad at 62
y = f(x,varargin{:});
Error in ==> dblquad>innerintegral at 88
Q(i) = feval(quadf,intfcn,xmin,xmax,tol,trace,y(i),varargin{:});
Error in ==> quad at 62
y = f(x,varargin{:});
Error in ==> dblquad at 64
Q = feval(quadf,@innerintegral,ymin,ymax,tol,trace,intfcn,...
将命令改成这样,就可以了.
integrnd=@(x,y)0.2139*besselj(0,0.481.*x).*cos(0.1465.*y)*1.602*10^-9*y*0.2376.*besselj(1,0.7710.*x).*sin(0.2931.*y);
result=dblquad(integrnd,-5,5,-10,10)
result =
1.0608e-025 +4.9360e-025i
再问: 为什么0.2376后有点乘?
再答: 因为运算时,软件是按数组的形式参与计算的。
integrnd=@(x,y)0.2139*besselj(0,0.481.*x).*cos(0.1465.*y)*1.602*10^-9*y*0.2376.*besselj(1,0.7710.*x).*sin(0.2931.*y);
result=dblquad(integrnd,-5,5,-10,10)
result =
1.0608e-025 +4.9360e-025i
再问: 为什么0.2376后有点乘?
再答: 因为运算时,软件是按数组的形式参与计算的。