matlab generate sum function code example Example: matlab sum function syms k x F1 = symsum(k^2,k,0,10)