【发布时间】:2013-10-29 17:20:13
【问题描述】:
我正在尝试在 matlab 中评估以下积分:http://i.imgur.com/Iuc4VT5.png
这是我的代码:
alpha = 2;
F1 = @(u,v) 2*u.*v.*exp(-u.^2)./(1+2*z.*u.*v);
F2 = @(v) v;
F3 = @(z) exp(-z)./sqrt(z);
I1 = dblquad(F1,0,1e5,2,1e5);
I2 = quad(F2,2,1e5);
quad(F3*exp(-(I2-I1)),0,1e5);
我收到如下所示的错误。这些错误并没有显示太多,但我猜这是因为我写F1 的方式。我将F1 定义为u 和v 的函数,用于双积分,但还有一个变量z,它是外积分的变量。我这样做是因为我无法将z 与内部积分分开。有没有更好的方法来编写这个集成?
Error in ==> @(u,v)2*u.*v.*exp(-u.^2)./(1+2*z.*u.*v)
Error in ==> dblquad>innerintegral at 73
fcl = intfcn(xmin, y(1), varargin{:}); %evaluate only to get the class below
Error in ==> quad at 76
y = f(x, varargin{:});
Error in ==> dblquad at 53
Q = quadf(@innerintegral, ymin, ymax, tol, trace, intfcn, ...
我选择1e5 来代表无穷大。
【问题讨论】:
-
你是在告诉我们错误是在哪里引发的,而不是错误信息是什么。
-
@DanielR 这些是我在 Matlab 中看到的所有错误消息。
-
好吧,在我的系统上运行它肯定还有另一条消息:
Undefined function or variable 'z'. -
@A.Donda 我没有收到那个错误,我正在运行旧版本的 Matlab。但这可能是错误,我相信我定义
F1的方式不正确,但我不知道有任何其他方式。有什么建议吗? -
@A.Donda 谢谢。我看看能不能从 math.stackexchange.com 得到任何帮助
标签: matlab integration