Gamma函数相关matlab代码

1、Gamma函数:

Gamma函数matlab代码:

x=0:0.5:5
syms t y=int(t.^(x-1)*exp(-t),0,inf) y=double(y) plot(x,y,'r-o','linewidth',1)

图像如下:

 

2、lgΓ(x)函数

matlab代码:

x=0:0.1:5
syms t y=int(t.^(x-1)*exp(-t),0,inf) y=log10(double(y)) plot(x,y,'r-o','linewidth',1)

图形:

 

Gamma分布:

matlab代码:

a=1,b=0.5
syms c
d=int(c^(a-1)*exp(-c),0,inf)
t=0:0.1:20
g=b.^a*(t.^(a-1)).*exp(-b*t)/d
g=double(g)
plot(t,g,'r-.','linewidth',1)

图形:

matlab代码:

t=0:0.1:20
syms c

a=1,b=0.5
d=int(c^(a-1)*exp(-c),0,inf)
g=b.^a*(t.^(a-1)).*exp(-b*t)/d
g=double(g)
plot(t,g,'r-.','linewidth',1)
hold on;
a=2,b=0.5
d=int(c^(a-1)*exp(-c),0,inf)
g=b.^a*(t.^(a-1)).*exp(-b*t)/d
g=double(g)
plot(t,g,'g-.','linewidth',1)
hold on
a=3,b=0.5
d=int(c^(a-1)*exp(-c),0,inf)
g=b.^a*(t.^(a-1)).*exp(-b*t)/d
g=double(g)
plot(t,g,'b-.','linewidth',1)
hold on
a=5,b=1
d=int(c^(a-1)*exp(-c),0,inf)
g=b.^a*(t.^(a-1)).*exp(-b*t)/d
g=double(g)
plot(t,g,'c-.','linewidth',1)
hold on
a=9,b=2
d=int(c^(a-1)*exp(-c),0,inf)
g=b.^a*(t.^(a-1)).*exp(-b*t)/d
g=double(g)
plot(t,g,'m-.','linewidth',1)
hold on;
legend('a=1,b=0.5','a=2,b=0.5','a=3,b=0.5','a=5,b=1','a=9,b=2');

图形:

posted @ 2015-02-11 10:40  疯狂的拖鞋  阅读(5723)  评论(0编辑  收藏  举报