?? pbnsamplesteadystate.m
字號:
function y = pbnSampleSteadyState(v,m)
% y = pbnSampleSteadyState(v,m) - a random sample from the steady state
%
% This function takes as input a vector v, which represents the
% stationary distribution of a pbn, and outputs a binary m-by-n matrix y
% consisting of a random sample from v (n is the number of variables in the
% pbn). Positive integer m denotes the number of samples to be drawn.
% Functions used: pmfrnd.m.
% Harri L鋒desm鋕i August 29, 2005.
n = round(log2(length(v)));
bits = [n:-1:1];
y = zeros(m,n);
for i=1:m
x = pmfrnd(v) - 1; % A random number between 0 and 2^n-1.
y(i,:) = bitget(x,bits);
end % for i=1:m
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -