Error in fsolve r2014b

4 views (last 30 days)
Kasper
Kasper on 27 Nov 2014
Edited: John D'Errico on 27 Nov 2014
I try to use the fsolve command in a MATLAB code, and when i run it i get the following message:
Undefined function 'fsolve' for input arguments of type 'char'.
Error in Steam_func (line 39) res = fsolve('sft2_NC',x0)
I am using the MATLAB R2014b version on a MAC.
I have tried to run the code on another computer with R2013a installed, and here it works fine.
Do anyone know this problem?

Answers (1)

Geoff Hayes
Geoff Hayes on 27 Nov 2014
Kasper - please verify that you have the Optimization Toolbox on this version of MATLAB by typing ver in the Command Window or which fsolve -all. The former will return your version of MATLAB and all installed toolboxes, while the latter will return the location of any functions that match fsolve.
If you do have access to this function, try changing the first input from a string to a function handle instead. So your code would become
fsolve(@sft2_NC,x0)
  2 Comments
Kasper
Kasper on 27 Nov 2014
When i type ver i get:
MATLAB Version: 8.4.0.150421 (R2014b) MATLAB License Number: •••••• Operating System: Mac OS X Version: 10.10.1 Build: 14B25 Java Version: Java 1.7.0_55-b13 with Oracle Corporation Java HotSpot™ 64-Bit Server VM mixed mode ---------------------------------------------------------------------------------------------------- MATLAB Version 8.4 (R2014b) MATLAB Coder Version 2.7 (R2014b) MATLAB Compiler Version 5.2 (R2014b) MATLAB Report Generator Version 4.0 (R2014b)
And which fsolve -all: 'fsolve' not found.
So it my look like i haven't the Optimization Toolbox installed?
John D'Errico
John D'Errico on 27 Nov 2014
Edited: John D'Errico on 27 Nov 2014
Indeed, you do not have that TB installed. Check your license online at TMW to see if you have bought that toolbox. If not, you either need to buy the optimization toolbox, or accept that you cannot use what you don't own. There are tools on the file exchange. Of course, sometimes you get what you pay for. And most of what you will find on the file exchange for this purpose are pretty simple Newton's method tools, many of which will require you to provide the gradient yourself.

Sign in to comment.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!