a short code for creating a random (1,-1) matrix

版本 1.0.0.0 (1.3 KB) 作者: Changqing Xu
This is a very short code file for creating a random matrix whose entries are either 1 or -1.
405.0 次下载
更新时间 2010/5/15

查看许可证

I have no idea whether this is the first one, but I am pretty sure that you guys can fully understand what can be done by this short and concise matlab code, that is, to generate a random matrix of any given order, with entries randomly chosen from {1,-1}. In fact, the code can be extended to produce any random matrix whose elements are randomly chosen from any dyadic set ,say, {a,b}. The work was originated and inspired by the blog of Terence Tao on random matrix (see the webpage:
http://terrytao.wordpress.com/tag/random-matrices/)
and a talk "Discrete random matrices " by P.M.Wood from Stanford on the BADMath day of Spring 2010, San Jose,CA.
The running of the code is very fast, as you can find. But it will sharply slow down and display "inf" on your command window if you
put "det" function involved to test its singularity. Sure we may avoid this by using instead a logic function.

引用格式

Changqing Xu (2024). a short code for creating a random (1,-1) matrix (https://www.mathworks.com/matlabcentral/fileexchange/27622-a-short-code-for-creating-a-random-1-1-matrix), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2008b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0