White zero mean gaussian random process with different variance
조회 수: 3 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
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
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 Center 및 File Exchange에서 Random Number Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!