Path: news.mathworks.com!not-for-mail
From: "Stuart Kozola" <skozola@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to use optimisation tools in Matlab
Date: Wed, 19 Nov 2008 12:26:51 -0500
Organization: The MathWorks, Inc.
Lines: 49
Message-ID: <gg1i8t$pl2$1@fred.mathworks.com>
References: <gg1cbq$9gm$1@fred.mathworks.com>
Reply-To: "Stuart Kozola" <skozola@mathworks.com>
NNTP-Posting-Host: kozolas.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1227115613 26274 172.31.57.172 (19 Nov 2008 17:26:53 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 19 Nov 2008 17:26:53 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:501772


Your function F should return the value of CL.  Then you can use 
fgoalattain.

Try this:
x0 = 0; % intial guess at theta, 0 may not be the best choice
weight = 1.0; %With only one goal, this should be set to 1.0.
CLGOAL = %put your goal value here

optimCL = fgoalattain(@F,x0,CLGOAL,weight);

Note you need to pass the function F in as a function handle (@F)
And your F function should be defined to return CL, and only accept x, or in 
this case, theta as inputs.

function CL = F(theta)
% run simulation
% return CL

Stu



"Matthew " <men5mjr@leeds.ac.uk> wrote in message 
news:gg1cbq$9gm$1@fred.mathworks.com...
>i am trying to optimise the CL value of an aerofoil by varing a rotation 
>angle theta
>
> theta is fed into a function i will call 'F' to firstly rotate the 
> co-ordinate points of an aerofoil
>
> this aerofoil data is then fed into an external programme by 'F'
>
> the data from the external programme is then called back into my function 
> 'F'
>
> this data is then plotted by 'F'
>
> what i am having problems with is using an optimisation technique such as 
> fgoalattain (x=fgoalattain(fun,x0,goal....) or fminimax to have the 
> variable 'x' as theta, but the 'goal' to be finding the correct CL value 
> from my function 'F'.
>
> what i ultimately want to do is input a Cl value and the optimiser to vary 
> theta until my Cl input value is met.
>
> i have been pouring over this now for 2 weeks
> and i am pulling my hair out.