Results 1 to 3 of 3

Math Help - Trying to script the General Beta 2 CDF in MATLAB

  1. #1
    Member
    Joined
    Sep 2009
    Posts
    242
    Thanks
    1

    Trying to script the General Beta 2 CDF in MATLAB

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


    \frac{\left(\frac{(x/b)^a}{1+(x/b)^a}\right)^p}{pB(p,q)} \; _1\texttrm{F_2}\begin{bmatrix}p,1-q; & \frac{(x/b)^a}{1+(x/b)^a} \\ p+1 & \end{bmatrix}

    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
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4

    Re: Trying to script the General Beta 2 CDF in MATLAB

    Quote Originally Posted by rainer View Post
    I'm having trouble scripting a function in MATLAB. The function is the General Beta of the Second Kind Cumulative Distribution Function:


    \frac{\left(\frac{(x/b)^a}{1+(x/b)^a}\right)^p}{pB(p,q)} \; _1\texttrm{F_2}\begin{bmatrix}p,1-q; & \frac{(x/b)^a}{1+(x/b)^a} \\ p+1 & \end{bmatrix}

    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
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member
    Joined
    Sep 2009
    Posts
    242
    Thanks
    1

    Re: Trying to script the General Beta 2 CDF in MATLAB

    I like your style CB. You're like the Zorro of math.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. matlab Script for Finite Difference method
    Posted in the Math Software Forum
    Replies: 1
    Last Post: September 1st 2011, 11:24 PM
  2. is there a way to kill a script in matlab?
    Posted in the Math Software Forum
    Replies: 3
    Last Post: August 6th 2010, 05:21 AM
  3. Help with Matlab Script
    Posted in the Math Software Forum
    Replies: 1
    Last Post: April 25th 2010, 09:25 PM
  4. Matlab help can't write script
    Posted in the Math Software Forum
    Replies: 2
    Last Post: January 28th 2010, 06:00 AM
  5. MATLAB and using the script for RK4 method
    Posted in the Math Software Forum
    Replies: 1
    Last Post: April 8th 2009, 04:33 AM

Search Tags


/mathhelpforum @mathhelpforum