Essentially what I'd like to do is
fun=@(x,y) x.*y
integral2(fun,-5,5,-5,5)
However, I want to ignore portions of my integration range where x*y is negative. Basically, adjust my bounds of integration such that x*y is guaranteed to be greater than zero for the entire range. For the x*y example I gave, its easy to solve for the appropriate bounds, but I'm actually working with a more complicated function where it's not so obvious.
My actual code is below. I want to select bounds on integration such that "de" is always positive. Any ideas? Thanks!
tau=@(r) (tauMax+ r.*(tauMin-tauMax)/(radius));
d= @(r) (height^2+r.^2).^(.5);
cosTheta= @(r) height./ d(r);
cosXi= @(r,psi) -r.*cos(psi)*2^.5/2+height*2^.5/2;
de= @(r,psi) (Esun*tau(r)/pi).*cosTheta(r).*cosXi(r,psi)./(d(r)).^2;
integral2(de,0,275,0,360)