Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Constrained non linear system, fmincon: User supplied objective
Replies: 1   Last Post: Feb 12, 2013 2:34 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Alan Weiss

Posts: 1,261
Registered: 11/27/08
Re: Constrained non linear system, fmincon: User supplied objective
Posted: Feb 12, 2013 2:34 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 2/12/2013 2:09 PM, Pl Pl wrote:
> Alan_Weiss <aweiss@mathworks.com> wrote in message
>> Your function llgfix returns a three-element vector instead of a
>> scalar. The objective function for fmincon must be a scalar, just as
>> the error message states.
>>
>> Alan Weiss
>> MATLAB mathematical toolbox documentation

>
> Oh of course, thank you Alan! But then, how can I solve this system
> with the unit-sphere constraint..?


Well, you could add the squares of dm. I mean,

function dm = llgfix(t,m,param)
dm = zeros(3,1);

dm(1) = f1(m(1),m(2),m(3));
dm(2) = f2(m(1),m(2),m(3));
dm(3) = f3(m(1),m(2),m(3));
% And here is the change:
dm = sum(dm.^2);
end

This will have fmincon try to minimize the sum of squares of the vector
field, which should give you the solution you seek.

If it fails, then start at a different point. And I suggest you set the
fmincon algorithm to interior-point.

Good luck,

Alan Weiss
MATLAB mathematical toolbox documentation



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.