I want to create normally distributed random variables, and refer to them as my independent variables

1 visualizzazione (ultimi 30 giorni)
I want to start by entering the following command in MATLAB: rng(10, ’twister’). Then, create 100 normally distributed random variables with 100 observations each and refer to those as my independent variables x1, . . . , x100.

Risposte (1)

John D'Errico
John D'Errico il 28 Feb 2021
The answer is, DON'T.
Instead, learn to use MATLAB. MATLAB is an array language. A language of vectors and arrays.
X = randn(100,100);
Now you can treat each row (or column) of this array as a vector of length 100.
So instead of having to create variables with different names, you have an entire array of variables. X(:,1) is the first such variable.
And now you can work with ALL of those variables at once.

Categorie

Scopri di più su Random Number Generation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by