creating matrix of 1 nd -1
2 次查看(过去 30 天)
显示 更早的评论
how can i generate random matrix of 1 and -1 ...
thanks in advance
2 个评论
回答(2 个)
David Young
2012-3-21
Assuming that you want values of 1 and -1 only, you can do
2*randi(2, m, n) - 3
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!