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: Maximize function with fminsearch
Replies: 2   Last Post: May 2, 2012 6:35 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Torsten

Posts: 1,459
Registered: 11/8/10
Re: Maximize function with fminsearch
Posted: May 2, 2012 5:44 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 2 Mai, 09:30, "Francesco Perrone" <francesco86perr...@yahoo.it>
wrote:
> Good Morning everybody,
>
> I have a pretty straight-forward question: within my daily work, I have got to maximize a particular function making use of fminsearch; the code is this
>
>  clc
>  clear all
>  close all
>
>  f = @(x,c,k) -(x(2)/c)^3*(((exp(-(x(1)/c)^k)-exp(-(x(2)/c)^k))/((x(2)/c)^k-(x(1)/c)^k))-­exp(-(x(3)/c)^k))^2;
>  c = 10.1;
>  k = 2.3;
>  X = fminsearch(@(x) f(x,c,k),[4,10,20]);
>
> It works fine, as I expect, but not the issue is coming up: I need to bound x within certain limits, as:
>   4 < x(1) < 5
>  10 < x(2) < 15
> 20 < x(3) < 30
>
> To achieve the proper results, I should use the optimization toolbox, that I unfortunately cannot hand.
>
> Is there any way to get the same analysis by making use of only fminsearch?
>
> I thank you in advance.
>
> Best regards,
> Francesco


Sure.
In your objective function, replace x(1) by 4.5+0.5*sin(x(1)), x(2) by
12.5+2.5*sin(x(2)) and x(3) by 25+5*sin(x(3)).

Best wishes
Torsten.



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.