I have a matrix $A$ of $3$ rows and $k$ columns $(k>3)$. Also, $p$ is a column vector of $k$ elements $[p_1 , p_2 \ldots ,p_k]'$ where $0<p_i<1, \forall i \in \{1,2,\ldots ,k\}. $.
I have the following system of equations: $Ap=q$, where $0<q_i<1, \forall i \in \{1,2,3\}. $
Since this is an undetermined system, there are infinitely many solutions.
I am interested in finding a solution $p$ such that $\sum_{i=1}^{k}i \times p_i$ is minimum..
I am looking to solve this in MATLAB. Can someone help me come up with how to solve this in MATLAB? I thought of using lsqnonneq along with $null(A)$ in MATLAB as shown here. But, I don't know how to force the constraint that $\sum_{i=1}^{k}i \times p_i$ is minimum.
This can be formulated and solved as a Linear Programing problem. One easy way to do this in MATLAB is to use CVX, which is a free add-on to MATLAB.
I will assume that $p$ is subject to
0 <= p <= 1(per element). If you really require strict inequality, you can change that to something like1e-4 <= p <= 1-1e-4.After execution,
pwill contain the optimal solution (unless the problem is found to be infeasible (i.e., not all constraints can be satisfied)).