⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 make_tree_data.m

📁 本程序针对一维的数据分析,并对其建立合适的马尔可夫模型
💻 M
字号:
% make_tree_data.m%% Make 1-D data for downwards causal (coarse to fine) hidden markov tree.% Usuage : [w, q] = make_tree_data(ES, P0S, MU, SI)% ES - transition matrix, MxMxL where M is the number of states and L is the%      number of levels in the HMTree.  COLUMN STOICHASTIC% POS - initial distribution on the state of the coarsest wavelet%      coefficient, Mx1% MU - mixture means at each level of the tree, MxL% SI - mixture variances at each level of the tree, MxL% w - data produced% q - states from which w was drawn%% Written by : Justin Romberg% Created : 1/14/99function [w, q] = make_tree_data(ES, POS, MU, SI)% number of levels, number of data points, and number of statesL = size(MU,2);N = 2^L;M = size(MU,1);w = zeros(1,N);q = zeros(1,N);% draw states% get cdf of state distribution at coarsest resolutioncdfPOS = cumsum(POS);% choose initial state for "root" of trees = rand(1);cut = find(cdfPOS >= s);q(2) = cut(1);% choose states for the rest of the treefor ll = 2:L  inds1 = 2^(ll-1)+1;  inds2 = 2^ll;  for ii = inds1:inds2    % choose the column of the transition matrix that we need, i.e. the    % state of the parent coefficient    pii = ES(:,q(parent(ii)),ll);    % calculate the cdf of the state distribution    cdfpii = cumsum(pii);    % draw a state    s = rand(1);    cut = find(cdfpii >= s);    q(ii) = cut(1);  endend% generate data points depending on the statesfor ii = 2:N  % level of the node we are at  l = nextpow2(ii);  w(ii) = sqrt(SI(q(ii),l))*randn(1) + MU(q(ii),l);end% quick function to calculate the parent of a given nodefunction p = parent(ii)p = ceil(ii/2);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -