MATLAB: Some of the values of the estimated parameters do not conform

values

I am try to optimize this system of nonlinear equations which I wrote on the editor as;
function F = myfun (x)
F = [5-x(1)*(6^x(2)*exp(6*x(3))+12^x(2)*exp(12*x(3))+18^x(2)*exp(18*x(3))+24^x(2)*exp(24*x(3))+30^x(2)*exp(30*x(3)))-2*x(1)*x(4)*(6^x(2)*exp(-x(1)*6^x(2)*exp(6*x(3))+(6*x(3)))*(1-x(4)*exp(-x(1)*6^x(2)*exp(6*x(3))))^(-1)+12^x(2)*exp(-x(1)*12^x(2)*exp(12*x(3))+(12*x(3)))*(1-x(4)*exp(-x(1)*12^x(2)*exp(12*x(3))))^(-1)+18^x(2)*exp(-x(1)*18^x(2)*exp(18*x(3))+(18*x(3)))*(1-x(4)*exp(-x(1)*18^x(2)*exp(18*x(3))))^(-1)+24^x(2)*exp(-x(1)*24^x(2)*exp(24*x(3))+(24*x(3)))*(1-x(4)*exp(-x(1)*24^x(2)*exp(24*x(3))))^(-1)+30^x(2)*exp(-x(1)*30^x(2)*exp(30*x(3))+(30*x(3)))*(1-x(4)*exp(-x(1)*30^x(2)*exp(30*x(3))))^(-1)); (log(6)+log(12)+log(18)+log(24)+log(30))+((x(2)+6*x(3))^(-1)+(x(2)+12*x(3))^(-1)+(x(2)+18*x(3))^(-1)+(x(2)+24*x(3))^(-1)+(x(2)+30*x(3))^(-1))-x(1)*(6^x(2)*exp(6*x(3))*log(6)+12^x(2)*exp(12*x(3))*log(12)+18^x(2)*exp(18*x(3))*log(18)+24^x(2)*exp(24*x(3))*log(24)+30^x(2)*exp(30*x(3))*log(30))-2*x(2)*x(4)*(6^x(2)*exp(-x(1)*6^x(2)*exp(6*x(3))+(6*x(3)))*log(6)*(1-x(4)*exp(-x(1)*6^x(2)*exp(6*x(3))))^(-1)+12^x(2)*exp(-x(1)*12^x(2)*exp(12*x(3))+(12*x(3)))*log(12)*(1-x(4)*exp(-x(1)*12^x(2)*exp(12*x(3))))^(-1)+18^x(2)*exp(-x(1)*18^x(2)*exp(18*x(3))+(18*x(3)))*log(18)*(1-x(4)*exp(-x(1)*18^x(2)*exp(18*x(3))))^(-1)+24^x(2)*exp(-x(1)*24^x(2)*exp(24*x(3))+(24*x(3)))*log(24)*(1-x(4)*exp(-x(1)*24^x(2)*exp(24*x(3))))^(-1)+30^x(2)*exp(-x(1)*30^x(2)*exp(30*x(3))+(30*x(3)))*log(30)*(1-x(4)*exp(-x(1)*30^x(2)*exp(30*x(3))))^(-1)); (6*(x(2)+6*x(3))^(-1)+12*(x(2)+12*x(3))^(-1)+18*(x(2)+18*x(3))^(-1)+24*(x(2)+24*x(3))^(-1)+30*(x(2)+30*x(3))^(-1))-x(1)*(6^(x(2)+1)*exp(6*x(3))+12^(x(2)+1)*exp(12*x(3))+18^(x(2)+1)*exp(18*x(3))+24^(x(2)+1)*exp(24*x(3))+30^(x(2)+1)*exp(30*x(3)))-(6+12+18+24+30)-2*x(1)*x(4)*(6^(x(2)+1)*exp(-x(1)*6^x(2)*exp(6*x(3))+(6*x(3)))*(1-x(4)*exp(-x(1)*6^x(2)*exp(6*x(3))))^(-1)+12^(x(2)+1)*exp(-x(1)*12^x(2)*exp(12*x(3))+(12*x(3)))*(1-x(4)*exp(-x(1)*12^x(2)*exp(12*x(3))))^(-1)+18^(x(2)+1)*exp(-x(1)*18^x(2)*exp(18*x(3))+(18*x(3)))*(1-x(4)*exp(-x(1)*18^x(2)*exp(18*x(3))))^(-1)+24^(x(2)+1)*exp(-x(1)*24^x(2)*exp(24*x(3))+(24*x(3)))*(1-x(4)*exp(-x(1)*24^x(2)*exp(24*x(3))))^(-1)+30^(x(2)+1)*exp(-x(1)*30^x(2)*exp(30*x(3))+(30*x(3)))*(1-x(4)*exp(-x(1)*30^x(2)*exp(30*x(3))))^(-1)); 5*(1-x(4))^(-1)-2*(exp(-x(1)*6^x(2)*exp(6*x(3)))*(1-x(4)*exp(-x(1)*6^x(2)*exp(6*x(3))))^(-1)+exp(-x(1)*12^x(2)*exp(12*x(3)))*(1-x(4)*exp(-x(1)*12^x(2)*exp(12*x(3))))^(-1)+exp(-x(1)*18^x(2)*exp(18*x(3)))*(1-x(4)*exp(-x(1)*18^x(2)*exp(18*x(3))))^(-1)+exp(-x(1)*24^x(2)*exp(24*x(3)))*(1-x(4)*exp(-x(1)*24^x(2)*exp(24*x(3))))^(-1)+exp(-x(1)*30^x(2)*exp(30*x(3)))*(1-x(4)*exp(-x(1)*30^x(2)*exp(30*x(3))))^(-1))];
Then on the command window, I wrote the following;
x0 = [0.2;0.0002;0.0002;0.00015];% Make a starting guess at the solution
options = optimset ('Display', 'iter');% Option to display output
[x, fval] = fsolve(@ myfun, x0, options)% Call optimizer
The output I got is;
Norm of First-order Trust-region
Iteration Func-count f(x) step optimality radius
0 5 5.3979e+008 2.53e+012 1
1 10 1.31841e+008 0.939736 3.15e+011 1
2 15 3.31473e+007 0.571025 4.03e+010 1
3 20 7.93185e+006 0.149714 5.13e+009 1
4 25 1.88669e+006 0.193604 6.88e+008 1
5 30 402793 0.784283 9.53e+007 1
6 35 74592.2 0.643981 1.46e+007 1
7 40 6957.78 1 2.1e+006 1
8 41 6957.78 2.5 2.1e+006 2.5
9 46 5000.79 0.625 1.5e+006 0.625
10 51 66.1601 0.625 1.43e+005 0.625
11 52 66.1601 1.5625 1.43e+005 1.56
12 57 3.77601 0.390625 2.28e+004 0.391
13 58 3.77601 0.976562 2.28e+004 0.977
14 63 2.03707 0.244141 8.23e+003 0.244
15 68 1.71988 0.244141 7.71e+003 0.244
16 73 1.45128 0.244141 6.82e+003 0.244
17 78 1.23647 0.244141 6.04e+003 0.244
18 83 1.06229 0.244141 5.36e+003 0.244
19 88 0.919374 0.244141 4.76e+003 0.244
20 93 0.800762 0.244141 4.23e+003 0.244
21 98 0.701267 0.244141 3.77e+003 0.244
22 103 0.616995 0.244141 3.37e+003 0.244
23 108 0.544989 0.244141 3.01e+003 0.244
24 113 0.482979 0.244141 2.7e+003 0.244
25 118 0.429199 0.244141 2.41e+003 0.244
26 123 0.382263 0.244141 2.17e+003 0.244
27 128 0.341066 0.244141 1.94e+003 0.244
28 133 0.304723 0.244141 1.75e+003 0.244
29 138 0.272515 0.244141 1.57e+003 0.244
30 143 0.243854 0.244141 1.41e+003 0.244
31 148 0.218256 0.244141 1.27e+003 0.244
32 153 0.195318 0.244141 1.14e+003 0.244
33 158 0.174701 0.244141 1.03e+003 0.244
34 163 0.156123 0.244141 922 0.244
35 168 0.139343 0.244141 830 0.244
36 173 0.124156 0.244141 748 0.244
37 178 0.110385 0.244141 674 0.244
38 183 0.097881 0.244141 607 0.244
39 188 0.0865129 0.244141 548 0.244
40 193 0.0761683 0.244141 496 0.244
41 198 0.0667494 0.244141 449 0.244
42 203 0.0581714 0.244141 408 0.244
43 208 0.0503606 0.244141 372 0.244
44 213 0.0432528 0.244141 342 0.244
45 218 0.0367926 0.244141 316 0.244
46 223 0.0309326 0.244141 294 0.244
47 228 0.0256321 0.244141 278 0.244
48 233 0.0208576 0.244141 266 0.244
49 238 0.0165818 0.244141 259 0.244
50 243 0.0127843 0.244141 257 0.244
51 248 0.00945222 0.244141 261 0.244
52 253 0.00658082 0.244141 272 0.244
53 258 0.00417637 0.244141 290 0.244
54 263 0.0022604 0.244141 320 0.244
55 268 0.000880068 0.244141 364 0.244
56 273 0.000140147 0.244141 433 0.244
57 278 6.62466e-007 0.0652966 42.2 0.244
58 283 2.36175e-014 7.1433e-005 0.00804 0.244
59 288 1.63177e-023 3.4157e-008 2.14e-007 0.244
Optimization terminated: first-order optimality is less than options.TolFun.
x =
2.0909
-0.5152
0.0909
-13.4163
fval =
1.0e-011 *
0.0009
-0.0696
-0.3979
-0.0000
This differs from the condition imposed; x(1)>0,x(2)>0,x(3)>0,x(4)>0.
Please, i need help on my initial values that can actualized this imposed condition. Thank you.

Best Answer

The fsolve function does not accept constraints. Use fmincon.