n is a fixed input ... you should not be changing n inside your function. Get rid of that n = n + 1 statement.
The values you are summing v(r+1:n) isn't correct. You need to be summing n consecutive numbers. So, assuming the first index of these numbers is r, the subset would be v(r:r+n-1)
The loop needs to run as long as that last index of r+n-1 isn't greater than numel(v).
Prior to the loop, you should initialize summa and index to default values (e.g., maybe summa = -inf, or perhaps the sum of the first sequence of numbers in the vector). The summa variable is a scalar value (see the examples), not a vector, so you shouldn't be initializing it to a vector of zeroes.
Inside the loop you should have something like this logic:
if( the sum of the v(r:r+n-1) elements is greater than the current value of summa )
save the sum in summa and save the r in index
Give a try at making these changes and then post replies on this thread if you have more problems.