i cant understand this variable initialization

조회 수: 3 (최근 30일)
lyes
lyes 2013년 12월 30일
답변: lyes 2013년 12월 30일
hello everyone !! im new in matlab ... can anyone please explain me how a matrix X can contain values greater than 2 after the following initialization : X = [randn(100,2)+ones(100,2);... randn(100,2)-ones(100,2)];
i thought that rand() gives random values in the interval 0-1..and when adding ones() the values will be between 1 and 2.
M I missing something ?
thanks in advance.

채택된 답변

Wayne King
Wayne King 2013년 12월 30일
편집: Wayne King 2013년 12월 30일
You are using randn() not rand() -- those are very different things.
randn() gives N(0,1) random variables. Those usually take values from [-3,3]

추가 답변 (1개)

lyes
lyes 2013년 12월 30일
Thank you very much wayne for the answer

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by