You cannot do it with symsum() . You can never use a symbolic variable to index anything.
You need to instead calculate the individual values and sum() them.
Use loops if you need to. Get the code working first before you worry about whether there are ways to vectorize it.
Note:
The equations do not make sense. (i) is an input parameter on the left side, but on the right hand side, i is sometimes an input parameter and sometimes the variable of summation. This is confusing.
In the numerator, the first
involves the input parameter i but in the denominator it is the i captured from the
. This is confusing. And the second
in both cases it is the locally captured i from the sum . The equations need to be rewritten for clarity.