Find the solution of the coupled system of equations
Show older comments
I have several equations with coefficients such as c_i, d_i, etc. I need to obtain the coefficients using the least squares method, subject to the following conditions:
- I would appreciate any help in determining these coefficients using the least squares method given the above constraints.
- Additionally, what would be a better or more efficient way to obtain these coefficients?
Thank you.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
F11 = c00 + d00 - (2*c2)/3 - (2*c5)/9 + ((4*c4)/7 + 4*(c1) + 3*(c3) - 6*c1*c3 + (16*c1*c4)/7 - (12*c3*c4)/7 + (c00 - d00)^2)^(1);
F12 = c00 + d00 - (2*c2)/3 - (2*c5)/9 - ((4*c4)/7 + 4*(c1) + 3*(c3) - 6*c1*c3 + (16*c1*c4)/7 - (12*c3*c4)/7 + (c00 - d00)^2)^(1);
F21 = c00 + d00 + 2*c2 + (2*c5)/3 + ((24*c4)/7 + 12*(c1) + 3*(c3) + 18*c1*c3 + (144*c1*c4)/7 + (36*c3*c4)/7 + (c00 - d00)^2)^(1);
F22 = c00 + d00 + 2*c2 + (2*c5)/3 - ((24*c4)/7 + 12*(c1) + 3*(c3) + 18*c1*c3 + (144*c1*c4)/7 + (36*c3*c4)/7 + (c00 - d00)^2)^(1);
F31 = c00 + d00 - c2 + (2*c5)/3 + (4*(c1^20282)^(1) - (c1*c3)/50706 + 4*(c3^2/8112)^(1) + (c00 - d00)^2)^(1);
F33 = c00 + d00 - c2 + (2*c5)/3 - (4*(c1^20282)^(1) - (c1*c3)/50706 + 4*(c3^2/8112)^(1) + (c00 - d00)^2)^(1);
F11 = 0.86;
F12 = -2.3;
F21 = 6.8;
F22 = -6.3;
F31 = 0.3;
F32 = -0.4;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 Comments
Dyuman Joshi
on 14 Jan 2024
What have you tried yet?
Sam Chak
on 15 Jan 2024
Hi @Torsten, they do look like 3 pairs of identical equations to me at first glance. However, when I displayed them in code format (horizontal single line), you will see the plus-minus signs in each pair.
Another issue is that the system is considered underdetermined because there are fewer equations (6: F11, F12, F21, F22, F31, F32) than unknown variables (7: c00, d00, c1, c2, c3, c4, c5).
Accepted Answer
More Answers (2)
Applying the LS method for solving such systems is relatively straight forward, e.g.:
b1 = 3x + 2y-3z
b2 = 2x-y+5z
b3 = -3x+6y-2z
b1 = 1; b2 = 2; b3 = 5;
% Step 1. Define A matrix:
A = [3 2 -3; 2 -1 5; -3 6 -2];
b1 = 1; b2 = 2; b3 = 5;
% Step 2. Define b matrix:
b = [b1;b2;b3];
% Step 3. Determine solution tolerance
tol = 1e-15;
% Step 4. Solve the system of [A]*{X} = [b] where [A] is coefficients, [b]
% is the column matrix (also called a system response), {X} is unknowns
% How to apply LS method:
SOL1 = lsqr(A,b, tol); % Using the least squares method
fprintf('Solutions: x = %f; y = %f; z = %f \n', SOL1')
%% NB: \ operator or linsolve() can be also used for such systems:
SOL2 = A\b; % Using backslash (\)
fprintf('Solutions: x = %f; y = %f; z = %f \n', SOL2')
SOL3 = linsolve(A,b); % Using linsolve()
fprintf('Solutions: x = %f; y = %f; z = %f \n', SOL3')
Sulaymon Eshkabilov
on 15 Jan 2024
Edited: Sulaymon Eshkabilov
on 15 Jan 2024
The accepted answer is NOT the least squares method as mentioned in the question itself.
F11 = 0.86;
F12 = -2.3;
F21 = 6.8;
F22 = -6.3;
F31 = 0.3;
F32 = -0.4;
A = [1, 1, 0, 0, -2/3, -2/9;
1, 1, 0, 0, -2/3, -2/9;
1, 1, 2, 0, 0, 2/3;
1, 1, 2, 0, 0, 2/3;
1, 1, -1, 0, -1, 2/3;
1, 0, 0, 0, 0, 0;];
B = [F11; F12; F21; F22; F31; F32];
tol = 1e-7;
SOLUTION = lsqr(A,B, tol) % Using the least squares method
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!