How to generate iid Gaussian noise vector

조회 수: 11 (최근 30일)
Muhammad Yasir
Muhammad Yasir 2021년 7월 14일
편집: Ben McMahon 2021년 10월 15일
I am trying to simulate algorithams given in a research paper.
How can I generate a noise sequence w_t, which is i.i.d. Gaussian of mean zero with variance 2I3 (2xI3 ,where I3 is identity matrix of dimension 3x3) and the initial condition is x_init = [10 10 −10]'
Kindly look at this segment of the paper for which I need to create Gaussian noise samples. I think gaussian noise is a column vector...

답변 (1개)

Ben McMahon
Ben McMahon 2021년 7월 14일
편집: Ben McMahon 2021년 10월 15일
For your particular example as your covariance is idenity and your mean 0, this is a mulitvariate standard normal distrbuiton:
~
The simple answer to this is to use the randn function to generate your samples. For example
% Set Number of Samples
NumSamples = 1000;
% Prealloacte
w = zeros(3,NumSamples);
% Loop for each sample
for t = 1:NumSamples
w(3,t) = randn(3,1); % Generate a 3x1 Random vector
end
Note that the inital condition is for the state vector of the SDE, x, and is not related to generating the white noise vectors.
  댓글 수: 3
Ben McMahon
Ben McMahon 2021년 7월 19일
A Gaussian distribution and a normal distribution are two names for the same thing. See the Wikipedia entry for normal distribution.
Muhammad Yasir
Muhammad Yasir 2021년 8월 12일
i think it should be the code
mu = 0;
sigma = 10*eye(3)
R = chol(sigma);
w_t = repmat(mu,3,1) + randn(3,3)*R
for i=1:length(w_t(1,:))
for j=1:length(w_t(:,1))
phi(i,j) = ( 1 - exp( w_t(i,j) ) )/ ( 1 + exp( w_t(i,j) ) )
end
end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Model Predictive Control Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by