• 大小: 3KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-05-07
  • 语言: Matlab
  • 标签: Gram-Charli  PDF  

资源简介

matlab 用Gram-Charlier级数展开求变量的的概率密度曲线

资源截图

代码片段和文件信息

%计算正态分布随机量的半不变量,通过半不变量求pdf和cdf
clear
clc
close all
%生成随机变量
Y=randn(11440);
figure(1)
hist(Y30)
title(‘正态分布随机变量‘)
%-----------计算1-7阶原点矩alpha--------------------
for i=1:7
    for j=1:size(Y2)
        Yi(:j)=Y(:j).^i;
    end
    alpha(i)=sum(Yi)/size(Y2);%原点矩
end
%------------1-7阶中心矩beta-------------------
m=mean(Y);
% for i=1:7
%     for j=1:size(Y2)
%         Yii(:j)=(Y(:j)-m).^i;
%     end
%     beta(i)=sum(Yii)/size(Y2);
% end 
% me=mean(Y)
% va=var(Y)
%--------------用原点矩alpha求1-7阶半不变量gamma--------------------
gamma(11)=alpha(1);
gamma(12)=alpha(2)-alpha(1).^2;
gamma(13)=alpha(3)-3*alpha(1)*alpha(2)+2*alpha(1).^3;
gamma(14)=alpha(4)-3*alpha(2).^2-4*alpha(1)*alpha(3)+12*alpha(1).^2*alpha(2)-6*alpha(1).^4;
gamma(15)=alpha(5)-5*alpha(4)*alpha(1)-10*alpha(3)*alpha(2)+20*alpha(3)*alpha(1).^2+30*alpha(2).^2*alpha(1)-60*alpha(2)*alpha(1).^3+24*alpha(1).^5;
gamma(16)=alpha(6)-6*alpha(5)*alpha(1)-15*alpha(4)*alpha(2)+30*alpha(4)*alpha(1).^2-10*alpha(3).^2+120*alpha(3)*alpha(2)*alpha(1)-120*alpha(3)*alpha(1).^3+30*alpha(2).^3-270*alpha(2).^2*alpha(1).^2+360*alpha(2)*alpha(1).^4-120*alpha(1).^6;
gamma(17)=alpha(7)-7*alpha(6)*alpha(1)-21*alpha(5)*alpha(2)+42*alpha(5)*alpha(1).^2-35*alpha(4)*alpha(3)+210*alpha(4)*alpha(2)*alpha(1)-210*alpha(4)*alpha(1).^3+140*alpha(3).^2*alpha(1)+210*alpha(3)*alpha(2).^2-1260*alpha(3)*alpha(2)*alpha(1).^2+840*alpha(3)*alpha(1).^4-630*alpha(2).^3*alpha(1)+2520*al

评论

共有 条评论