random resampling with rebalancement

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 日

0 投票

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 件)

カテゴリ

タグ

質問済み:

Dam
2012 年 8 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by