均匀分布:
x=0:0.1:10;
f=unifpdf(x,3,7);
F=unifcdf(x,3,7);
plot(x,f,x,F)
legend('概率密度函数','分布函数')
指数分布:
x=-1:0.1:30;
f=exppdf(x,2);
F=expcdf(x,2);
plot(x,f,x,F)
legend('密度函数','分布函数')
P(X>10)=
>> 1-expcdf(10,2)
ans =
0.0067
P(2<X<5)=
>> expcdf(5,2)-expcdf(2,2)
ans =
0.2858
正态分布:
x=-8:0.1:10;
f=normpdf(x,2,2);
F=normcdf(x,2,2);
plot(x,f,x,F)
legend('密度函数','分布函数')
P(X>2)=
>> 1-normcdf(2,2,2)
ans =
0.5000