How can i repeat the simulation method?

4 Ansichten (letzte 30 Tage)
elham kreem
elham kreem am 10 Feb. 2018
Kommentiert: Walter Roberson am 10 Feb. 2018
I have these steps to simulate data
pd= makedist('normal')
x = rand(pd,30,1)
How can I repeat the data generation process?

Antworten (1)

Image Analyst
Image Analyst am 10 Feb. 2018
Call the functions multiple times. For example you can put it into a for loop:
for k = 1 : 100
pd= makedist('normal')
x = rand(pd,30,1)
% Now do something with x.
end
but that's SO obvious that I don't think it answers your question because you must have already considered that trivial solution. Please explain better.
  3 Kommentare
Image Analyst
Image Analyst am 10 Feb. 2018
Yes, it is true. It will run your code 100 times.
Walter Roberson
Walter Roberson am 10 Feb. 2018
Well, I do not see any point in initializing pd every time through the loop instead of just once before the loop.
I also do not understand why you do not just use randn()

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by