Having problem with @fsolve function

The following code worked properly in matlab2018b version; however, updating the new version matlab2019b, it does not work. Any advise?
% Options for solving the speed
opt = optimoptions(@fsolve, 'Display', 'none');
lam = @(wr) rt*wr/vw;
inv_lami = @(wr)1./(lam(wr) + 0.08*beta^2) - 0.035/(beta^3 + 1);
Cp = @(wr)0.22.*(116 .* inv_lami(wr) - 0.4*beta - 5).*exp(-12.5.*inv_lami(wr));
P = @(wr) 0.5*rho*A*Cp(wr)*vw^3;
Teq = @(wr) P(wr)./wr;
[wmaxP,Pmax] = fminbnd(@(wr) -P(wr), 0, 2.5);
[wmaxT,Tmax] = fminbnd(@(wr) -Teq(wr), 0, 2.5); Tmax = -Tmax;
wt0 = fsolve(Teq, 1.1*wmaxT, opt);
wts = linspace(0,wt0,10000);
An error occurs as follows:
Invalid solver specified. Provide a solver name or handle (such as 'fmincon' or @fminunc).
Type DOC OPTIMOPTIONS for a list of solvers.
Error in Untitled2 (line 37)
opt = optimoptions(@fsolve, 'Display', 'none');

2 个评论

I speculate that you might not have installed the Optimization Toolbox.
Thanks, now it works!

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Nonlinear Optimization 的更多信息

提问:

MP
2019-12-3

评论:

MP
2019-12-5

Community Treasure Hunt

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

Start Hunting!

Translated by