How to calculate and plot ndefinite triple integral?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Torsten
le 12 Avr 2023
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)))))
Réponse acceptée
Torsten
le 12 Avr 2023
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 commentaires
Torsten
le 19 Avr 2023
Modifié(e) : Torsten
le 19 Avr 2023
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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Graphics Performance dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!