MATLAB Answers

0

take mean of consecutive 5 values.

Asked by RUCHI CHOUDHARY on 25 Sep 2019
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

Sign in to comment.

0 Answers