Filter löschen
Filter löschen

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

4 Ansichten (letzte 30 Tage)
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 Kommentare
Torsten
Torsten am 13 Jan. 2024
Bearbeitet: Torsten am 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".

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 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)
Norm of First-order Trust-region Iteration Func-count ||f(x)||^2 step optimality radius 0 6 9.49361 6.71 1 1 12 5.13647 1 0.859 1 2 13 5.13647 2.5 0.859 2.5 3 19 4.89156 0.625 0.304 0.625 4 20 4.89156 0.625 0.304 0.625 5 26 4.80326 0.15625 0.196 0.156 6 32 4.73656 0.15625 0.176 0.156 7 38 4.67347 0.390625 0.339 0.391 8 39 4.67347 0.390625 0.339 0.391 9 45 4.59588 0.0976562 0.278 0.0977 10 51 4.46835 0.244141 0.36 0.244 Solver stopped prematurely. fsolve stopped because it exceeded the iteration limit, options.MaxIterations = 1.000000e+01.
Solution = 5×1
0.0865 0.9929 0.8962 2.9799 0.3517
Fval = 5×1
-0.0066 0.0833 -0.0145 -1.1107 -1.7966
disp('Found solution: ')
Found solution:
disp(Solution)
0.0865 0.9929 0.8962 2.9799 0.3517
(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)
Norm of First-order Iteration Func-count Resnorm step optimality 0 6 9.49361 6.9 1 12 6.03506 0.815721 4.66 2 18 4.72506 1.09483 9.26 3 24 2.02104 0.273708 2.82 4 30 1.36831 0.547416 1.89 5 36 0.931038 0.424434 0.582 6 42 0.894717 0.499556 2.09 7 48 0.819859 0.124889 0.0684 8 54 0.819032 0.249778 0.238 9 60 0.816667 0.0624444 0.247 10 66 0.814251 0.0624444 0.00533 11 72 0.812845 0.137778 0.0771 Solver stopped prematurely. lsqnonlin stopped because it exceeded the iteration limit, options.MaxIterations = 1.000000e+01.
SOLUTION = 5×1
0.0280 0.9944 0.8535 7.7640 0.4494
FVAL = 0.8128
  6 Kommentare
Akasha
Akasha am 14 Jan. 2024
Bearbeitet: Akasha am 14 Jan. 2024
this is the output which matlab gives me i dont know how to solve it fully please help me

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by