take mean of consecutive 5 values.
3 views (last 30 days)
Show older comments
i want to fix the size of vector that is 5 ,then for every iteration calculate the value and perform mean of these 1to 5 values ,when 5 values is full,in the 6 iteration the mean of values from 2 to 6 and so on,if the mean is less than 0.1 then the iteration is stop.
U and V are the matrix having random values.
alpha=0.001;
for i=1:no_of_iteration % no_of_iteration is some input value
U=U-alpha*0.1; % U is matrix ,randomly assign value
V=V-alpha*0.1; % V is matrix ,randomly assign value
cost=sum(sum(U*V));
end
want to take the mean of 5 consecutive cost value ,and compare the value if less then 0.1 then stop iteration
0 Comments
Answers (0)
See Also
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!