solving nonlinear homogeneous system of equations with suitable initial guess

3 次查看(过去 30 天)
Can anyone suggest intial guess(the value of A0) for the system of homogeneous nonlinear equations or any other method to solve the system.
D = 0.1;
L = 0.1;
B = 0.1;
xi = 0.1;
sigma1 = B^3 * D^2 * L^3;
sigma2 = D^2 * L^3;
Ra_values = (10:100:100000).';
solutions = zeros(length(Ra_values), 7);
%Nu = zeros(length(Ra_values),1);
for i = 1:length(Ra_values)
Ra = Ra_values(i);
R = Ra * xi;
f1 = @(A) -((5*A(2)*A(6)*pi^5*B^2*D^2*L^4)/8 + (A(2)*A(6)*pi^5*D^4*L^4)/4)/sigma1 - (B * ((A(4)*A(7)*D^4*pi^5)/4 - (A(1)*L^4*pi^4)/2 - (32*A(5)*L^4*Ra)/9 + (A(1)*L^4*R*pi^2)/2 + (5*A(4)*A(7)*D^2*L^2*pi^5)/8))/sigma2;
f2 = @(A) -(B^2 * (A(2)*A(5)*D^2*L^4*pi^5 - (A(2)*D^2*L^4*pi^4)/2 - (A(1)*A(6)*D^2*L^4*pi^5)/8 - (4*A(6)*D^2*L^4*Ra)/9 + (A(4)*A(7)*D^2*L^4*pi^5)/2 + (3*A(4)*A(7)*D^4*L^2*pi^5)/16 + (A(2)*D^2*L^4*R*pi^2)/4) - (A(2)*D^4*L^4*pi^4)/4)/sigma1 - (B * ((A(4)*A(7)*D^4*pi^5)/8 - (A(2)*L^4*pi^4)/4 - (16*A(6)*L^4*Ra)/9 + (A(2)*L^4*R*pi^2)/4 + (5*A(4)*A(7)*D^2*L^2*pi^5)/16))/sigma2;
f3 = @(A) (B * ((16*A(7)*L^4*Ra)/9 + (A(3)*D^4*pi^4)/4 + (A(3)*L^4*pi^4)/4 - (A(3)*L^4*R*pi^2)/4 + (A(3)*D^2*L^2*pi^4)/2 + (A(1)*A(7)*D^2*L^2*pi^5)/8 - A(3)*A(5)*D^2*L^2*pi^5 - (A(4)*A(6)*D^2*L^2*pi^5)/2))/sigma2 - (B^2 * ((3*A(4)*A(6)*pi^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(6)*L^4*pi^4 + (A(3)*A(4)*D^4*pi^5)/4 - A(6)*L^4*R*pi^2 + (A(3)*A(4)*D^2*L^2*pi^5)/4)/sigma2;
f7 = @(A) (B * ((4*A(3)*L^4*Ra)/9 + (A(7)*D^4*pi^4)/4 + 4*A(7)*L^4*pi^4 - A(7)*L^4*R*pi^2 + 2*A(7)*D^2*L^2*pi^4 + (A(1)*A(3)*D^2*L^2*pi^5)/8 + (A(2)*A(4)*D^2*L^2*pi^5)/16))/sigma2 + (B^2 * ((3*A(2)*A(4)*pi^5*D^4*L^2)/16 + (A(2)*A(4)*pi^5*D^2*L^4)/4) + (A(2)*A(4)*D^4*L^4*pi^5)/4)/sigma1;
F = @(A) [f1(A); f2(A); f3(A); f4(A); f5(A); f6(A); f7(A)];
A0 = [];
A = fsolve(F, A0);
solutions(i, :) = A;
end
A1_1_1 = solutions(:, 1);
A2_1_1 = solutions(:, 5);
Nu = xi - 1./2 - (pi^3 ./ Ra_values) .* A1_1_1 - (8 * pi^3 ./ Ra_values) .* A2_1_1;

回答(1 个)

SAI SRUJAN
SAI SRUJAN 2024-5-28
Hi Madhvi,
I understand that you are facing an issue solving nonlinear homogeneous system of equations.
Choosing a good initial guess '(A0)' can significantly affect the convergence and accuracy of the solutions found by 'fsolve'. A common starting point is to use a zero vector as the initial guess, assuming that the solution might be close to zero. If the 'fsolve' method with various initial guesses does not yield satisfactory results, we can use the 'fmincon' MATLAB function.
The approach using 'fmincon' involves formulating the problem of solving a system of nonlinear equations as an optimization problem. Please follow the below code sample to proceed further,
% define the objective function
objFun = @(A) sum([f1(A), f2(A), f3(A), f4(A), f5(A), f6(A), f7(A)].^2);
A0 = zeros(7,1);
options = optimoptions('fmincon', 'Display', 'iter', 'Algorithm', 'sqp');
[A_opt, fval] = fmincon(objFun, A0, [], [], [], [], [], [], [], options);
For a comprehensive understanding of the 'fmincon' function in MATLAB, please refer to the following documentation.
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by