使用matlab求高阶累积量

本文介绍如何使用matlab自带的高阶累积量函数求取一个随机过程的高阶累积量,运行demo之前确保matlab中已经安装了HOSA的工具箱。

安装过程中经常会碰到的两个问题:

1、info.xml出问题,在安装的目录下找到这个文件,将里面的<area>改成<type>,将</area>改成</type>

2、找不到定义的函数cum4est.m,将工具箱中的用到的函数由大写改成小写,重启matlab即可

以下演示如何使用 matlab 产生一个高斯分布随机序列,以及如何计算一个高斯分布的分布密度函数。

clc
clear all
close all
n = 10000;                                   % 随机数列的元数
u = 6;                                      % 随机序列的均值
a = 3;                                      % 随机序列的均方差

x = random('norm',u,a,1,n);                 % 产生一个1*200大小的均值为3,方差0.5的高斯分布随机序列
t = (1-a)*u:0.1:(1+a)*u;
fn = normpdf(t,u,a);                        % 计算均值3,方差0.5的高斯分布密度函数

figure(1)
subplot(3,1,1)
plot(x)                                     % 绘制生成的随机序列x
subplot(3,1,2)
hist(x,20)                                  % 统计生成的随机序列x
xlim([min(t),max(t)])
subplot(3,1,3)
plot(t,fn)                                  % 绘制相应的概率密度曲线
xlim([min(t),max(t)])

% 高阶累积量对高斯随机过程是盲的,故而四阶累积量期望应该是0
xCum4 = cum4est (x, 50, 1000, 50, 'biased', 10, 10);
xCum4Size = size(xCum4)
% y_cum = cum4est (y, maxlag, samp_seg, overlap, flag, k1, k2)  求四阶统计量
% y              : 输入数据向量(列)
% maxlag         : 最大切片数(将频域w分切成不同的子带,完整的频带 = 子带数*2+1)
% 分段求高阶累积量,然后对结果求期望?
% samp _ seg     : 每段样本数
% overlap        : 分段时候,设计重叠部分占每个分段长度的百分比
% flag           : 'biased',计算有偏见的估计
%                : “unbiased”,计算无偏估计。
% k1,k2         : C3 ( m,k1 )或C4 ( m,k1,k2 )中的固定滞后;见下文
% y _ cum        : 估计的四阶累积量切片
% C4 ( m,k1,k2 ) -最大滞后< = m < =最大滞后
% 注意           : 必须指定所有参数

% 二阶累积量对应高斯分布的方差a^2,出现在w=0处,也就是出现在图中横轴的第 maxlag + 1 个点处
xCum2 = cum2est (x, 50, 30, 50, 'unbiased');
xCum2Size = size(xCum2)
% y_cum = cum2est (y, maxlag, nsamp, overlap, flag)
%CUM2EST Covariance function.
%	Should be involed via "CUMEST" for proper parameter checks.
%	y_cum = cum2est (y, maxlag, samp_seg, overlap,  flag)

%	       y: input data vector (column)
%	  maxlag: maximum lag to be computed
%	samp_seg: samples per segment (<=0 means no segmentation)
%	 overlap: percentage overlap of segments
%	    flag: 'biased', biased estimates are computed
%	          'unbiased', unbiased estimates are computed.
%	   y_cum: estimated covariance,
%	          C2(m)  -maxlag <= m <= maxlag
%	all parameters must be specified!

figure(2)
subplot(4,1,2)
plot(xCum2)
subplot(4,1,4)
plot(xCum4)

以下为运行结果

MATLAB高阶累积量工具箱,包含内容有: Higher-Order Spectrum Estimation: conventional methods % cum2x - Estimates cross-covariance % cum3x - Estimates third-order cross-cumulants % cum4x - Estimates fourth-order cross-cumulants % cumest - Estimates auto-cumulants, orders two, three, or four % (cum2est, cum3est, cum4est are sub-ordinate routines) % bicoher - Estimates bicoherence, direct method % bicoherx - Estimates cross-bicoherence, direct method % bispecd - Bispectrum estimation (direct method) % bispecdx - Cross-Bispectrum estimation (direct method) % bispeci - Bispectrum estimation (indirect method) % glstat - Gaussianity-Linearity detection statistics (Hinich test) % % Higher-Order Spectrum Estimation: parametric methods % armaqs - Estimates ARMA parameters via q-slice algorithm % armarts - Estimates ARMA parameters via residual time-series algorithm % armasyn - Generates ARMA synthetics % arorder - Estimates AR order % arrcest - Estimates AR parameters using correlation &/or cumulants % bispect - Theoretical bispectrum of an ARMA process % cumtrue - Computes theoretical (true) cumulants of ARMA processes % maest - Estimates MA parameters (GM algorithm) % maorder - Estimates MA order % rpiid - Generates a sequence of i.i.d. random variables, various p.d.f.'s % trispect - Computes 2-D slice of true trispectrum of ARMA process % % Quadratic Phase Coupling (QPC) % qpcgen - Generates quadratically-phase coupled harmonics in noise % qpctor - Detection of quadratic phase coupling via the TOR method % % Second-Order Volterra Systems % nlgen - Computes the output of a second-order Volterra system % nlpow - Power's method for parameters of 2nd-order Volterra system % nltick - Tick 's method for parameters of 2nd-order Volterra system % % Harmonic Retrieval % harmest - Estimates frequencies of h
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值