- The first method needs this file on FEX, no toolbox is required.
- The second method needs FMINCON from the optimization toolbox.
4 unknown 3 nonlinear equation solution with minimum norm
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Murat YAPICI
le 16 Nov 2020
Commenté : Murat YAPICI
le 17 Nov 2020
Hello,
I have 3 nonlinear equation with 4 unknown variable
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/415988/image.png)
I want to obtain the minimum norm solution like pseudoinverse(pinv). Which method do you prefer ?
Thanks for your help.
0 commentaires
Réponse acceptée
Bruno Luong
le 16 Nov 2020
Modifié(e) : Bruno Luong
le 16 Nov 2020
I change your last equation rhs to 600 (otherwise there is NO solution).
Here is two methods to find the minimum norm solution.
% 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
>>
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Systems of Nonlinear Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!