Search code examples
matlabgaussianpopulation

MATLAB: Generating a population randomly starting from some parameters


I am quite a beginner and I am sorry if my question seems trivial, but I hope somebody will help me.

Let's assume I have a quantity Q which is function of n inputs Xi:

Q = f(X1, X2, ... Xn)

Now, let's assume that some of these inputs are distributed according to a Gaussian. Thus, for example, X1, X2 and X3 are randomly distributed with a well define mean value and standard deviation, while X4 ... Xn are instead assumed to be constant.

I know how to generate randomly the populations X1, X2 and X3 on Matlab, with a command that should implement implicitly a Monte Carlo approach:

pop_X1 = X1_nom + randn(N,1) * X1_dev; 
pop_X2 = X2_nom + randn(N,1) * X2_dev; 
pop_X3 = X3_nom + randn(N,1) * X3_dev;

However, how do I generate Q taking into account all these input populations variations? Can I simply apply the function f aligning the vectors of X1, X2 and X3 previously generated?

Thanks!!

Paolo


Solution

  • "Can I simply apply the function f aligning the vectors of X1, X2 and X3 previously generated ?"

    Yes, you can.


    Edit

    From a mathematical point of view, it's perfectly equivalent. You can do it safely.

    From a programatical point of view, there is a difference. Drawing arrays of values from Gaussian distributions and applying a function to these arrays is not the same than drawing points accordingly to a custom distribution.

    So, if you try both methods, you will never get the same exact drawings but the statistical properties of the final dataset should be exactly the same.