solving a triple sigma equation (or triple integral)
2 views (last 30 days)
Show older comments
above equation is what i want to express by mathlab code
for definite the A(x,y,z)
A(x,y,z) : random size 3-D vector 00x00x00 (but example is 6x61x17)
below is my try, but i think that is not correct
it is hard to make code... please somebody help me
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clear
% for A = 6 x 61 x 17 (3-d vector)
A = ones(6,61,17);
k = linspace(10.4, 31.4, 6);
pii = linspace(0, pi, 61); % pii = 𝝓
E = linspace(-2, 2, 17);
for x = 1:6
for y = 1:61
for z = 17
for f = 1:6
for p = 1:61
for e = 1:17
A(x,y,z) = A(x,y,z) + (k(f)).^2 * (1/(norm([x y z]-[cos(pii(p)) sin(pii(p)) E(e)]))) * (1-cos(pii(p))-sin(pii(p))) * exp(1i*k(f)*(((norm([x y z]-[cos(pii(p)) sin(pii(p)) E(e)])))-1));
end
end
end
end
end
end
5 Comments
Torsten
on 15 Jul 2022
When you approximate an integral by a sum, there must appear terms of the form
(k(i+1)-k(i))*(phi(j+1)-phi(j))*(E(n+1)-E(n))
for the volume element in which you evaluate the function.
I don't see this volume element in your finite sum.
Accepted Answer
Chunru
on 15 Jul 2022
% for A = 6 x 61 x 17 (3-d array)
A = ones(6,61,17);
k = linspace(10.4, 31.4, 6);
pii = linspace(0, pi, 61); % pii = 𝝓
E = linspace(-2, 2, 17);
% reshape to 3d array
k3d = reshape(k, 6, 1, 1); % along 1st dimension
p3d = reshape(pii, 1, 61, 1); % along 2nd dimension
e3d = reshape(E, 1, 1, 17); % along 3rd dimension
for x = 1:6
for y = 1:61
for z = 1:17
R = sqrt((x-cos(p3d)).^2 +(y-sin(p3d)).^2 + (z-e3d).^2);
tmp = k3d.^2 ./ R .* (1-x*cos(p3d)-y*sin(p3d)) .* exp(1i * k3d .*(R-1));
A(x,y,z) = sum(tmp, 'all');
end
end
end
imagesc(20*log10(abs(A(:, :, 8)))); % slice for z=8
More Answers (0)
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!