How can i repeat the simulation method?

I have these steps to simulate data
pd= makedist('normal')
x = rand(pd,30,1)
How can I repeat the data generation process?

답변 (1개)

Image Analyst
Image Analyst 2018년 2월 10일

0 개 추천

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

elham kreem
elham kreem 2018년 2월 10일
thank you for reply i used this method, i mean i used tho loop but i don't know if it is true?
Image Analyst
Image Analyst 2018년 2월 10일
Yes, it is true. It will run your code 100 times.
Walter Roberson
Walter Roberson 2018년 2월 10일
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()

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 MATLAB Coder에 대해 자세히 알아보기

질문:

2018년 2월 10일

댓글:

2018년 2월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by