zoukankan      html  css  js  c++  java
  • Matlab 概率分布

    Poisson分布
    概率密度函数 poisspdf(x,lamda)
    分布函数poisscdf(X,lamda)
    逆概率分布函数poissinv(F,lamda)

    x=[0:15]';
    y1=[];
    y2=[];
    lam1=[1,2,5,10];
    for i=1:length(lam1)
        y1=[y1,poisspdf(x,lam1(i))];
        y2=[y2,poisscdf(x,lam1(i))];
    end
    plot(x,y1), figure; plot(x,y2)

    正态分布
    y=normpdf(x,mu,row)
    F=normcdf(x,mu,row)
    x=norminv(F,mu,row)

    x=[-5:.02:5]';
    y1=[]; y2=[];
    mu1=[-1,0,0,0,1];
    sig1=[1,0.1,1,10,1];
    sig1=sqrt(sig1);
    for i=1:length(mu1)
       y1=[y1,normpdf(x,mu1(i),sig1(i))];
       y2=[y2,normcdf(x,mu1(i),sig1(i))];
    end
    plot(x,y1);
    figure;
    plot(x,y2)

    gamma 分布
    y=gampdf(x,a,lamda)
    F=gamcdf(x,a,lamda)
    x=gaminv(F,a,lamda)

    x^2 分布
    y=chi2pdf(x,k)
    F=chi2cdf(x,k)
    x=chi2inv(F,k)

    T分布
    y=tpdf(x,k)
    F=tcdf(x,k)
    x=tinv(F,k)

    Rayleigh分布
    y=raylpdf(x,b)
    F=raylcdf(x,b)
    x=raylinv(x,b)

    F分布
    y=fpdf(x,a,b)
    F=fcdf(x,a,b)
    x=finv(F,a,b)

    随机数发生器 rand randn函数
    此类函数均为随机数发生器,每次调用时将返回不同的随机数组。实际上这些表面上看来是随机的数是通过确定的数学算法生成的,所以rand这类函数又称为伪随机数生成器(pseudorandom number generators)。
    x= rand(n,m)        产生(n×m)维的[0,1]区间均匀分布随机数组
    正态分布随机数:满足标准正态分布随机数N(0,1)可由randn( )函数得出,其调用格式与rand( )完全一致。

    其它随机数发生器:
    A=gamrnd(a,lamda,n,m) %生成n*m的gamma分布伪随机数矩阵    
    B=chi2rnd(k,n,m)                x^2分布
    C=trna(k,n,m)                    T分布
    D=frnd(p,q,n,m)                  F分布
    E=raylrnd(b,n,m)                 rayleigh 分布

    求向量各个元素的均值、方差和标准差:
    m=mean(x),s2=var(x),s=std(x)

    p=normrnd(0.5,1.5,30000,1);
    [mean(p), var(p), std(p)]

    gamma 分布的均值
    syms x;
    syms a lam positive
    %p为gamma分布
    p=lam^a*x^(a-1)/gamma(a)*exp(-lam*x);
    m=int(x*p,x,0,inf)
    s=simple(int((x-1/lam*a)^2*p,x,0,inf))

    from: http://hi.baidu.com/puda2007/blog/item/85c8308deadf2115b21bba1f.html

  • 相关阅读:
    vue 中 vue-router、transition、keep-alive 怎么结合使用?
    vue 对列表数组删除和增加
    eclipse如何快速查找某个类
    在 eclipse 中设置每行的字数
    如何查看某个端口被谁占用
    sql只修改第一二行数据
    android真机自动化测试
    appium自动化测试中获取toast消息的解决方法【转】
    eclipse下python的selenium自动化环境的搭建
    Xpath用法官方手册
  • 原文地址:https://www.cnblogs.com/emanlee/p/2083049.html
Copyright © 2011-2022 走看看