# minimization problem, sqp

9 messages
Open this post in threaded view
|
Report Content as Inappropriate

## minimization problem, sqp

 Dear list,I am relatively new to octave and dealing with the following minimization problem:Let b, ps1, ps2, ps3, ps4, ps5, ps6 and ps7 arbitrary complex numbers. My goal is to determine the real numbers x(1), x(2), x(3), x(4),x(5),x(6),x(7) with -1<=x(j)<=1, j=1,..,7, such that the function  (b-x(1).*ps1-x(2).*ps2-x(3).*ps3-x(4).*ps4-x(5).*ps5-x(6).*ps6-x(7).*ps7).^2takes its minimal value.I made the following attempt using sqp:function erg=fun(x)erg=(b-x(1).*ps1-x(2).*ps2-x(3).*ps3-x(4).*ps4-x(5).*ps5-x(6).*ps6-x(7).*ps7).^2 endfunctionfunction minimi=minimize(b,ps1,ps2,ps3,ps4,ps5,ps6,ps7)global b;minimi=sqp([0;0;0;0;0;0;0],@fun,[-1;-1;-1;-1;-1;-1;-1],[1;1;1;1;1;1;1])endfunctionThanks a lot in advance!Sincerely yours, Urs Hackstein _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|
Report Content as Inappropriate

## Re: minimization problem, sqp

 On Mon, Feb 25, 2013 at 2:30 PM, Urs Hackstein <[hidden email]> wrote: > Dear list, > > I am relatively new to octave and dealing with the following minimization > problem: > Let b, ps1, ps2, ps3, ps4, ps5, ps6 and ps7 arbitrary complex numbers. My > goal is to determine the real numbers x(1), x(2), x(3), x(4),x(5),x(6),x(7) > with -1<=x(j)<=1, j=1,..,7, such that the function > > (b-x(1).*ps1-x(2).*ps2-x(3).*ps3-x(4).*ps4-x(5).*ps5-x(6).*ps6-x(7).*ps7).^2 > takes its minimal value. > > I made the following attempt using sqp: > > function erg=fun(x) > erg=(b-x(1).*ps1-x(2).*ps2-x(3).*ps3-x(4).*ps4-x(5).*ps5-x(6).*ps6-x(7).*ps7).^2 > endfunction > > function minimi=minimize(b,ps1,ps2,ps3,ps4,ps5,ps6,ps7) > global b; > minimi=sqp([0;0;0;0;0;0;0],@fun,[-1;-1;-1;-1;-1;-1;-1],[1;1;1;1;1;1;1]) > endfunction > > Thanks a lot in advance! > > Sincerely yours, > > Urs Hackstein > > _______________________________________________ > Help-octave mailing list > [hidden email] > https://mailman.cae.wisc.edu/listinfo/help-octave>  Hi Urs, Great! and what is the problem? _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|
Report Content as Inappropriate

## Fwd: minimization problem, sqp

 ---------- Forwarded message ----------From: Urs Hackstein Date: 2013/2/25Subject: Re: minimization problem, sqpTo: Juan Pablo Carbajal <[hidden email]>Hi Juan,the problem is that my attempt does not work and I am not familiar enough with the sqp syntax to get the x(1),...,x(7) as output. Thus any suggestions for a correct program? Sincerely yours,Urs Hackstein 2013/2/25 Juan Pablo Carbajal On Mon, Feb 25, 2013 at 2:30 PM, Urs Hackstein <[hidden email]> wrote: > Dear list, > > I am relatively new to octave and dealing with the following minimization > problem: > Let b, ps1, ps2, ps3, ps4, ps5, ps6 and ps7 arbitrary complex numbers. My > goal is to determine the real numbers x(1), x(2), x(3), x(4),x(5),x(6),x(7) > with -1<=x(j)<=1, j=1,..,7, such that the function > > (b-x(1).*ps1-x(2).*ps2-x(3).*ps3-x(4).*ps4-x(5).*ps5-x(6).*ps6-x(7).*ps7).^2 > takes its minimal value. > > I made the following attempt using sqp: > > function erg=fun(x) > erg=(b-x(1).*ps1-x(2).*ps2-x(3).*ps3-x(4).*ps4-x(5).*ps5-x(6).*ps6-x(7).*ps7).^2 > endfunction > > function minimi=minimize(b,ps1,ps2,ps3,ps4,ps5,ps6,ps7) > global b; > minimi=sqp([0;0;0;0;0;0;0],@fun,[-1;-1;-1;-1;-1;-1;-1],[1;1;1;1;1;1;1]) > endfunction > > Thanks a lot in advance! > > Sincerely yours, > > Urs Hackstein > > _______________________________________________ > Help-octave mailing list > [hidden email] > https://mailman.cae.wisc.edu/listinfo/help-octave >  Hi Urs, Great! and what is the problem? _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|
Report Content as Inappropriate

