No plot in double integral

3 次查看(过去 30 天)
Hexe
Hexe 2023-1-29
评论: Hexe 2023-1-30
Hi! I try to solve the double integral, but there is an empty plot. Could you please tell me, what is wrong? In MathCad this integral is solved well.
n=1;
t=1;
r=1;
s=0:0.1:5;
fun = @(x,z,k) (x.*exp(2*n*t.*x.^2)./sqrt(1-x.^2)).*(exp(-2*t.*z.^2).*besselj(0,z.*k.*x).*(1+(sqrt(-pi)./(z*r)).*(1+((z*r).^2)/2).*(erfi(z*r/2)).*(exp(-((z*r).^2)/4))));
f3 = arrayfun(@(k)integral2(@(x,z)fun(x,z,k),0,Inf,0,1),s)
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
f3 = 1×51
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
Cor = ((-2*r*sqrt(2*n*t)*exp(-2*n*t))/(pi*erf(sqrt(2*n*t))*(atan(r/(2*sqrt(2*t)))-sqrt(2*t)/(2*r*(1/4+2*t/(r^2))))))*f3;
plot(s,Cor,'g-');
  6 个评论
Walter Roberson
Walter Roberson 2023-1-29
I did not notice that. I wonder what it would look like if you used sqrt(pi) instead?
n=1;
t=1;
r=1;
syms x z k s real
Pi = sym(pi);
fun = (x.*exp(2*n*t.*x.^2)./sqrt(1-x.^2)).*(exp(-2*t.*z.^2).*besselj(0,z.*k.*x).*(1+(sqrt(Pi)./(z*r)).*(1+((z*r).^2)/2).*(erfi(z*r/2)).*(exp(-((z*r).^2)/4))));
f3 = subs(int(int(fun,x,0,inf), z, 0, 1), k, s)
f3 = 
fun_zhalf = limit(subs(fun, k, 1), z, 1/2)
fun_zhalf = 
xlimited = limit(fun_zhalf, x, 1)
xlimited = 
case_to_plot = children(children(xlimited, 3),1)
case_to_plot = 
fplot(case_to_plot, [0 2])
xlimited = limit(fun_zhalf, x, 2)
xlimited = 
vpa(xlimited)
ans = 
You get rid of the real-valued portion of the function (at least at some values), but the complex portion remains.
Hexe
Hexe 2023-1-30
Dear all, thank you for your replies. Yes, there is an imaginary part where sqrt(pi). And you are right, the integration is from 0 to 1 for x and 0-Inf for z. The math form is attached.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by