How to calculate double integral?
3 次查看(过去 30 天)
显示 更早的评论
Hi! I have a problem with solution of double integral. The syms solves too long and it cannot be used.But in another way I have problem.
I have an integral fun2 on z and it has x which is a variable in the integral fun0. How can I set a variable x to first calculate the integral f2 over z, and then integral f3 over x? (Of course, when I set x=some number I obtain a curve or a set of curves if x=0:0.1:1 and make for j = 1:length(x), but I doubt about this result, because the behavior of curves is not correct).
clear all, close all
n=1;
t=1;
r=1;
s=0:0.2:10;
for i = 1:length(s)
k=s(i);
fun2=@(z)(z.*exp(2.*n.*t.*z.^2).*(besselj(0,(k.*z.*x)))./sqrt(1-z.^2));
f2(i,:)=integral(fun2,0,1);
fun0=@(x)(((((x.^2.*exp(-2.*t.*x.^2)./(x.^2+1/(r.^2)).^2)))).*f2(i));
f3(i,:)=integral(fun0,0,inf);
end
Cor=8/(r*(pi)^(3/2))*sqrt(2*n*t)*exp(-2*n*t)/(erf(sqrt(2*n*t))*((1+4*t/r^2)*exp(2*t/r^2)*erfc(sqrt(2*t/r^2))-2*sqrt(2*t)/(r*sqrt(pi)))).*f3;
plot(s,Cor,'b-');
0 个评论
采纳的回答
Torsten
2022-12-16
编辑:Torsten
2022-12-16
n = 1 ;
t = 1;
r = 1;
s = 0:0.2:10;
fun = @(x,z,k) x.^2.*exp(-2.*t.*x.^2)./(x.^2+1/r^2).^2 .* z.*exp(2*n*t.*z.^2).*besselj(0,k.*z.*x)./sqrt(1-z.^2);
f3 = arrayfun(@(k)integral2(@(x,z)fun(x,z,k),0,Inf,0,1),s)
Cor = 8/(r*(pi)^(3/2))*sqrt(2*n*t)*exp(-2*n*t)/(erf(sqrt(2*n*t))*((1+4*t/r^2)*exp(2*t/r^2)*erfc(sqrt(2*t/r^2))-2*sqrt(2*t)/(r*sqrt(pi))))*f3
plot(s,Cor,'b-')
grid on
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Thermodynamics & Statistical Physics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!