help-octave
[Top][All Lists]
Advanced

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

sqp


From: Urs Hackstein
Subject: sqp
Date: Fri, 5 Apr 2013 14:22:04 +0200

Dear list,

I have a question concerning the sqp routine.
Let f be a complex function of seven real variables and b a complex number. Then I want to minimize the function (real(b)-real(f(x(1),x(2),x(3),x(4),x(5),x(6),x(7)))).^2+(imag(b)-imag(f(x(1),x(2),x(3),x(4),x(5),x(6),x(7)))).^2 with 0.5<=x(i)<=20 for i=1,...,6 and 5<=x(7)<=200. This can be easily done as follows:

function erg=funp6(x,p)
erg=(p(1)-real(f(x(1),x(2),x(3),x(4),x(5),x(6),x(7)))).^2+(p(2)-imag(f(x(1),x(2),x(3),x(4),x(5),x(6),x(7)))).^2
endfunction

function mini=minimize6(b)
funp6wrap = @(x)funp6(x,[real(b),imag(b)])
y0  = 2*ones(7,1);
lbound = [0.5,0.5,0.5,0.5,0.5,0.5,5]';
ubound = [20,20,20,20,20,20,200]';
mini=sqp (y0,funp6wrap,[],[],lbound,ubound)

Now I want to add the conditions x(4)<1.85*x(1), x(5)<1.85*x(2), x(6)<1.85*x(3). How can we do this?

Best regards,

Urs Hackstein

reply via email to

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