Wrong start of the curve in double integral

1 visualización (últimos 30 días)
Hexe
Hexe el 29 de En. de 2023
Comentada: Hexe el 29 de En. de 2023
Hi! I solve the double integral and it shows a right behavior of the curve, but it starts from different points at different parameters. But it should always start from the point (0,1). What is wrong?
n = 0.1 ;
t = 1;
r = 1;
s = 0:0.01:1;
b=sqrt(2*t)/r;
fun = @(x,z,k) exp(-2.*n.*t.*x.^2).*exp(-z.^2).*(erf(((z+x.*k./r)./(2.*b)))+erf(((z-x.*k./r)./(2.*b)))-z./(sqrt(pi).*b).*(exp(-((z+x.*k./r)./(2.*b)).^2)+exp(-((z-x.*k./r)./(2.*b)).^2)));
f3 = arrayfun(@(k)integral2(@(x,z)fun(x,z,k),0,Inf,0,1),s);
Cor = ((sqrt(2*n*t))/(erf(sqrt(2*n*t))*(atan(1/(2*b))-(b/(2*(b^2+0.25))))))*f3;
plot(s,Cor,'b-')

Respuesta aceptada

C B
C B el 29 de En. de 2023
n = 0.1 ;
t = 1;
r = 1;
s = 0:0.01:1;
b=sqrt(2*t)/r;
fun = @(x,z,k) exp(-2.*n.*t.*x.^2).*exp(-z.^2).*(erf(((z+x.*k./r)./(2.*b)))+erf(((z-x.*k./r)./(2.*b)))-z./(sqrt(pi).*b).*(exp(-((z+x.*k./r)./(2.*b)).^2)+exp(-((z-x.*k./r)./(2.*b)).^2)));
f3 = arrayfun(@(k)integral2(@(x,z)fun(x,z,k),0,Inf,0,1),s);
Cor = ((sqrt(2*n*t))/(erf(sqrt(2*n*t))*(atan(1/(2*b))-(b/(2*(b^2+0.25))))))*f3;
plot(s,Cor,'b-')
n = 0.1 ;
t = 1;
r = 1;
s = 0:0.01:1;
b=sqrt(2*t)/r;
fun = @(x,z,k) exp(-2.*n.*t.*x.^2).*exp(-z.^2).*(erf(((z+x.*k./r)./(2.*b)))+erf(((z-x.*k./r)./(2.*b)))-z./(sqrt(pi).*b).*(exp(-((z+x.*k./r)./(2.*b)).^2)+exp(-((z-x.*k./r)./(2.*b)).^2)));
f3 = arrayfun(@(k)integral2(@(x,z)fun(x,z,k),0,1,0,1),s);
Cor = ((sqrt(2*n*t))/(erf(sqrt(2*n*t))*(atan(1/(2*b))-(b/(2*(b^2+0.25))))))*f3;
Cor = Cor + (1 - Cor(1));
plot(s,Cor,'b-')
  1 comentario
Hexe
Hexe el 29 de En. de 2023
Dear Chetan Bhavsar!
Thank you very much. Now it works as it should.
Sincerely
Olha.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by