MATLAB: 4 unknown 3 nonlinear equation solution with minimum norm

equationminimum normnonlinearnonlinear equationpseudoinversesolve

Hello,
I have 3 nonlinear equation with 4 unknown variable
I want to obtain the minimum norm solution like pseudoinverse(pinv). Which method do you prefer ?
Thanks for your help.

Best Answer

I change your last equation rhs to 600 (otherwise there is NO solution).
Here is two methods to find the minimum norm solution.
  • The first method needs this file on FEX, no toolbox is required.
  • The second method needs FMINCON from the optimization toolbox.
% 1st & 2nd equations: Aeq*x = beq
Aeq = [3 5 11 14; ...
7 2 8 5];
beq = [100; 7];
% 3rd equation: x'*Hx*x + gx'*x + cx = 0
Hx = diag([8 7 8 5]);
gx = [9; 5; 9; 6];
cx = -600;
% Method 1, using ConicPrj
% on FEX https://www.mathworks.com/matlabcentral/fileexchange/27711-euclidian-projection-on-ellipsoid-and-conic
x0 = pinv(Aeq)*beq;
Q = null(Aeq);
Hy = Q'*Hx*Q;
gy = Q'*(gx + 2*Hx*x0);
cy = cx + x0'*(Hx*x0 + gx);
% File exchange to be downloaded
y = ConicPrj([0; 0], Hy, gy, cy);
[~,imin] = min(sum(y.^2,1));
xellprj = x0+Q*y(:,imin)
% Method 2: FMINCON
[xfmincon,a,b,c] = fmincon(@(x) sum(x.^2), zeros(4,1), ...
[], [], ...
Aeq, beq, ...
[], [], @(x) deal([], x'*Hx*x + gx'*x + cx));
xfmincon
Both gives the same solution
>> test
xellprj =
-6.3652
2.9411
2.0611
5.8370
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the value of the optimality tolerance,
and constraints are satisfied to within the value of the constraint tolerance.
<stopping criteria details>
xfmincon =
-6.3652
2.9411
2.0611
5.8370
>>