No plot in double integral

3 Ansichten (letzte 30 Tage)
Hexe
Hexe am 29 Jan. 2023
Kommentiert: Hexe am 30 Jan. 2023
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 Kommentare
Walter Roberson
Walter Roberson am 29 Jan. 2023
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 am 30 Jan. 2023
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by