Why won't this function to generate a beta binomial distribution work?

3 views (last 30 days)
I am new to function writing and don't understand the error message I am getting when I try to run this function
function y=bbinopdf(x,n,a,b)
y= beta(x+a,n-x+b)/beta(a,b)
end
Define values as
x=[1:1:100];
a=1;
b=1;
n=10;
I can enter bbinopdf(x,n,a,b) with no error but then there is no output. If I use y=bbinopdf(x,n,a,b) I get
Error in bbinopdf (line 1)
function y=bbinopdf(x,n,a,b)
Output argument "y" (and maybe others) not assigned during
call to
"/Users/awetten/Documents/MATLAB/bbinopdf.m>bbinopdf".
Can anyone help- please?

Answers (0)

Categories

Find more on Special Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!