Matlab仿真中随机变量的独立性 [英] Independence of random variables in a Matlab simulation
问题描述
我对如何确保Matlab仿真中随机变量的独立性存有疑问.考虑以下示例:
I have some doubts on how to ensure independence of random variables in a Matlab simulation. Consider the following example:
T=400;
x=randi(3,T,1); %Tx1
w=randn(T,1); %Tx1
我们知道,对于t=1,...,T
,x(t)
是来自Unif([1,3])
的平局.
我们可以将x(t)
视为t=1,...,T
的随机变量X_t~Unif([1,3])
的实现,
(X_1,..., X_T)
相互独立.
We know that, for t=1,...,T
, x(t)
is a draw from a Unif([1,3])
.
We can think of x(t)
as the realisation of a random variable X_t~Unif([1,3])
for t=1,...,T
with
(X_1,..., X_T)
mutually independent.
我们知道,对于t=1,...,T
,w(t)
是来自N(0,1)
的平局.
我们可以将w(t)
视为对t=1,...,T
且(W_1,..., W_T)
相互独立的随机变量W_t~N(0,1)
的实现.
We know that, for t=1,...,T
, w(t)
is a draw from a N(0,1)
.
We can think of w(t)
as the realisation of a random variable W_t~N(0,1)
for t=1,...,T
with (W_1,..., W_T)
mutually independent.
问题:假设我要确保每个t=1,...,T
的W_t
独立于X_t
:我的上述步骤会自动确保,如果没有,我会进行哪些修改应该介绍吗?
Question: Suppose I want to ensure that, for each t=1,...,T
, W_t
is independent of X_t
: do my steps above automatically ensure that and, if not, which modifications I should introduce?
推荐答案
是的,一般而言,您可以尽可能地使用伪随机数.但是抛开pseduo部分,所有数字都来自与上述此处在文档中
Yes, you can as far as it is possible for pseudorandom numbers in general. But casting the pseduo part aside, all numbers come from the same number generator as mentioned here in the documentation
每次您呼叫rand,randi或randn时,它们都会从其共享的随机数生成器中提取一个新值,并且可以将连续值视为统计上独立的."
"Each time you call rand, randi, or randn, they draw a new value from their shared random number generator, and successive values can be treated as statistically independent. "
因此,如果您说值(X_1,..., X_T)
是相互独立的,则值(X_1,..., X_2T)
也是相互独立的.在您的示例中,(X_1,..., X_T)
用于x
,而(X_T+1,..., X_2T)
用于w
.
So if you say that the values (X_1,..., X_T)
are mutually independent then the values (X_1,..., X_2T)
are also mutually independent. In your example (X_1,..., X_T)
are used for x
while (X_T+1,..., X_2T)
are used for w
.
这篇关于Matlab仿真中随机变量的独立性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!