Having problem with @fsolve function
Show older comments
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 Comments
Walter Roberson
on 3 Dec 2019
I speculate that you might not have installed the Optimization Toolbox.
MP
on 5 Dec 2019
Answers (0)
Categories
Find more on Nonlinear Optimization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!