Wrong start of the curve in double integral

1 次查看(过去 30 天)
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-')

采纳的回答

C B
C B 2023-1-29
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 个评论
Hexe
Hexe 2023-1-29
Dear Chetan Bhavsar!
Thank you very much. Now it works as it should.
Sincerely
Olha.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by