White zero mean gaussian random process with different variance
3 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Adam Danz
on 1 Apr 2019
Edited: Adam Danz
on 1 Apr 2019
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 Comments
Adam Danz
on 2 Apr 2019
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).
More Answers (0)
See Also
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!