i cant understand this variable initialization
3 次查看(过去 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.
0 个评论
采纳的回答
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]
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!