How to do repetition with shuffling?
3 ビュー (過去 30 日間)
古いコメントを表示
So instead of repmat, which makes 123123123 from 123, I want 111222333. But this is just a simple example with a vector. More precisely I have an MxN matrix, and I want to add noise. I want to make several noisy samples, so for each row, I would like to have K noisy version. Therefore I use its repetited version: B = repmat(A,K,1); and I would like to add noise to this matrix. But to be as representative as possible - for example further integration (marginalization) - I use pre generated noise instead of independent random noise. So let be the representative noise sample be C = [c_1,c_2,...,c_K]. I would like to add noise c_1 to the first, the (K+1)th, (2*K+1)th, etc. row of B, c_2 to the 2nd, (K+2)., ... row of B etc. How to do this simply? And what if I would like to permutate noise not be correlated, so I want to add C to the firts block of B (rows from 1 to K), but I want to add randperm(C) to the second block (rows from K+1 to 2K), etc.
0 件のコメント
回答 (1 件)
Walter Roberson
2017 年 5 月 19 日
"So instead of repmat, which makes 123123123 from 123, I want 111222333"
kron([1 2 3],ones(1,3))
See also repelem()
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!