# MATLAB equivalent of Mathematica's Sum

I am trying to find the simplest MATLAB equivalent command of this Mathematica code

```
Sum[i^2,{i,1,10}]
```

I am trying to find the simplest MATLAB equivalent command of this Mathematica code

```
Sum[i^2,{i,1,10}]
```

## Andrew-

2019-11-13

Well, if I understand you correctly then:

should do the trick.

## Andy-

2019-11-13

You will first declare

`i`

as a vector containing the values over which you will sum.Then you simply sum the vector of the squares: