Is it possible to use 'trust-region' algorithm for the fsolve function inside a Simulink model?
2 次查看(过去 30 天)
显示 更早的评论
I have a simulink model that contains a MATLAB function block. This matlab function block recalls the function fsolve, the optimization options chosen for the fsolve function are as follow:
options = optimoptions('fsolve','Display','none','Algorithm','levenberg-marquardt');
[S,fval,exit,output] = fsolve(f,S_0,options);
This works fine but i want to use for the algorithm value 'trust-region' instead of 'levenberg-marquardt', because it gives results that are more precise:
options = optimoptions('fsolve','Display','none','Algorithm','trust-region');
Trying to run my model in simulink with this line of code gives me this error:
OPTIMOPTIONS property 'Algorithm' must be one of the following values for fsolve:
'levenberg-marquardt'
Function 'resolve_S2.m' (#574.167.233), line 4, column 11: "optimoptions('fsolve','Display','none','Algorithm','trust-region')"
I should say that the MATLAB code works when not connected to the simulink environment with both options for the algorithm value, it only stops working when using the 'trust-region' option in simulink.
Is there a way to have the 'trust-region' option accepted by the simulink environment?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Manual Performance Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!