The first case is summing a linear increasing series between two values stored in a vector. The second is the sum of a subvector within a vector.
a = [5 -10 15 -20]
a(1):a(3) % linear vector from 5 to 20 in steps of 1
a(1:3) % elements 1 through 3 of the vector a
sum(a(1):a(3))
sum(a(1:3))