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

📄 process.m

📁 markov matlab code, give a detail impletation of markov procedure
💻 M
字号:
% process.m simulates a Markov process on a state space S, using initial% distribution mu, sojourn parameters lambda, and jump matrix Q.clear T;clear x;             % clear out previous valuesT(1) = 0;            % start times at 0x(1) = rando(mu);    % generate first x value (time 0, not time 1)i    = 1;while T(i) < Tmax,  T(i+1) = T(i)  - log(rand)/lambda(x(i));  % generate exponential rv                                % occasionally causes errors; ignore them  x(i+1) = rando(Q(x(i),:));    % use Q to make state transitions  i=i+1;endcla;hold onfor i=1:(length(T)-1),  plot([T(i) T(i+1)], [S(x(i)) S(x(i))]);end%stairs(T,S(x));                 % sometime this is more appropriateaxis([0 Tmax 0 (length(mu)+1)]);xlabel('Time');

⌨️ 快捷键说明

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