# numerical solution of equations

1 view (last 30 days)
safi58 on 21 Jul 2017
Commented: Walter Roberson on 24 Jul 2017
% clc
clear all
L_r=2.4e-6;
L_m=11e-6;
C_r=1.3e-6;
R_L=533.33;
f_s=95e+3;
n=0.067;
V_in=20;
R_ac=n^2*R_L*8/pi^2;
f_r=1/(2*pi*(C_r*L_r)^0.5);
omega_r=1/((C_r*L_r)^0.5);
l=L_r/L_m;
%l=0.341;
Z_0=(L_r/C_r)^0.5;
Q=Z_0/R_ac;
F=f_s/f_r;
den_M=(1+l-l/(F^2))^2+Q^2*(F-1/F)^2;
M=1/(den_M)^0.5;
R_0=(L_r/C_r)^0.5;
gama=pi/F;
r_L=R_L*n^2/R_0;
options=optimset('Display','on',...
'Algorithm','trust-region-reflective','LargeScale','off','MaxFunEvals',20000);
x0=[-1, -1, 0.001,1.3, M];
% Make a starting guess at the solution
func_CCM=@(x)myfun_CCM(x,l,F,r_L);
[x,fval] = fsolve(func_CCM,x0,options);
Can anyone please help me to solve these equations numerically? it seems that it is too sensitive to initial conditions.
Torsten on 21 Jul 2017
It's appended.
Best wishes
Torsten.

