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

1 次查看(过去 30 天)
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.

回答(1 个)

John D'Errico
John D'Errico 2021-2-28
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.

类别

Help CenterFile Exchange 中查找有关 Random Number Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by