# Is there any function other than Fsolve to solve systems of nonlinear equations ????

45 views (last 30 days)
kamal kiki on 6 May 2012
I am trying to solve the following system of 3 nonlinear equations:
XYZ(1)-A*(B*XYZ(2)^P1-C*XYZ(2)^P2)^(1/2)=0
XYZ(1)*F+G-XYZ(1)*XYZ(3)*H-I*XYZ(3)=0
XYZ(1)+E-D*XYZ(2)*XYZ(3)^(-1/2)=0
Where A,B,C,D,E,F,G,H,I,P1 and P2 are variables and X,Y and Z are the 3 unknowns to find.
I have tried using the function Fsolve with an m-file but the results were not good enough.
Is there any other function to solve this system ?????

#### 1 Comment

Walter Roberson on 6 May 2012

John D'Errico on 6 May 2012
- Did it not converge at all?
- Did it not converge to the solution you want to see? (After all, such a problem will have multiple solutions in general.)
- Did it not converge quickly enough for your needs?
- Was the solution obtained from fsolve not accurate enough for you?
- Do you need a symbolic solution?
The point is, some of these issues can be viewed as merely one of inadequate starting values. Or, you may want a global solver. There is a global optimization toolbox.) Or you may be looking for ALL possible solutions.
And of course, it is likely that no symbolic solution exists, since the problem will be equivalent to solving for the roots of a high order polynomial.
So for a better answer, we need some help here.

