How to do repetition with shuffling?

조회 수: 1 (최근 30일)
Mr M.
Mr M. 2017년 5월 19일
답변: Walter Roberson 2017년 5월 19일
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.

답변 (1개)

Walter Roberson
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()

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by