generating a randn values to study the effect of an input parameter on output parameter

Hello all,
I have an input parameter alpha, and I want to study the variation effect of this parameter on an output parameter Output_par. What I did is the following, I tried to change the alpha using the randn function to generate a gaussian.
I have actually 2 questions :
1-When am using the randn function in the following way
alpha=alfa(iii)+5*randn/100;
am I changing the alpha value 5 percent? if not can someone
explain to me what it means using it this way ?
2-once I get all the 10000 values of my output_par, do I have
to add the 5 percent to the std of the gaussian or not ?
for iii=1:10000
tic
alpha=alfa(iii)+5*randn/100;
S_f=(2*mr-5) * (alpha).^2
Tu_f=S_f.*max_lid_beta_f_int;
B=S_f.*Gamma_f;
% for i=1:bheem;
EC_f=final_beta_fine.*B;
[number_line,number_column]=size(EC_f);
EC_f_integrated=[];
transposee_EC_f=EC_f';
for i=1:number_column
X=altitude;
Y(i,:)=transposee_EC_f(i,:);
Y=Y(i,:);
EC_f_int=trapz(X,Y);
EC_f_integrated=[EC_f_integrated EC_f_int];
end;
Output_par=[Output_par EC_f_integrated];
toc
end
thanking you in advance,

 Respuesta aceptada

ok is there a way to do what I want ? I mean how to do it in matlab if I want to study an input parameter variation on an output parameter ?

6 comentarios

What you did is right. Generate an input with known Mean and STD, calculate the output, and then probably calculate the Mean and STD of the output. I don't see that part yet. Only you know what's behind those parameters and calculations. You need to know what you try to achieve and ask specific MATLAB questions here.
after generating this I am plotting the histogram using the function hist, that gives me the gaussian shape, and of course I calculate the std and the mean of the ouptput_par.
do you think it's better to change the 5 percent and use something else ?
That depends. What is the typical input supposed to be? Is the input a pure random number, or you want to add some random noise to an exist input like alfa(iii) you have? Regarding 5 percent or something else, it also depends on the value of alfa(iii). Remember there is no boundary for the value of 5*randn/100. You might want to consider rand() which is guaranteed between 0 and 1 but it is uniformly distributed.
alpha can vary between 1 and 3, and I want to add some random noise to an exist input (which is alpha). I want to take the maximum and the minimum value of alpha and see how it affects my output parameters by adding noise to alpha.
In that case, I would think rand() is better because it's value is bounded. You can multiply it with a proper scale to make it the effect of a noise but not overwhelm the true signal. But again, you have to make the decision because you know your application.
ok thanks, I will keep the gaussian.

Iniciar sesión para comentar.

Más respuestas (2)

1. No, it's not. randn could vary from large negative to large positive although the possibility of a large number is small.
Y = randn returns a pseudorandom, scalar value drawn from a normal distribution with mean 0 and standard deviation 1.
2. You probably have to answer yourself. What is the purpose of the code?
Hello,
1. if randn returns a pseudorandom, scalar value drawn from a
normal distribution with mean 0 and standard deviation 1,
multiplying it by 5 and dividing it by 100 should do the same
for the std, no ? and when I add the alpha as a sum, it means
my alpha value is the mean value, no ?
2. the purpose of the code is to see how much the output
parameter varies or is affected by the input parameter alpha
variation.
thanks

1 comentario

1. No and No. Please check a text book. Also, remember you have alfa(iii) involved.

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Preguntada:

el 8 de Sept. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by