White zero mean gaussian random process with different variance

조회 수: 3 (최근 30일)
Salman Farid
Salman Farid 2019년 4월 1일
댓글: Adam Danz 2019년 4월 2일
Hi,
i want to generate White zero mean gaussian random process with different variance.
i am generating using below code, is that right??
C0 = normrnd(0,sigmatau0);
for n=1:10
C_s(n) = normrnd(0,sigmataun_s(n));
C_b(n) = normrnd(0,sigmataun_b(n));
end
sigmatau0,sigmatau_s and sigmatau_b is already define
thank you

채택된 답변

Adam Danz
Adam Danz 2019년 4월 1일
편집: Adam Danz 2019년 4월 1일
Yes, normrnd() is the function you want to use. The second input specifies the sandard deviation. You are generating one sample at each standard deviation -- is that really what you want to do?
Don't forget to allocate your loop variables.
C_s = zeros(1,10);
C_b = C_s;
for n = 1:10
...
end
  댓글 수: 4
Salman Farid
Salman Farid 2019년 4월 2일
편집: Salman Farid 2019년 4월 2일
sigmatau0 = 2e-6;
sigmard = 5e-7;
for n=1:10
sigmataun_s(n) = sigmatau0 + sigmard.*((2*(n)+1-(-1).^n)./4);
sigmataun_b(n) = sigmatau0 + sigmard.*((2*(n)-1+(-1).^n)./4);
end
C0 = normrnd(0,sigmatau0);
C_s = zeros(1,10);
C_b= C_s;
for n=1:10
C_s(n) = normrnd(0,sigmataun_s(n));
C_b(n) = normrnd(0,sigmataun_b(n));
end
i already define it like this, but i am not sure if its right or not?
Adam Danz
Adam Danz 2019년 4월 2일
I didn't understand that time-interval question (and I'm still not sure that the code is doing what you want it to do). You are generating 10 randome numbers. Each of those 10 random numbers come from a different distribution with different standard deviations (all mean 0). Furthermore, the standard deviations are tiny (all very close to 0) so all of your random draws will be near 0.
Your first for-loop can be replaced with this:
n = 1:10;
sigmataun_s = sigmatau0 + sigmard.*((2*(n)+1-(-1).^n)./4);
sigmataun_b = sigmatau0 + sigmard.*((2*(n)-1+(-1).^n)./4);
You're using these variables to specify the standard deviation in normrnd() but both of these variables are vectors containing very small values (eg: 0.000005).

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by