4

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.

To start with,

lets say I want to generate the sum of x1+x2+x3.

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 ':'.

how can I make this work ?

Shahin
  • 41

0 Answers0