What are solver best settings for my non linear equations?
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a set of non-linear equations that I would like to solve using fsolve, shown below in WandG function. Solver solutions are far away from the ones I would expect, I am expecting something alike x(1) = 10 and x(2)=0.11. Therefore, I would be glad if someone could give me some better directions of how to set up the options, especially tolerances, of the solver.
So far, I am reading this matlab documentation and I think that I may have to rewrite my equations with a better scaling but I am not sure whether or not this will be sufficient.
Thanks in advance
% configuration of fsolve
options = optimoptions('fsolve','Display','iter-detailed','PlotFcn',@optimplotfirstorderopt);
options.StepTolerance = 1e-14;
%options.OptimalityTolerance = 1e-14
options.FunctionTolerance = 1e-14;
options.MaxIterations = 100000;
options.MaxFunctionEvaluations = 400;
options.Algorithm = 'levenberg-marquardt';%'levenberg-marquardt';%'trust-region'%
fun= @WandG;
x0 = [5.0000e+00;5.5366e-03];
% Solve the function fun
gw =fsolve(fun,x0,options);
% Function to be solved by fsolve
function F = WandG(x)
F(:,1) = ((((x(:,2)./10).*0.1).*(x(:,1)./100)).^2).*(8.9856e+01) +(( 7e-11 .* ( x(:,1)./100 ) ).^2).*( 1.7040e+08.^2.*(8.9856e+01) ) - (((x(:,2)./10).*0.1).*(x(:,1)./100));
F(:,2) = ((((x(:,2)./10).*0.1).*(x(:,1)./100)).^2).*( 8.0640e+00 - 1.7040e+08.*1.1e-7 * (1-x(:,1)./200) ) + (((x(:,1)./100).*7e-11).^2).*( 1.7040e+08.^2*(8.0640e+00 - 1.7040e+08*1.1e-7 .* (1-x(:,1)./200)) ) + 1.7040e+08.*(7e-11.*(x(:,1)./100) );
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Nonlinear Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!