Generate a random matrix with 4 specifik values
1 回表示 (過去 30 日間)
古いコメントを表示
hello i want to generate a random matrix tnat has 16 rows and 10^5 coloums that contains 4 differen values [-1,1,-j,j]. can anyone help me
0 件のコメント
回答 (1 件)
Jeff Miller
2020 年 11 月 24 日
maybe this?
j = 2.5; % insert whatever value of j you want to use
vals = [1,-1, j, -j];
pos = randi(numel(vals),15,10^5);
randmatrix = vals(pos);
0 件のコメント
参考
カテゴリ
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!