How to calculate and plot ndefinite triple integral?
조회 수: 5 (최근 30일)
이전 댓글 표시
I have a triple indefinite integral (image attached).
Here respectively sx = sy = s*sin(a)/sqrt(2) and sz= s*cos(a). Parameter s=0.1 and parameter a changes from 0 to pi/2 – 10 points can be chosen [0 10 20 30 40 50 60 70 80 90]. Is it possible to solve such integral and to obtain the curve – plot(a,F)?
s=0.1;
a = 0:10:90;
fun = @(x,y,z) ((x.*z)./((x.^2+y.^2+z.^2))).*((2*pi)^(3/2))*exp(-(0.5.*sqrt(x.^2+y.^2+z.^2))).*exp(1i.*x*(s*sin(p)/sqrt(2))-2*((x.^2+y.^2+z.^2)+((z.^2)./((x.^2+y.^2+z.^2))))).*exp(1i.*y*(s*sin(p)/sqrt(2))-2*((x.^2+y.^2+z.^2)+((z.^2)./((x.^2+y.^2+z.^2))))).*exp(1i.*z*(s*cos(p))-2*((x.^2+y.^2+z.^2)+((z.^2)./((x.^2+y.^2+z.^2)))));
f3 = arrayfun(@(p)integral3(@(x,y,z)fun(x,y,z,p)),a);
plot(a,f3);
댓글 수: 3
Torsten
2023년 4월 12일
I forgot about the coefficient (2*pi)^(3/2) before exponent, but it does not matter much.
There are many more differences.
In your formula:
exp(-0.5.*(x.^2+y.^2+z.^2))
In your code:
exp(-(0.5.*sqrt(x.^2+y.^2+z.^2)))
In your formula:
exp(1i.*x*(s*sin(p)/sqrt(2))+1i.*y*(s*sin(p)/sqrt(2))+1i*z.*(s*cos(p))-2*(x.^2+y.^2+z.^2+z.^2./(x.^2+y.^2+z.^2)))
In your code:
exp(1i.*x*(s*sin(p)/sqrt(2))-2*((x.^2+y.^2+z.^2)+((z.^2)./((x.^2+y.^2+z.^2))))).*exp(1i.*y*(s*sin(p)/sqrt(2))-2*((x.^2+y.^2+z.^2)+((z.^2)./((x.^2+y.^2+z.^2))))).*exp(1i.*z*(s*cos(p))-2*((x.^2+y.^2+z.^2)+((z.^2)./((x.^2+y.^2+z.^2)))))
채택된 답변
Torsten
2023년 4월 12일
s = 0.1;
a = 0:5:360;
a = a*pi/180;
fun = @(x,y,z,p) x.*z./(x.^2+y.^2+z.^2).*exp(-0.5*(x.^2+y.^2+z.^2)).*exp(1i*x*(s*sin(p)/sqrt(2))+1i*y*(s*sin(p)/sqrt(2))+1i*z*(s*cos(p))-2*(x.^2+y.^2+z.^2+z.^2./(x.^2+y.^2+z.^2)));
f3 = (2*pi)^1.5*arrayfun(@(p)integral3(@(x,y,z)fun(x,y,z,p),0,Inf,0,2*pi,0,pi),a);
figure(1)
plot(a,real(f3))
figure(2)
plot(a,imag(f3))
댓글 수: 8
Torsten
2023년 4월 19일
편집: Torsten
2023년 4월 19일
Why do you replace s by k and not by m in your code ?
And if you loop over the elements of a, why do you use the arrayfun ? Arrayfun computes the values for f3 for the complete vector a over and over again. I can understand that your code takes a while to finish.
Since the results for f3 are complex-valued, you can only apply surf on abs(f3) or imag(f3) or real(f3), but not f3 itself.
n = 1;
t = 1;
r = 1;
S = 1:0.5:5;
P = 0:10:180;
P = P*pi/180;
for i = 1:numel(S)
s = S(i);
for j = 1:numel(P)
p = P(j);
fun = @(x,y,z) x.*z./(x.^2+y.^2+z.^2).*exp(-0.5*(x.^2+y.^2+z.^2)).*exp(1i*x*(s*sin(p)/sqrt(2))+1i*y*(s*sin(p)/sqrt(2))+1i*z* (s*cos(p))-2*(x.^2+y.^2+z.^2+z.^2./(x.^2+y.^2+z.^2)));
f3(i,j) = (2*pi)^1.5*integral3(fun,0,Inf,0,2*pi,0,pi);
end
end
f3
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!