help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: function minimization


From: Ben Abbott
Subject: Re: function minimization
Date: Tue, 26 Jun 2012 14:48:38 -0400

On Jun 26, 2012, at 2:00 PM, Michael Teitelbaum wrote:

> Hi,
> I am on octave beginner, trying to minimize a function of 2 variables.  I 
> have the function ready, but I'm not sure where to go from here:
> 
> f = (A(4,4) * 1400 * A(4,3) / (A(4,3) + x) * y + 8 /1400 * (A(4,4) * 1400 * 
> A(4,3) / (A(4,3) + x) * y + A(3,4) * 1400 * A(3,3) / (A(3,3) + x) * y) / 2 - 
> A(3,4) * 1400 * A(3,3) / (A(3,3) + x) * y  - A(4,6)) ^ 2 + (A(5,4) * 1400 * 
> A(5,3) / (A(5,3) + x) * y + 8 /1400 * (A(5,4) * 1400 * A(5,3) / (A(5,3) + x) 
> * y + A(4,4) * 1400 * A(4,3) / (A(4,3) + x) * y) / 2 - A(4,4) * 1400 * A(4,3) 
> / (A(4,3) + x) * y - A(5,6)) ^ 2 
> 
> I want octave to find the x and y values that minimize f.  I looked in the 
> octave manual under "optimization" and found several options, but could not 
> figure out how to use them.
> 
> -Thanks

Sounds like you could use fsolve.

fun(z) = @(z) (A(4,4) * 1400 * A(4,3) / (A(4,3) + z(1)) * z(2) + 8 /1400 * 
(A(4,4) * 1400 * A(4,3) / (A(4,3) + z(1)) * z(2) + A(3,4) * 1400 * A(3,3) / 
(A(3,3) + z(1)) * z(2)) / 2 - A(3,4) * 1400 * A(3,3) / (A(3,3) + z(1)) * z(2)  
- A(4,6)) ^ 2 + (A(5,4) * 1400 * A(5,3) / (A(5,3) + z(1)) * z(2) + 8 /1400 * 
(A(5,4) * 1400 * A(5,3) / (A(5,3) + z(1)) * z(2) + A(4,4) * 1400 * A(4,3) / 
(A(4,3) + z(1)) * z(2)) / 2 - A(4,4) * 1400 * A(4,3) / (A(4,3) + z(1)) * z(2) - 
A(5,6)) ^ 2;

z = fsolve (fun, [xguess, yguess]);

x = z(1);

y = z(2);

Ben




reply via email to

[Prev in Thread] Current Thread [Next in Thread]