Averages using intervals in a vector
3 ビュー (過去 30 日間)
古いコメントを表示
Orlando Ramirez-Valle
2021 年 3 月 28 日
コメント済み: Star Strider
2021 年 3 月 28 日
Hello,
How can I get an average of a vector using intervals?
Example:
(2500 values) vector
I want to add the following intervals in 1D:
Intervals; (3,3,3,3,3,3,3,3,3 . . .3)
Example:
Data
57.303
55.135
47.572
38.165
43.554
34.521
33.017
31.675
29.651
Result (average)
53.33
38.74
31.44
Is it possible to do it in a loop?
Thanks in advance
0 件のコメント
採用された回答
Star Strider
2021 年 3 月 28 日
I have not certain idea what you are asking.
Another option:
v = rand(2500,1); % Create Vector To Test Code
vr = reshape(v(1:numel(v)-rem(numel(v),3)),3,[]); % Reshape Vector To (3x833)
vrm = mean(vr); % Column Mean
.
2 件のコメント
Star Strider
2021 年 3 月 28 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!