# Symbolic summation MATLAB

Can someone help me generate the following symbolic summation in MATLAB? I then want to differentiate the Jacobian matrix.

$f(x) = \sum_{i=1}^{n} \sum_{j=1}^n (x_i (\Sigma x)_i - x_j (\Sigma x)_j)^2$

where $\Sigma - n \times n$ matrix and $(\Sigma x)_i$ is the i-th row of the product.

I can generate x1,x2,x3 using X = sym('x',[3 1]). Then, I would expect this to work: symsum(X(k),k,1,3). But i get the following error: Indexing input must be numeric, logical or ':'.
What does $(\sum x)_i$ mean? –  copper.hat Jun 13 '13 at 16:50
The $i$th row of what product? –  copper.hat Jun 13 '13 at 18:44