指数内积分积分内积分
Integral within exponential within integral
我正在尝试对几个不同的表达式进行数值积分,但它们都有一个指数内的积分,被另一个积分包围,即
我似乎无法使用以下代码解决此问题:
syms s p t
W = 3.18*10^(-22);
b = 10^(-23);
X = 300;
L = 0.374;
intlim = 0.589;
myfuncirc = @(s,p,t) (-W).*sqrt((L.^2)-(s.^2)).*(((-p.*cos(t))+sqrt(1-((p.^2).*((sin(t)).^2)))-sqrt(L.^2-s.^2)).^(-2));
s_min = 0;
s_max = L;
t_min = 0;
t_max = pi;
integral(@(p)(p.*exp(-(integral2(@(s,t) myfuncirc(s,t,p),s_min,s_max,t_min,t_max))/(b.*X))),0,intlim,'Arrayvalued',true)
我收到如下所示的错误消息,但我需要一个介于 0 和 1 之间的数字:
Warning: Infinite or Not-a-Number value encountered.
In funfun\private\integralCalc>iterateArrayValued at 267
In funfun\private\integralCalc>vadapt at 130
In funfun\private\integralCalc at 75
In integral at 88
我也在尝试以下形式的类似集成,但也没有得到预期的答案:
pmax = y;
pmin = 0;
ymax = 1;
ymin = @(x) x;
xmax = 1;
xmin = 0;
integral3(@(x,y,p) (exp(-(integral(@(s)myfun(s,p),0,lam,'ArrayValued',true)./(k.*T)))),xmin,xmax,ymin,ymax,pmin,pmax,'Method','iterated')
Warning: Infinite or Not-a-Number value encountered. > In funfun\private\integralCalc>iterateScalarValued at 349 In funfun\private\integralCalc>vadapt at 132 In funfun\private\integralCalc at 75 In funfun\private\integral2Calc>@(xi,y1i,y2i)integralCalc(@(y)fun(xiones(size(y)),y),y1i,y2i,opstruct.integralOptions) at 17 In funfun\private\integral2Calc>@(x)arrayfun(@(xi,y1i,y2i)integralCalc(@(y)fun(xiones(size(y)),y),y1i,y2i,opstruct.integralOptions),x,ymin(x),ymax(x)) at 17 In funfun\private\integralCalc>iterateScalarValued at 314 In funfun\private\integralCalc>vadapt at 132 In funfun\private\integralCalc at 75 In funfun\private\integral2Calc>integral2i at 20 In funfun\private\integral2Calc at 7 In integral3>innerintegral at 137 In funfun\private\integralCalc>iterateScalarValued at 314 In funfun\private\integralCalc>vadapt at 132 In funfun\private\integralCalc at 75 In integral3 at 121 Warning: The integration was unsuccessful. > In integral3 at 125
问题1是你定义的
myfuncirc = @(s,p,t) ...
但是当它被调用时它被称为
myfuncirc(s,t,p)
参数的顺序不同。您应该将 myfuncirc 的定义更改为
myfuncirc = @(s, t, p) ...
第二个更难判断,因为您发布的内容没有给出您打印的结果,它会出错 - 有几个值未定义,例如 myfun 和 k。但是,我 认为 问题是 pmax 没有被定义为函数句柄,而是被定义为一个值——在 pmax 被赋值时 y 中的任何值。我怀疑你想要
pmax = @(x,y) y;
我正在尝试对几个不同的表达式进行数值积分,但它们都有一个指数内的积分,被另一个积分包围,即
我似乎无法使用以下代码解决此问题:
syms s p t
W = 3.18*10^(-22);
b = 10^(-23);
X = 300;
L = 0.374;
intlim = 0.589;
myfuncirc = @(s,p,t) (-W).*sqrt((L.^2)-(s.^2)).*(((-p.*cos(t))+sqrt(1-((p.^2).*((sin(t)).^2)))-sqrt(L.^2-s.^2)).^(-2));
s_min = 0;
s_max = L;
t_min = 0;
t_max = pi;
integral(@(p)(p.*exp(-(integral2(@(s,t) myfuncirc(s,t,p),s_min,s_max,t_min,t_max))/(b.*X))),0,intlim,'Arrayvalued',true)
我收到如下所示的错误消息,但我需要一个介于 0 和 1 之间的数字:
Warning: Infinite or Not-a-Number value encountered. In funfun\private\integralCalc>iterateArrayValued at 267 In funfun\private\integralCalc>vadapt at 130 In funfun\private\integralCalc at 75 In integral at 88
我也在尝试以下形式的类似集成,但也没有得到预期的答案:
pmax = y;
pmin = 0;
ymax = 1;
ymin = @(x) x;
xmax = 1;
xmin = 0;
integral3(@(x,y,p) (exp(-(integral(@(s)myfun(s,p),0,lam,'ArrayValued',true)./(k.*T)))),xmin,xmax,ymin,ymax,pmin,pmax,'Method','iterated')
Warning: Infinite or Not-a-Number value encountered. > In funfun\private\integralCalc>iterateScalarValued at 349 In funfun\private\integralCalc>vadapt at 132 In funfun\private\integralCalc at 75 In funfun\private\integral2Calc>@(xi,y1i,y2i)integralCalc(@(y)fun(xiones(size(y)),y),y1i,y2i,opstruct.integralOptions) at 17 In funfun\private\integral2Calc>@(x)arrayfun(@(xi,y1i,y2i)integralCalc(@(y)fun(xiones(size(y)),y),y1i,y2i,opstruct.integralOptions),x,ymin(x),ymax(x)) at 17 In funfun\private\integralCalc>iterateScalarValued at 314 In funfun\private\integralCalc>vadapt at 132 In funfun\private\integralCalc at 75 In funfun\private\integral2Calc>integral2i at 20 In funfun\private\integral2Calc at 7 In integral3>innerintegral at 137 In funfun\private\integralCalc>iterateScalarValued at 314 In funfun\private\integralCalc>vadapt at 132 In funfun\private\integralCalc at 75 In integral3 at 121 Warning: The integration was unsuccessful. > In integral3 at 125
问题1是你定义的
myfuncirc = @(s,p,t) ...
但是当它被调用时它被称为
myfuncirc(s,t,p)
参数的顺序不同。您应该将 myfuncirc 的定义更改为
myfuncirc = @(s, t, p) ...
第二个更难判断,因为您发布的内容没有给出您打印的结果,它会出错 - 有几个值未定义,例如 myfun 和 k。但是,我 认为 问题是 pmax 没有被定义为函数句柄,而是被定义为一个值——在 pmax 被赋值时 y 中的任何值。我怀疑你想要
pmax = @(x,y) y;