How to write the function below in MATLAB?
Having hard time to express $i^\text{th}$ in sym sum. Trying to minimize $x$ for the optimization, so $f(x)$ is the objective function. $$ f_0(x)=\sum_{i=1}^nx_i\log(x_i). $$
How to write the function below in MATLAB?
Having hard time to express $i^\text{th}$ in sym sum. Trying to minimize $x$ for the optimization, so $f(x)$ is the objective function. $$ f_0(x)=\sum_{i=1}^nx_i\log(x_i). $$
Copyright © 2021 JogjaFile Inc.
Vectorised operations in MATLAB are a really good practise if you want to evaluate that sum fast.
Let $x$ denote the vector $(x_1,x_2,\dots,x_n)$. You can do it as follows