how generating evenly spaced vectors with overlap?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I need to generate evenly spaced vectors with overlap. How can I do it? Here an example:
Input: [0 5 10 15 20];
Output: [0 5, 4 10,9,15,20];
I know they are not even, but also like that is fine.
Thanks cheers
3 件のコメント
the cyclist
2014 年 6 月 26 日
I don't understand the rule for going from input to output.
Also, numeric matrices in MATLAB cannot be "uneven". Do you want to put a placeholder of "NaN" (not-a-number), or use some other class of variable, such as a cell array?
採用された回答
Joseph Cheng
2014 年 6 月 26 日
編集済み: Joseph Cheng
2014 年 6 月 26 日
Starting with the linspace above that people suggested you can get the over lap you by doing this:
input = [0 5 10 15 20];
overlap = 5; % percent
overlap = input(end)*(overlap/100);
output = [input(1:end-1)'-overlap input(2:end)']
output(output<0) = 0;
disp(output)
その他の回答 (0 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!