Info

This question is closed. Reopen it to edit or answer.

definite 4D integration takes long time/cannot find result

1 view (last 30 days)
I am trying to do integration of a function with 4 variables.
My function is
f(x,y,phi,theta)
and some of the integration limits are function of the outer limits.
The problem is it shows warning and keep calculating.
܀warning: quad2d: Maximum number of sub-tiles reached, accuracy may be low
Is there any mistake in my code?
Or do I need alternative other than
integral3()
?
I also do not understand why I need to use ./ instead of / in this line
f1 = @(x, y, phi, theta) exp(-(h-y)./(lambda *sin(theta) *sin(phi)));
I learned to write the 4d integration from here:
this is my code:
clear all;
clc;
rho_bulk = 2.44; # rho_bulk = 2.44 uOhm.cm
h = 20e-9;
p = 0.5;
lambda = 40e-9;
n = 10;
w = linspace(20e-9,80e-9,n);
for i = 1:n
# limit for theta
p2 = pi;
p1 = 0;
# limit for phi
p4 = @(x,y) atan(x/(h-y)) + (pi/2);
p3 = @(x,y) -atan((h-y)/(w(i)-x));
# limit for y
p6 = h;
p5 = 0;
# limit for x
p8(i) = w(i);
p7 = 0;
# f(x, y, phi, theta); outer --> inner
# limits; inner --> outer
f1 = @(x, y, phi, theta) exp(-(h-y)./(lambda *sin(theta) *sin(phi)));
f3 = @(x, y, phi, theta) sin(theta).*cos(theta).^2 .* f1(x, y, phi, theta);
[q1(i)] = integral( @(x) (integral3( @(y, phi, theta) f3(x, y, phi, theta), p5, p6, @(y) p3(x,y), @(y) p4(x,y), p1, p2)), p7, p8(i), 'ArrayValued',true);
end;

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!