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

📄 demgausshmm_traj.m

📁 VARHMMBOX, version 1.1, Iead Rezek, Oxford University, MAR 2002 Matlab toolbox for Hidden Markov Mo
💻 M
字号:
% A demonstration of the HMM software using a Gaussian observation% model on trajectory in 2-D spaceclearload demgauss_trajT=size(data,1);% data  original time seriesfigureplot3(data(:,1),data(:,2),1:T);title('Original data');disp('The data forms a trajectory in a 2-D space. It is composed of 2');disp(' sinusoidal waves with added gaussian random noise');disp('We will train an HMM model to trace the trajectory, ');disp('practically quantising the sequence');disp(' ');disp('Press a key to continue');pause% Train up GMM on this datahmm.K=12;hmm=hmminit(data,hmm,'full');% Emphasis is on a smooth trajectory in spacehmm.priors.Dir2d_alpha=ones(hmm.K)+2*eye(hmm.K);hmm.train.cyc=30;hmm.obsmodel='Gauss';hmm.train.obsupdate=ones(1,hmm.K);    % update observation models ?hmm.train.init=1;         % Yes, we've already done initialisationhmm=hmmtrain(data,T,hmm);[block]=hmmdecode(data,T,hmm);% sorting the labels s.t. lowest starts fristblock.sq_star=ones(size(block.q_star));l=block.q_star(1);for i=1:hmm.K  ndx=find(~ismember(block.q_star,l));  block.sq_star(ndx(:))=block.sq_star(ndx(:))+ones(1,length(ndx));  if isempty(ndx), break; else l=[l block.q_star(ndx(1))]; end;end;  subplot(211),plot(data),title('Original data sequence'),axis off;subplot(212),plot(block.sq_star),title('Estimated and Sorted State sequence'),axis off;

⌨️ 快捷键说明

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