## Re: minimization problem, sqp

 On Mon, Feb 25, 2013 at 3:32 PM, Urs Hackstein <[hidden email]> wrote: > > > ---------- Forwarded message ---------- > From: Urs Hackstein <[hidden email]> > Date: 2013/2/25 > Subject: Re: minimization problem, sqp > To: Juan Pablo Carbajal <[hidden email]> > > > Hi Juan, > > the problem is that my attempt does not work and I am not familiar enough > with the sqp syntax to get the x(1),...,x(7) as output. Thus any suggestions > for a correct program? > > > Sincerely yours, > > Urs Hackstein > > 2013/2/25 Juan Pablo Carbajal <[hidden email]> >> >> On Mon, Feb 25, 2013 at 2:30 PM, Urs Hackstein >> <[hidden email]> wrote: >> > Dear list, >> > >> > I am relatively new to octave and dealing with the following >> > minimization >> > problem: >> > Let b, ps1, ps2, ps3, ps4, ps5, ps6 and ps7 arbitrary complex numbers. >> > My >> > goal is to determine the real numbers x(1), x(2), x(3), >> > x(4),x(5),x(6),x(7) >> > with -1<=x(j)<=1, j=1,..,7, such that the function >> > >> > >> > (b-x(1).*ps1-x(2).*ps2-x(3).*ps3-x(4).*ps4-x(5).*ps5-x(6).*ps6-x(7).*ps7).^2 >> > takes its minimal value. >> > >> > I made the following attempt using sqp: >> > >> > function erg=fun(x) >> > >> > erg=(b-x(1).*ps1-x(2).*ps2-x(3).*ps3-x(4).*ps4-x(5).*ps5-x(6).*ps6-x(7).*ps7).^2 >> > endfunction >> > >> > function minimi=minimize(b,ps1,ps2,ps3,ps4,ps5,ps6,ps7) >> > global b; >> > minimi=sqp([0;0;0;0;0;0;0],@fun,[-1;-1;-1;-1;-1;-1;-1],[1;1;1;1;1;1;1]) >> > endfunction >> > >> > Thanks a lot in advance! >> > >> > Sincerely yours, >> > >> > Urs Hackstein >> > >> > _______________________________________________ >> > Help-octave mailing list >> > [hidden email] >> > https://mailman.cae.wisc.edu/listinfo/help-octave>> > >> >>  Hi Urs, >> >> Great! and what is the problem? > > > > > _______________________________________________ > Help-octave mailing list > [hidden email] > https://mailman.cae.wisc.edu/listinfo/help-octave> Urs, Ok, have you try reading the help of sqp? > help sqp If you have questions after reading that we can help you, but do please read the manual. also search the web, there are plenty of examples using sqp _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|
Report Content as Inappropriate

## Re: minimization problem, sqp

 Juan,I read the manual before posting my question (my attempt was the result of reading it) and I did it again, but it didn't help. I still get the error "`b' undefined near line 3 column 6" and don't know how to fix it. Perhaps the problem is that fun is not just a function of x, but also of b and the psj, but, as I said, I don't know how to fix it. 2013/2/25 Juan Pablo Carbajal On Mon, Feb 25, 2013 at 3:32 PM, Urs Hackstein <[hidden email]> wrote: > > > ---------- Forwarded message ---------- > From: Urs Hackstein <[hidden email]> > Date: 2013/2/25 > Subject: Re: minimization problem, sqp > To: Juan Pablo Carbajal <[hidden email]> > > > Hi Juan, > > the problem is that my attempt does not work and I am not familiar enough > with the sqp syntax to get the x(1),...,x(7) as output. Thus any suggestions > for a correct program? > > > Sincerely yours, > > Urs Hackstein > > 2013/2/25 Juan Pablo Carbajal <[hidden email]> >> >> On Mon, Feb 25, 2013 at 2:30 PM, Urs Hackstein >> <[hidden email]> wrote: >> > Dear list, >> > >> > I am relatively new to octave and dealing with the following >> > minimization >> > problem: >> > Let b, ps1, ps2, ps3, ps4, ps5, ps6 and ps7 arbitrary complex numbers. >> > My >> > goal is to determine the real numbers x(1), x(2), x(3), >> > x(4),x(5),x(6),x(7) >> > with -1<=x(j)<=1, j=1,..,7, such that the function >> > >> > >> > (b-x(1).*ps1-x(2).*ps2-x(3).*ps3-x(4).*ps4-x(5).*ps5-x(6).*ps6-x(7).*ps7).^2 >> > takes its minimal value. >> > >> > I made the following attempt using sqp: >> > >> > function erg=fun(x) >> > >> > erg=(b-x(1).*ps1-x(2).*ps2-x(3).*ps3-x(4).*ps4-x(5).*ps5-x(6).*ps6-x(7).*ps7).^2 >> > endfunction >> > >> > function minimi=minimize(b,ps1,ps2,ps3,ps4,ps5,ps6,ps7) >> > global b; >> > minimi=sqp([0;0;0;0;0;0;0],@fun,[-1;-1;-1;-1;-1;-1;-1],[1;1;1;1;1;1;1]) >> > endfunction >> > >> > Thanks a lot in advance! >> > >> > Sincerely yours, >> > >> > Urs Hackstein >> > >> > _______________________________________________ >> > Help-octave mailing list >> > [hidden email] >> > https://mailman.cae.wisc.edu/listinfo/help-octave >> > >> >>  Hi Urs, >> >> Great! and what is the problem? > > > > > _______________________________________________ > Help-octave mailing list > [hidden email] > https://mailman.cae.wisc.edu/listinfo/help-octave > Urs, Ok, have you try reading the help of sqp? > help sqp If you have questions after reading that we can help you, but do please read the manual. also search the web, there are plenty of examples using sqp _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|
Report Content as Inappropriate

## Re: minimization problem, sqp

Open this post in threaded view
|
Report Content as Inappropriate

## Re: minimization problem, sqp

Open this post in threaded view
|
Report Content as Inappropriate