I have been working on 50 non linear differential equation with fsolve but it always give me this answer please help how can i solve this problem
2 次查看(过去 30 天)
显示 更早的评论
I have been working on fins equation and faced non linear eqaution so i have used fsolve command but every time it show this thing
5 个评论
Torsten
2024-1-13
编辑:Torsten
2024-1-13
I have apply fdm central scheme so d.e changes in ko 50 non linear algebraic eqaution
But in the title you write that you work on 50 nonlinear differential equations ...
Maybe using a solver for boundary value problems is a better choice than discretizing on your own. Look up "bvp4c" or "bvp5c".
回答(1 个)
Sulaymon Eshkabilov
2024-1-14
There are a couple of points to consider.
(1) if fsolve() has to be used, then fsolve()'s options need to be set up to perform N number of iterations, e.g.:
% Function handle of the problem to be solved solve
EQNs = @(x) ([x(1)^2 + x(2)^2 - 1;
exp(x(1)) + x(2) - 2;
sin(x(1) + x(2)) - x(3);
cos(x(4)) - x(5)^2;
log(x(4) + x(5)) - 3]);
% Number of Iterations to perform:
N = 10;
% Set the options of fsolve():
OPTs = optimoptions('fsolve', 'MaxIter', N, 'Display','iter');
% Initial Guess Solutions:
X_guess = [1; 1; 1; 1; 1];
% Solve the system of equations
[Solution, Fval] = fsolve(EQNs, X_guess, OPTs)
disp('Found solution: ')
disp(Solution)
(2) lsqnonlin() is good to solve large size nonlinear problems:
% Function handle of the problem to be solved solve
EQNs = @(x) ([x(1)^2 + x(2)^2 - 1;
exp(x(1)) + x(2) - 2;
sin(x(1) + x(2)) - x(3);
cos(x(4)) - x(5)^2;
log(x(4) + x(5)) - 3]);
% Initial Guess Solutions:
X_guess = [1; 1; 1; 1; 1];
% Set Lower bound:
LB = [0; 0; 0; 0; 0; ];
% Set Lower bound:
UB = [10; 10; 10; 10; 10; ];
% Max Number of Iterations:
N = 10;
% Options set up:
OPT2 = optimoptions('lsqnonlin', 'MaxIterations', N, 'Display','iter');
% Use lsqnonlin() to solve EQNs:
[SOLUTION, FVAL] = lsqnonlin(EQNs, X_guess, LB, UB, OPT2)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!