White zero mean gaussian random process with different variance

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

 Respuesta aceptada

Adam Danz
Adam Danz el 1 de Abr. de 2019
Editada: Adam Danz el 1 de Abr. de 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 comentarios

Thank You so much, i have one more question, what if i want to generate same samples for specific time interval , let suppose for [0, T].
or lets put it this way i want to generate C0(t), C_s(t) and C_b(t).
Then you need to define functions sigmatau_s(t) and sigmatau_b(t).
Salman Farid
Salman Farid el 2 de Abr. de 2019
Editada: Salman Farid el 2 de Abr. de 2019
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?
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).

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Centro de ayuda y File Exchange.

Preguntada:

el 1 de Abr. de 2019

Comentada:

el 2 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by