kamal kiki on 7 May 2012
I am using Fsolve in a simumlink "MATLAB Function" block: the inputs to this block are the values of A,B,C,D,E,F,G,H,I,P1 and P2 which are varying with time and the outputs of this block are the values of the results X,Y and Z which are also varying with time.
So for for a value of the guess=[x y z]=[23.491 1.3*10^5 660],while A,B,C,D,E,F,G,H,I,P1 and P2 are varying with time the solution [x y z] is varying from:[x y z]=[33.7 1.307*10^5 621] to [x y z]=[117.9 1.368*10^5 665.8](I am suspicious about the result of y because it is varying just slightly and it stays stuck to the value of the guess of y).
The m-file that I have used with the Fsolve function is the following:
function F = mydiesel(XYZ,A,B,C,D,E,F,G,H,I,P1,P2)
F = [XYZ(1)-A*(B*XYZ(2)^P1-C*XYZ(2)^P2)^(1/2);XYZ(1)*F+G-XYZ(1)*XYZ(3)*H-I*XYZ(3);XYZ(1)+E-D*XYZ(2)*XYZ(3)^(-1/2)]
In the command window I keep having the message: Maximum number of function evaluations reached as you can see below in the output that I am receiving on the command window.
F =
1.0e+007 *
-0.0000
4.1446
-0.0000
F =
1.0e+007 *
-0.0000
4.1446
-0.0000
F =
1.0e+007 *
-0.0000
4.1446
-0.0000
F =
1.0e+007 *
-0.0000
4.1446
-0.0000
F =
1.0e+007 *
-0.0000
4.1014
-0.0000
F =
1.0e+007 *
-0.0000
4.1014
-0.0000
F =
1.0e+007 *
-0.0000
4.1014
-0.0000
F =
1.0e+007 *
-0.0000
4.1014
-0.0000
F =
1.0e+007 *
-0.0000
3.9933
-0.0000
F =
1.0e+007 *
-0.0000
3.9933
-0.0000
F =
1.0e+007 *
-0.0000
3.9933
-0.0000
F =
1.0e+007 *
-0.0000
3.9933
-0.0000
F =
1.0e+007 *
-0.0000
3.7228
-0.0000
F =
1.0e+007 *
-0.0000
3.7228
-0.0000
F =
1.0e+007 *
-0.0000
3.7228
-0.0000
F =
1.0e+007 *
-0.0000
3.7228
-0.0000
F =
1.0e+007 *
-0.0000
3.0430
-0.0000
F =
1.0e+007 *
-0.0000
3.0430
-0.0000
F =
1.0e+007 *
-0.0000
3.0430
-0.0000
F =
1.0e+007 *
-0.0000
3.0430
-0.0000
F =
1.0e+007 *
-0.0000
1.3136
0.0000
F =
1.0e+007 *
-0.0000
1.3136
0.0000
F =
1.0e+007 *
-0.0000
1.3136
0.0000
F =
1.0e+007 *
-0.0000
1.3136
0.0000
F =
1.0e+005 *
-0.0008
-2.0254
0.0005
F =
1.0e+005 *
-0.0008
-2.0254
0.0005
F =
1.0e+005 *
-0.0008
-2.0254
0.0005
F =
1.0e+005 *
-0.0008
-2.0254
0.0005
F =
-77.2088
-156.1571
52.1883
F =
-77.2088
-156.9249
52.1883
F =
-77.2088
-156.1571
52.1883
F =
-77.2088
-157.4834
52.1883
F =
-77.0259
190.1107
52.0655
F =
-77.1638
11.8351
52.1574
F =
-77.1638
11.0673
52.1574
F =
-77.1638
11.8351
52.1574
F =
-77.1638
10.5085
52.1574
F =
-77.0494
73.9802
52.0807
F =
-77.1353
4.6260
52.1382
F =
-77.1353
3.8582
52.1382
F =
-77.1353
4.6260
52.1382
F =
-77.1353
3.2993
52.1382
F =
-77.1068
4.6088
52.1190
F =
-77.1068
3.8410
52.1190
F =
-77.1068
4.6088
52.1190
F =
-77.1068
3.2819
52.1190
F =
-77.0783
4.5936
52.0998
F =
-77.0783
3.8258
52.0998
F =
-77.0783
4.5936
52.0998
F =
-77.0783
3.2666
52.0998
F =
-77.0496
4.5787
52.0805
F =
-77.0496
3.8109
52.0805
F =
-77.0496
4.5787
52.0805
F =
-77.0496
3.2515
52.0805
F =
-77.0209
4.5630
52.0611
F =
-77.0209
3.7952
52.0611
F =
-77.0209
4.5630
52.0611
F =
-77.0209
3.2357
52.0611
F =
-76.9922
4.5478
52.0417
F =
-76.9921
3.7800
52.0417
F =
-76.9922
4.5478
52.0417
F =
-76.9922
3.2204
52.0417
F =
-76.9633
4.5332
52.0223
F =
-76.9633
3.7654
52.0223
F =
-76.9633
4.5332
52.0223
F =
-76.9633
3.2056
52.0223
F =
-76.9344
4.5182
52.0028
F =
-76.9344
3.7504
52.0028
F =
-76.9344
4.5182
52.0028
F =
-76.9344
3.1904
52.0028
F =
-76.9054
4.5029
51.9832
F =
-76.9054
3.7350
51.9832
F =
-76.9054
4.5029
51.9832
F =
-76.9054
3.1749
51.9832
F =
-76.8764
4.4881
51.9637
F =
-76.8764
3.7202
51.9637
F =
-76.8764
4.4881
51.9637
F =
-76.8764
3.1600
51.9637
F =
-76.8473
4.4731
51.9440
F =
-76.8473
3.7052
51.9440
F =
-76.8473
4.4731
51.9440
F =
-76.8473
3.1448
51.9440
F =
-76.8181
4.4581
51.9244
F =
-76.8181
3.6902
51.9244
F =
-76.8181
4.4581
51.9244
F =
-76.8181
3.1296
51.9244
F =
-76.7888
4.4432
51.9046
F =
-76.7888
3.6754
51.9046
F =
-76.7888
4.4432
51.9046
F =
-76.7888
3.1146
51.9046
F =
-76.7595
4.4285
51.8849
F =
-76.7595
3.6606
51.8849
F =
-76.7595
4.4285
51.8849
F =
-76.7595
3.0997
51.8849
F =
-76.7301
4.4144
51.8651
F =
-76.7301
3.6465
51.8651
F =
-76.7301
4.4144
51.8651
F =
-76.7301
3.0855
51.8651
F =
-76.7007
4.3988
51.8452
F =
-76.7007
3.6309
51.8452
F =
-76.7007
4.3988
51.8452
F =
-76.7007
3.0698
51.8452
F =
-76.6711
4.3839
51.8253
F =
-76.6711
3.6160
51.8253
F =
-76.6711
4.3839
51.8253
F =
-76.6711
3.0547
51.8253
F =
-76.6416
4.3695
51.8053
F =
-76.6415
3.6016
51.8053
F =
-76.6416
4.3695
51.8053
F =
-76.6416
3.0401
51.8053
F =
-76.6119
4.3545
51.7853
F =
-76.6119
3.5866
51.7853
F =
-76.6119
4.3545
51.7853
F =
-76.6119
3.0250
51.7853
F =
-76.5822
4.3405
51.7653
F =
-76.5822
3.5726
51.7653
F =
-76.5822
4.3405
51.7653
F =
-76.5822
3.0108
51.7653
F =
-76.5524
4.3258
51.7452
F =
-76.5524
3.5579
51.7452
F =
-76.5524
4.3258
51.7452
F =
-76.5524
2.9959
51.7452
F =
-76.5225
4.3109
51.7251
F =
-76.5225
3.5430
51.7251
F =
-76.5225
4.3109
51.7251
F =
-76.5225
2.9809
51.7251
F =
-76.4926
4.2968
51.7049
F =
-76.4926
3.5289
51.7049
F =
-76.4926
4.2968
51.7049
F =
-76.4926
2.9667
51.7049
F =
-76.4626
4.2822
51.6846
F =
-76.4626
3.5143
51.6846
F =
-76.4626
4.2822
51.6846
F =
-76.4626
2.9519
51.6846
F =
-76.4325
4.2675
51.6644
F =
-76.4325
3.4996
51.6644
F =
-76.4325
4.2675
51.6644
F =
-76.4325
2.9370
51.6644
F =
-76.4024
4.2528
51.6440
F =
-76.4024
3.4849
51.6440
F =
-76.4024
4.2528
51.6440
F =
-76.4024
2.9222
51.6440
F =
-76.3722
4.2380
51.6237
F =
-76.3722
3.4701
51.6237
F =
-76.3722
4.2380
51.6237
F =
-76.3722
2.9073
51.6237
F =
-76.3419
4.2242
51.6033
F =
-76.3419
3.4562
51.6033
F =
-76.3419
4.2242
51.6033
F =
-76.3419
2.8932
51.6033
F =
-76.3115
4.2100
51.5828
F =
-76.3115
3.4421
51.5828
F =
-76.3115
4.2100
51.5828
F =
-76.3115
2.8790
51.5828
F =
-76.2811
4.1956
51.5623
F =
-76.2811
3.4277
51.5623
F =
-76.2811
4.1956
51.5623
F =
-76.2811
2.8644
51.5623
F =
-76.2506
4.1814
51.5417
F =
-76.2506
3.4135
51.5417
F =
-76.2506
4.1814
51.5417
F =
-76.2506
2.8501
51.5417
F =
-76.2201
4.1671
51.5211
F =
-76.2201
3.3992
51.5211
F =
-76.2201
4.1671
51.5211
F =
-76.2201
2.8356
51.5211
F =
-76.1895
4.1530
51.5005
F =
-76.1895
3.3850
51.5005
F =
-76.1895
4.1530
51.5005
F =
-76.1895
2.8213
51.5005
F =
-76.1588
4.1390
51.4798
F =
-76.1588
3.3711
51.4798
F =
-76.1588
4.1390
51.4798
F =
-76.1588
2.8072
51.4798
F =
-76.1281
4.1249
51.4591
F =
-76.1281
3.3570
51.4591
F =
-76.1281
4.1249
51.4591
F =
-76.1281
2.7929
51.4591
F =
-76.0972
4.1103
51.4383
F =
-76.0972
3.3424
51.4383
F =
-76.0972
4.1103
51.4383
F =
-76.0972
2.7782
51.4383
F =
-76.0663
4.0965
51.4175
F =
-76.0663
3.3285
51.4175
F =
-76.0663
4.0965
51.4175
F =
-76.0663
2.7642
51.4175
F =
-76.0354
4.0824
51.3966
F =
-76.0354
3.3144
51.3966
F =
-76.0354
4.0824
51.3966
F =
-76.0354
2.7499
51.3966
F =
-76.0044
4.0684
51.3757
F =
-76.0044
3.3004
51.3757
F =
-76.0044
4.0684
51.3757
F =
-76.0044
2.7358
51.3757
F =
-75.9733
4.0541
51.3547
F =
-75.9733
3.2861
51.3547
F =
-75.9733
4.0541
51.3547
F =
-75.9733
2.7213
51.3547
F =
-75.9421
4.0409
51.3337
F =
-75.9421
3.2729
51.3337
F =
-75.9421
4.0409
51.3337
F =
-75.9421
2.7080
51.3337
F =
-75.9109
4.0266
51.3126
F =
-75.9109
3.2586
51.3126
F =
-75.9109
4.0266
51.3126
F =
-75.9109
2.6935
51.3126
F =
-75.8796
4.0125
51.2915
F =
-75.8796
3.2444
51.2915
F =
-75.8796
4.0125
51.2915
F =
-75.8796
2.6792
51.2915
F =
-75.8482
3.9991
51.2704
F =
-75.8482
3.2311
51.2704
F =
-75.8482
3.9991
51.2704
F =
-75.8482
2.6657
51.2704
F =
-75.8168
3.9849
51.2492
F =
-75.8168
3.2169
51.2492
F =
-75.8168
3.9849
51.2492
F =
-75.8168
2.6514
51.2492
F =
-75.7853
3.9710
51.2279
F =
-75.7853
3.2029
51.2279
F =
-75.7853
3.9710
51.2279
F =
-75.7853
2.6373
51.2279
F =
-75.7537
3.9574
51.2066
F =
-75.7537
3.1893
51.2066
F =
-75.7537
3.9574
51.2066
F =
-75.7537
2.6236
51.2066
F =
-75.7221
3.9440
51.1853
F =
-75.7221
3.1760
51.1853
F =
-75.7221
3.9440
51.1853
F =
-75.7221
2.6101
51.1853
F =
-75.6904
3.9304
51.1639
F =
-75.6904
3.1623
51.1639
F =
-75.6904
3.9304
51.1639
F =
-75.6904
2.5962
51.1639
F =
-75.6586
3.9160
51.1425
F =
-75.6586
3.1479
51.1425
F =
-75.6586
3.9160
51.1425
F =
-75.6586
2.5817
51.1425
F =
-75.6268
3.9028
51.1210
F =
-75.6268
3.1347
51.1210
F =
-75.6268
3.9028
51.1210
F =
-75.6268
2.5684
51.1210
F =
-75.5949
3.8891
51.0995
F =
-75.5949
3.1211
51.0995
F =
-75.5949
3.8891
51.0995
F =
-75.5949
2.5546
51.0995
F =
-75.5629
3.8756
51.0779
F =
-75.5629
3.1075
51.0779
F =
-75.5629
3.8756
51.0779
F =
-75.5629
2.5408
51.0779
F =
-75.5308
3.8623
51.0563
F =
-75.5308
3.0943
51.0563
F =
-75.5308
3.8623
51.0563
F =
-75.5308
2.5275
51.0563
F =
-75.4987
3.8484
51.0347
F =
-75.4987
3.0803
51.0347
F =
-75.4987
3.8484
51.0346
F =
-75.4987
2.5134
51.0347
F =
-75.4666
3.8355
51.0129
F =
-75.4666
3.0674
51.0129
F =
-75.4666
3.8355
51.0129
F =
-75.4666
2.5003
51.0129
F =
-75.4343
3.8213
50.9912
F =
-75.4343
3.0532
50.9912
F =
-75.4343
3.8213
50.9912
F =
-75.4343
2.4860
50.9912
F =
-75.4020
3.8083
50.9694
F =
-75.4020
3.0402
50.9694
F =
-75.4020
3.8083
50.9694
F =
-75.4020
2.4728
50.9694
F =
-75.3696
3.7952
50.9476
F =
-75.3696
3.0271
50.9476
F =
-75.3696
3.7952
50.9476
F =
-75.3696
2.4596
50.9476
F =
-75.3371
3.7814
50.9257
F =
-75.3371
3.0133
50.9257
F =
-75.3371
3.7814
50.9257
F =
-75.3371
2.4457
50.9257
F =
-75.3046
3.7681
50.9037
F =
-75.3046
3.0000
50.9037
F =
-75.3046
3.7681
50.9037
F =
-75.3046
2.4322
50.9037
F =
-75.2720
3.7550
50.8817
F =
-75.2720
2.9869
50.8818
F =
-75.2720
3.7550
50.8817
F =
-75.2720
2.4190
50.8817
F =
-75.2394
3.7417
50.8597
F =
-75.2394
2.9736
50.8597
F =
-75.2394
3.7417
50.8597
F =
-75.2394
2.4055
50.8597
F =
-75.2067
3.7283
50.8376
F =
-75.2067
2.9601
50.8377
F =
-75.2067
3.7283
50.8376
F =
-75.2067
2.3919
50.8376
F =
-75.1739
3.7153
50.8155
F =
-75.1739
2.9471
50.8155
F =
-75.1739
3.7153
50.8155
F =
-75.1739
2.3788
50.8155
F =
-75.1410
3.7020
50.7934
F =
-75.1410
2.9338
50.7934
F =
-75.1410
3.7020
50.7934
F =
-75.1410
2.3653
50.7934
Maximum number of function evaluations reached:
increase options.MaxFunEvals.
>>
Geoff on 7 May 2012
My guess is that you're not using fsolve correctly. Is your function set up to return a small value when delivered the correct solution? Have you looked at the help for fsolve and optimset to see how to increase MaxFunEvals?
kamal kiki on 7 May 2012
I have increased MaxFunEvals but I am still having the message Maximum number of function evaluations reached.
I do not know how to set up the function to return a small value when delivered the correct solution.

Walter Roberson on 7 May 2012
Discussion of this topic should take place in your original Question that this is a duplicate of, http://www.mathworks.com/matlabcentral/answers/37287-is-there-any-function-other-than-fsolve-to-solve-systems-of-nonlinear-equations . Discussion here splits efforts, confuses people, and makes more work for the staff to merge the questions together.

### Community Treasure Hunt

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

Start Hunting!

Translated by