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

Walter Roberson
Walter Roberson 2019년 12월 3일
I speculate that you might not have installed the Optimization Toolbox.
MP
MP 2019년 12월 5일
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