Wrong start of the curve in double integral

1 回表示 (過去 30 日間)
Hexe
Hexe 2023 年 1 月 29 日
コメント済み: Hexe 2023 年 1 月 29 日
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 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by