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
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Torsten
le 13 Jan 2024
Modifié(e) : Torsten
le 13 Jan 2024
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".
Réponses (1)
Sulaymon Eshkabilov
le 14 Jan 2024
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)
6 commentaires
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!