function r=betaplot(xmin,xmax,a,b,col) %betaplot(xmin,xmax,a,b,col) %plots a BETA distribution with parameters a and b > 0, in the interval [xmin,xmax] %col is a text string which indicates the colour of the graph (default col='b') %Copyright gianlucabaio2002 if nargin==4 col='b'; end if xmin<=0 | xmax<=0 |xmin>=1 |xmax>=1 error('il supporto della variabile è [0,1]'); end x=[xmin:.01:xmax]; const1=beta(a,b); for i=1:length(x) y(i)=1/const1*x(i)^(a-1)*(1-x(i))^(b-1); end plot(x,y,col)