To calculate the total of a series in MATLAB you can use the sum
function with appropriate arguments. Here is an example of calculating the sum of the series 1+2+3+...+10.
main.m49 chars4 lines
Output:
main.m3 chars2 lines
In this example, series
is a vector that contains numbers 1 through 10, and sum(series)
returns the sum of these numbers, which is 55.
gistlibby LogSnag