MATLAB Answers

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

48 ビュー (過去 30 日間)
John Bjerkvig Lea
John Bjerkvig Lea 2021 年 2 月 28 日
回答済み: John D'Errico 2021 年 2 月 28 日
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.

Community Treasure Hunt

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

Start Hunting!

Translated by