"Volker K" <klinkv.NOSPAM@yahoo.de> wrote in message
<fjrif3$adh$1@fred.mathworks.com>...
> Hi all!
>
> I'm working with the optmization toolbox for the first time
> and I'm having some trouble.
> I would like to find the minimum of this function:
>
> sum(sqrt(x1-x2+dx).^2+(y1-y2+dy).^2))
>
> x1,2 and y1,2 are known row vectors, dx and dy are unknown.
>
> dx and dy should be scalars.
>
> I read some stuff about eg. "fminunc" but it doesnt tell you
> how pass known arguments (in this case x1,2 and y1,2) over
> and only return dx and dy.
>
> I hope I explained my problem properly.
Use an anonymous function.
fun = @(dxdy) sum(sqrt(x1-x2+dxdy(1)).^2+(y1-y2+dxdy(2)).^2))
HTH,
John
Subject: Optimization of function with known and unknown variables
"Volker K" <klinkv.NOSPAM@yahoo.de> wrote in message
news:fjrif3$adh$1@fred.mathworks.com...
> Hi all!
>
> I'm working with the optmization toolbox for the first time
> and I'm having some trouble.
> I would like to find the minimum of this function:
>
> sum(sqrt(x1-x2+dx).^2+(y1-y2+dy).^2))
That looks an awful lot like you're trying to fit a circle to data. If
that's what you're doing, I believe there are some submissions on the File
Exchange to do that.
> x1,2 and y1,2 are known row vectors, dx and dy are unknown.
>
> dx and dy should be scalars.
>
> I read some stuff about eg. "fminunc" but it doesnt tell you
> how pass known arguments (in this case x1,2 and y1,2) over
> and only return dx and dy.
Question 4.13 in the FAQ deals with passing additional parameters to
"function functions" like FMINUNC.
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Disclaimer prior to use.