Integration of incomplete beta function

This code works: g=integral(@(z)(z.^(2*0.1*0.7-1)).*betainc(0.7./z,0.37,0.4),0.7,0.7*exp(10/0.7),'RelTol',1e-16)
but if I change the upper limit of the integral from 0.7*exp(10/0.7) to 0.7*exp(12/0.7) I get the following error:
Error using betainc X must be in the interval [0,1].
Error in @(z)(z.^(2*0.1*0.7-1)).*betainc(0.7./z,0.37,0.4)
Error in integralCalc/iterateScalarValued (line 323) fx = FUN(t).*w;
Error in integralCalc/vadapt (line 132) [q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75) [q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 88) Q = integralCalc(fun,a,b,opstruct);
for other values like 0.7*exp(30/0.7) i get error as well but not with others as 0.7*exp(100/0.7)
could anyone give some clue why this erratic behaviour of the integral? X should always between [0,1]. Thank you beforehand.

Risposte (1)

Torsten
Torsten il 13 Nov 2014
Check whether the error remains if you replace
betainc(0.7./z,0.37,0.4)
by
betainc(min(1,0.7./z),0.37,0.4)
Best wishes
Torsten.

2 Commenti

I have tried and I get the following error (it seems it chose 1 in min(1,0.7./z)):
Warning: Infinite or Not-a-Number value encountered. In funfun\private\integralCalc>iterateScalarValued at 349 In funfun\private\integralCalc>vadapt at 132 In funfun\private\integralCalc at 75 In integral at 88
g =
Inf
Best wishes Chuse
I'd put the function to integrate in an m-file and check for which values of z this function file is called by "integral".
Best wishes
Torsten.

Accedi per commentare.

Categorie

Richiesto:

il 13 Nov 2014

Commentato:

il 13 Nov 2014

Community Treasure Hunt

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

Start Hunting!

Translated by