How to do repetition with shuffling?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Walter Roberson
am 19 Mai 2017
"So instead of repmat, which makes 123123123 from 123, I want 111222333"
kron([1 2 3],ones(1,3))
See also repelem()
0 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!