|
"sparky " <leoanish01@yahoo.com> wrote in message
news:jsoepa$qog$1@newscl01ah.mathworks.com...
> Hi,
> I am trying to use the optimization tool "fmincon".
> the syntax for the command is
>>> x=fmincon(@opt.m,x0,lb,ub)
Incorrect. There are two major problems with your attempt.
1) Specify the function as @opt; you don't use the extension when you call
the function normally, so you shouldn't use it when you define a function
handle to that function.
2) You can't simply leave out input arguments that you don't want to specify
and expect FMINCON to "figure it out." As stated in the help for FMINCON, if
you want to skip A, b, Aeq, and/or beq you need to specify them as [].
> now the function file "opt.m" has the definition as;
>>> function J=file(x0)
> a;b;
> J=a*b-x0;
>
> I am using the fmincon command from my base file "input.m"
> my problem is that to run the file "opt.m" I want to provide the values of
> "a" and "b" from "input.m".
> how can i do that, since in order to use the fmincon command on the file
> "opt.m", the only inputs i can send to "opt.m" is x0.
Bruno directed you to the correct documentation page that answers this
question.
--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com
|