Walter Roberson on 21 Jul 2017
My tests suggest that there are an infinite number of solutions.
If I add in the constraint that x(1) and x(2) are both negative, the solution space becomes much cleaner, but it appears that there may be a line of solutions, with the line being straight in some combinations of parameters and curved in other combinations, and possibly circular in some combinations.
For future reference, the least-squares residue for the combination of expressions is
((18446744073709551616*17394581254853885892832513553193^(1/2))/236684080876592592551267357340200625 + sin(x3)*(1/x5 - x2 + 1) + x1*cos(x3))^2 + ((36893488147419103232*17394581254853885892832513553193^(1/2))/236684080876592592551267357340200625 + 2*sin(x3)*(1/x5 - x2 + 1) + 2*x1*cos(x3))^2 + (x1 + sin(x4 - (147573952589676412928*17394581254853885892832513553193^(1/2))/206560652401389894977386098444166875)*(1/x5 + cos(x3 - x4)*(x1*sin(x3) - cos(x3)*(1/x5 - x2 + 1) + 2) - sin(x3 - x4)*(sin(x3)*(1/x5 - x2 + 1) + x1*cos(x3))) + cos(x4 - (147573952589676412928*17394581254853885892832513553193^(1/2))/206560652401389894977386098444166875)*(cos(x3 - x4)*(sin(x3)*(1/x5 - x2 + 1) + x1*cos(x3)) + sin(x3 - x4)*(x1*sin(x3) - cos(x3)*(1/x5 - x2 + 1) + 2)))^2 + (x2 + cos(x4 - (147573952589676412928*17394581254853885892832513553193^(1/2))/206560652401389894977386098444166875)*(1/x5 + cos(x3 - x4)*(x1*sin(x3) - cos(x3)*(1/x5 - x2 + 1) + 2) - sin(x3 - x4)*(sin(x3)*(1/x5 - x2 + 1) + x1*cos(x3))) - sin(x4 - (147573952589676412928*17394581254853885892832513553193^(1/2))/206560652401389894977386098444166875)*(cos(x3 - x4)*(sin(x3)*(1/x5 - x2 + 1) + x1*cos(x3)) + sin(x3 - x4)*(x1*sin(x3) - cos(x3)*(1/x5 - x2 + 1) + 2)) - 1)^2 + ((4548824903*2046358809243513^(1/2)*3777893186295716^(1/2)*17394581254853885892832513553193^(1/2)*((944473296573929*(x4 - (147573952589676412928*17394581254853885892832513553193^(1/2))/206560652401389894977386098444166875)^2)/8657671885261016 + (944473296573929*(x3 - x4)^2)/8657671885261016 - x3*((944473296573929*x3)/4328835942630508 + sin(x3)*(1/x5 - x2 + 1) + x1*cos(x3)) - (x4 - (147573952589676412928*17394581254853885892832513553193^(1/2))/206560652401389894977386098444166875)*((944473296573929*x4)/4328835942630508 - (944473296573929*x3)/4328835942630508 + sin(x3)*(1/x5 - x2 + 1) + x1*cos(x3)) - (cos(x3 - x4) - 1)*(x1*sin(x3) - cos(x3)*(1/x5 - x2 + 1) + 2) - cos(x4 - (147573952589676412928*17394581254853885892832513553193^(1/2))/206560652401389894977386098444166875)*(1/x5 + cos(x3 - x4)*(x1*sin(x3) - cos(x3)*(1/x5 - x2 + 1) + 2) - sin(x3 - x4)*(sin(x3)*(1/x5 - x2 + 1) + x1*cos(x3))) - (sin(x3)*(1/x5 - x2 + 1) + x1*cos(x3))*(x3 - x4) + sin(x4 - (147573952589676412928*17394581254853885892832513553193^(1/2))/206560652401389894977386098444166875)*(cos(x3 - x4)*(sin(x3)*(1/x5 - x2 + 1) + x1*cos(x3)) + sin(x3 - x4)*(x1*sin(x3) - cos(x3)*(1/x5 - x2 + 1) + 2)) - (cos(x3) - 1)*(1/x5 - x2 + 1) + x1*sin(x3) + (944473296573929*x3^2)/8657671885261016 + sin(x3 - x4)*(sin(x3)*(1/x5 - x2 + 1) + x1*cos(x3))))/89202980794122488529539561397346631680000 + 1)^2
That is, the solutions to the equations are at the places where the value of the above expression is 0 to within round-off error.
The following points all have residues less than 1E-31:
-0.7893647991479240122 -0.07848194316452314356 0.2116665368024348848 3.368786592896710452 0.954455687562678956
-0.7342868372668747146 -0.1043149569124650483 0.1857827717154188485 3.316837355667334286 0.9590097329406017668
-0.7141410122343361255 -0.1132428863355284254 0.1763740381986312611 3.297941832531899209 0.960505275770085043
-0.7657521078494986533 -0.08981468491900718165 0.2005405401791646725 3.346462465130042752 0.9564920761787284453
-0.6545274048516261933 -0.1380641831582223866 0.1487093547457488951 3.242346378048229116 0.964406054329632112
-0.673402048965733524 -0.1304611011568412027 0.1574404088488735587 3.259898327875586421 0.9632551956473980326
-0.7885658988038088957 -0.07887175531296626574 0.2112893753354327664 3.368029973071825722 0.9545266613594469707
-0.6313265821814251222 -0.1470895072137880233 0.1380117592601543541 3.220833785484086498 0.9657149274626131152
-0.6340799795889885404 -0.1460367794731131375 0.1392793404585129791 3.223383279139203417 0.9655656647739427889
-0.7977538716778466155 -0.07436144836990092599 0.2156301412872833057 3.376737307572778235 0.9537015922654279443
-0.6203079422825569234 -0.1512530968793995567 0.132944372571758368 3.210640594577584217 0.9662959603635126182
-0.5891111202857871598 -0.1626167636765204483 0.1186422157795321286 3.181861714243269024 0.9678004153941159871
-0.7621971392857225247 -0.09148719120250312087 0.1988693214509161256 3.343108412113263928 0.9567877009437142366
-0.7573998274798614538 -0.09373029243595867865 0.1966156436224273385 3.338585071103084445 0.95718210886302868
-0.6759919663640672205 -0.1293994550296596602 0.1586404582852840583 3.262310353742346791 0.9630912213066177285
-0.5311255232197079623 -0.1820947997211517511 0.09222987957828468475 3.128677224820066716 0.9700512940513597027
-0.1718182982997054076 -0.2575868934821719525 -0.0671464685328081734 2.806722519066860766 0.9689597447593119028
-0.2916654246821250851 -0.2407989633614635028 -0.01472712274347974526 2.912811460171774502 0.9721115933024442324
-0.7412294326058586069 -0.101174132197184824 0.1890323645364604954 3.323362021083449136 0.95847335685781343
-0.06553453868040369501 -0.2656912380179828892 -0.1131059015254947397 2.71354224926287646 0.9639346742965682058
-0.757354024815799054 -0.0937516318148517297 0.1965941351824513905 3.338541899886751541 0.9571858494603404655
Notice there is a fair bit of variation in the parameters.
Residue as low as 1E-31 is essentially "magic" compared to the fact that most of your input coefficients only have two significant figures, with R_L being the stand-out at 5 significant figures. If we assume, for example, that L_r=2.4e-6 means L_r is in the range 2.4e-6 +/- 0.05E-6 then we should expect changes in the residue that are relatively large compared to these residues: the lines of solution would be expected to move noticeably.
##### 2 CommentsShowHide 1 older comment
Walter Roberson on 24 Jul 2017
I was just doing some cross-tests and noticed that with the residue I posted above, the derivative with respect to x1 or x5 (possibly others) has a singularity near x5 = 0; I will need to recheck that.