Stepsize in integral2 or quad2d
Show older comments
I would like to solve the double integral:
for i=1:length(z)
fz= @(P,Q) sin(P).*(sqrt(1+z(i).*cos(Q).*(sin(2*P)+z(i).*cos(Q).*sin(P).^2))).^(n-1)
Integral(i)=quad2d(fz,0,pi,0,pi/2)
end
where P & Q are the integral variables and z is a parameter that is given as a vector. If I run z in a loop going e.g. from 0 to 10 this integral is calculated relatively fast. However, in the original program z is not run in a pre-defined loop as the one above and it is first calculated in an fsolve routine and then fed into this integral calculator, and because of the nature of the fsolve it is unknown from the beginning how many times this integral has to be caculted. Usually when I run the program, for some reason it looks like it stalls at the point where this double integral has to be claculated. I followed some advice in this forum and changed from integral2 to quad2d but the problem persists althought the calculation becomes a bit faster.
Here my question: how can I determine the stepsize in either integral2 or quad2d? I could not find anything in the documentation. The current (probably automatically selected) number of steps is 150.
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differentiation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!