In his lecture notes on Optimization, prof Strang at MIT refers to the mechanical spring mass system as the model problem of optimization. See figure 7.2 in

I put together the following MATLAB file to minimize the energy in the springs of a mechanical system consisting of 4 springs and 3 mass’s.

I solved the problem using the techniques described in the above lecture notes and would like to compare the results with the solution that CVX provides. Since I don’t have a copy of MATLAB and CVX, (I use Octave instead of MATLAB), can someone run the following code and see if the result E3 for minimum energy from CVX matches the result E1 and E2 the minimum energy from quadprog and the saddle point system described in the paper.

Next I would like to modify the problem and turn it into a MIDCP. I would like to determine the values of the 3 mass’s m1, m2 and m3 that sum up to a constant value of ‘total_mass’ and minimize the energy in the springs. Can someone who has access an MIDCP solver verify that the following matlab code solves this MIDCP problem.