random resampling with rebalancement

조회 수: 1 (최근 30일)
Dam
Dam 2012년 8월 6일
I have an array Y (3000*1) from which i want to drow an n=100 random samples with rebalancement(with repeating possible), such that each sample contains 252 consecutive values from Y (i.e only the starting point is randomly chosen) the reslut dimensions are meant to be 252*100
Thank you for helping with this
regards
  댓글 수: 2
Oleg Komarov
Oleg Komarov 2012년 8월 6일
what if I pick the 2999 value? Should I continue in a circular way, i.e.
2999, 3000, 1, 2 ...
Dam
Dam 2012년 8월 6일
편집: Dam 2012년 8월 6일
No, they have to be 252 consecutive values; so the last 251 values of Y must be exonerated from the choice of the random starting point.
thank you

댓글을 달려면 로그인하십시오.

채택된 답변

bym
bym 2012년 8월 6일
편집: bym 2012년 8월 6일
r = randi(2748,100,1);
x = zeros(252,100);
for k = 1:100
x(:,k) = Y(r(k):r(k) + 251);
end
  댓글 수: 1
Dam
Dam 2012년 8월 13일
Thank you for your answer It works well

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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