mcmctrace.m

来自「马尔可夫链」· M 代码 · 共 43 行

M
43
字号
% MCMCTRACE - trace plots% Copyright (c) 1998, Harvard University. Full copyright in the file Copyright%%   mcmctrace(A)%% A = an array of MCMC output, the last dimension%     is the index of the different samples%% The resulting graph will be an array of trace% plots of the values over time.  %% if the first element of each trace is NaN, the% trace plot will be empty.%% See also: MCMCLT, MCMCSUMMfunction mcmctrace(A) dd = size(A) ;ll = length(dd) ;d1 = dd(1) ;d2 = dd(2) ;if (ll==2),  aa = reshape(A, [d1 1 d2]) ;  d3 = d2 ;  d2 = 1 ;else  aa = A ;  d3 = dd(3) ;end ;ix = 0 ;for i1 = 1:d1,for i2 = 1:d2,  ix = ix + 1 ;  bb = reshape(aa(i1,i2,:),[1 d3]) ;  if ( ~isnan (bb(1,1)) ),    subplot(d1,d2,ix), plot(bb,'k-') ;  end endend

⌨️ 快捷键说明

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