How to write a matlab code to perform moving compuation for any equation?
1 次查看(过去 30 天)
显示 更早的评论
Lets say I have a vector of 1000 random numbers and want to sum every 30 numbers of the vector and store it in a variable.
0 个评论
采纳的回答
Sulaymon Eshkabilov
2023-1-8
编辑:Sulaymon Eshkabilov
2023-1-8
There are a couple of ways to do it, e.g.:
V = randi([-10, 100], 1, 1000);
n = 1:30:numel(V);
for ii=1:numel(n)-1
Vs(ii)=sum(V(n(ii):n(ii+1)));
end
numel(Vs)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!