Thread Subject: Optimization of function with known and unknown variables

Subject: Optimization of function with known and unknown variables

From: Volker K

Date: 13 Dec, 2007 15:17:55

Message: 1 of 3

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.

Thanks a lot!
Volker

Subject: Optimization of function with known and unknown variables

From: John D'Errico

Date: 13 Dec, 2007 16:08:56

Message: 2 of 3

"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

From: Steven Lord

Date: 13 Dec, 2007 17:45:09

Message: 3 of 3


"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.

http://matlabwiki.mathworks.com/MATLAB_FAQ

--
Steve Lord
slord@mathworks.com


Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
known and unknown variables Volker Klink 13 Dec, 2007 10:20:30
optimization Volker Klink 13 Dec, 2007 10:20:29
rssFeed for this Thread

Public Submission Policy

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.

Contact us at files@mathworks.com