Originally Posted by

**rainer** I'm having trouble scripting a function in MATLAB. The function is the General Beta of the Second Kind Cumulative Distribution Function:

It involves the beta function and hypergeometric series as subroutines in the code. p,a,b,q are parameters. x is the independent variable (a 12x1 column vector in my case). The MATLAB script I've written:

term=(((x/b).^a)/(1+(x/b).^a));

F=hypergeom([p,1-q],p+1,term);

CDFGB2= (term.^p/(p*beta(p,q)))*F

The output I get is a 12x12 matrix when I should just get a 12x1 column vector.

If anyone has some insight I'd appreciate it.

Thanks

Code:

term=(((x/b).^a)./(1+(x/b).^a));
F=hypergeom([p,1-q],p+1,term);
CDFGB2= (term.^p/(p*beta(p,q))).*F

CB