This optimization problem represents three decoupled linear equations in terms of five scaler variables (k1, k2, J1, J2, J3). So it will be an underdetermined case. I defined a 2-norm function of the different time-series data points to minimize the MSE of the two sides of the set of equations. However, I couldnâ€™t solve the problem with CVX.

As an approximation of the above described optimization problem. I defined another optimization problem to minimize the sum of the MSE of the three individual equations. In other words, for each equation in terms of scalar variables, I defined a 2-norm function, so that the optimization problem tries to minimize the sum of three 2-norm fcuntions each associated with one of the three equations. In this case, the optimization problem can be represented by only the scalar variables:

```
cvx_begin
cvx_solver mosek
variables k1 k2 J1 J2 J3
minimize( ( norm((V(1,3)^2*J1 + V(2,3)^2*J2 + V(3,3)^2*J3) * deriv_deriv_ang_pos_gen_trans(10:length(deriv_deriv_ang_pos_main)) + (V(1,3)^2*k1-2*V(1,3)*V(2,3)*k1+V(2,3)^2*k1+V(2,3)^2*k2-2*V(2,3)*V(3,3)*k2+V(3,3)^2*k2) * ang_pos_gen_trans(10:length(deriv_deriv_ang_pos_main)) - (V(1,3)*input_torque(10:length(deriv_deriv_ang_pos_main))+V(3,3)*output_torque(10:length(deriv_deriv_ang_pos_main))))) + (norm((V(1,1)^2*J1 + V(2,1)^2*J2 + V(3,1)^2*J3) * deriv_deriv_ang_pos_main_trans(10:length(deriv_deriv_ang_pos_main)) + (V(1,1)^2*k1-2*V(1,1)*V(2,1)*k1+V(2,1)^2*k1+V(2,1)^2*k2-2*V(2,1)*V(3,1)*k2+V(3,1)^2*k2) * ang_pos_main_trans(10:length(deriv_deriv_ang_pos_main)) - (V(1,1)*input_torque(10:length(deriv_deriv_ang_pos_main))+V(3,1)*output_torque(10:length(deriv_deriv_ang_pos_main))))) + (norm((V(1,2)^2*J1 + V(2,2)^2*J2 + V(3,2)^2*J3) * deriv_deriv_ang_pos_gear_trans(10:length(deriv_deriv_ang_pos_main)) + (V(1,2)^2*k1-2*V(1,2)*V(2,2)*k1+V(2,2)^2*k1+V(2,2)^2*k2-2*V(2,2)*V(3,2)*k2+V(3,2)^2*k2) * ang_pos_gear_trans(10:length(deriv_deriv_ang_pos_main)) - (V(1,2)*input_torque(10:length(deriv_deriv_ang_pos_main))+V(3,2)*output_torque(10:length(deriv_deriv_ang_pos_main))))) )
k1 >= 0
k2 >= 0
J1 >= 0
J2 >= 0
J3 >= 0
cvx_end
```

In this case, CVX is able to find the optimizer but I am not sure how much the result could be reliable. Because minimization of the sum of MSE of the individual equations does not necessarily mean the minimization of the MSE of the set of equations. I do not know if these two optimization problems will be the same since there is no coupling between the individual equations.