Ok now consider the following:
1. Define the duration of T ie. the sampling time.
2. Define an accumulator and initialize it to zero. Eg A = 0;
3. Create a "for loop" that will run N times. Where N is the total number of sampling periods. Let n (small n) be the loop variable. Each loop will perform one definite integration. (Note that n should starts from 1)
4. Inside the loop you have to dynamically update the integration limit. For this create two variables.
L1 = (n-1)*T % Lower limit. ( to make the first limit 0, we use (n-1))
L2 = L1 + T % Upper limit
5. Perform integration and store in a variable. For example
x = vpa( int( v(t), L1, L2 ))
6. Store result in an accumulator.
A = A + x;
After the loop breaks, A is the final answer.
- - - Updated - - -
Oh just realized, since you are not addressing any array from the loop variable
directly, you may start the loop from 0 instead of one, and then use n instead of (n-1)