Prev: WRITING ARRAY TO A FILE AND APPENDING IT
Next: Matlab GUI bar graph with different colors and stacked
From: Torsten Hennig on 22 Jun 2010 02:18 > "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in > message <hvojjo$5db$1(a)fred.mathworks.com>... > > "Don " <dongmkim(a)yahoo.com> wrote in message > <hvoitc$jrt$1(a)fred.mathworks.com>... > > > > > I wonder whether there is any way to use a > constraint in implementing fsolve. If I can use > constraint such as xi>=0 or xi for real number during > the iteration, it would give reasonable solutions. > > > Any comment would be appreciated. > > ================= > > > > You could rewrite the equations you're trying to > solve with the change of variables xi=ai^2. Solving > for ai will result in nonnegative corresponding > values for ai^2=xi. > > > > Alternatively, you could just solve using > lsqnonlin() and impose positivity bounds explicitly. > > I already tried ai^2=xi but this second trial gave > oscillating solutions. What do you mean by "oscillating solutions" ? Do you mean that x1 >= x2 >= x3 ... is not satisfied for the final solution you got from fsolve ? Does the final solution you obtained by this substitution satisfy your nonlinear system of equations ? Or did fsolve just quit because the maximum number of iterations were exceeded ? > I wonder whether lsqnonlin can be used to solve my > system. The solution will not fit any curve or > formula. The reason for mentioning y=1/x is to > explain decreasing xi for increasing i. Best wishes Torsten.
From: Don on 22 Jun 2010 07:44 Thank you. Oscillating solution means the values of solutions are 2, 0, 4, 1, 3, .5, etc., the overall trend of which do not satisfy the final solution that should be. I set the tolerance and the tolerance I achieved are within the limit: satisfies the required tolerance. I tried three ways to solve the system: Original system gives negative values for some solutions, substitution of xi with sqrt(yi), gives complex numbers for some solutions and substitution of xi with yi^2 gives oscillating solution as I mentioned here. All trials satisfy the tolerance limit and final solutions can be obtained within 20 iterations. Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <1986808344.7278.1277201953107.JavaMail.root(a)gallium.mathforum.org>... > > "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in > > message <hvojjo$5db$1(a)fred.mathworks.com>... > > > "Don " <dongmkim(a)yahoo.com> wrote in message > > <hvoitc$jrt$1(a)fred.mathworks.com>... > > > > > > > I wonder whether there is any way to use a > > constraint in implementing fsolve. If I can use > > constraint such as xi>=0 or xi for real number during > > the iteration, it would give reasonable solutions. > > > > Any comment would be appreciated. > > > ================= > > > > > > You could rewrite the equations you're trying to > > solve with the change of variables xi=ai^2. Solving > > for ai will result in nonnegative corresponding > > values for ai^2=xi. > > > > > > Alternatively, you could just solve using > > lsqnonlin() and impose positivity bounds explicitly. > > > > I already tried ai^2=xi but this second trial gave > > oscillating solutions. > > What do you mean by "oscillating solutions" ? > Do you mean that x1 >= x2 >= x3 ... is not satisfied > for the final solution you got from fsolve ? > Does the final solution you obtained by this > substitution satisfy your nonlinear system of equations ? > Or did fsolve just quit because the maximum number > of iterations were exceeded ? > > > I wonder whether lsqnonlin can be used to solve my > > system. The solution will not fit any curve or > > formula. The reason for mentioning y=1/x is to > > explain decreasing xi for increasing i. > > Best wishes > Torsten.
From: Torsten Hennig on 22 Jun 2010 04:10 > Thank you. > Oscillating solution means the values of solutions > are 2, 0, 4, 1, 3, .5, etc., the overall trend of > which do not satisfy the final solution that should > be. > I set the tolerance and the tolerance I achieved are > within the limit: satisfies the required tolerance. I > tried three ways to solve the system: Original system > gives negative values for some solutions, > substitution of xi with sqrt(yi), gives complex > numbers for some solutions and substitution of xi > with yi^2 gives oscillating solution as I mentioned > here. All trials satisfy the tolerance limit and > final solutions can be obtained within 20 iterations. > > You could try again the substitution x_i = (y_i)^2 and add new equations to your system: x_1 - x_2 = (z_1)^2 x_2 - x_3 = (z_2)^2 ... x_(n-1) - x_n = z_(n-1)^2 with new variables z_1,...,z_(n-1). If this system has a solution, it will automatically satisfy x_1 >= x_2 ... >= x_(n-1) >= x_n. Best wishes Torsten.
From: Ravi on 23 Jun 2010 23:29 Hi Don, SSE is not a MATLAB function. It is just an acronym for "Sum of Squares Error" which is obtained from the n equations. SSE=sum(fi^2) =f1^2 + f2^2 + f3^2 + ... + fn^2 f1, f2, ..., fn are the n nonlinear equations So you set up the optimization problem as Min SSE Constraints : -xi<=0 When SSE is minimized to zero, it means the equations are solved with all postive xi. Ravi Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <738784316.7897.1277208657655.JavaMail.root(a)gallium.mathforum.org>... > > Thank you. > > Oscillating solution means the values of solutions > > are 2, 0, 4, 1, 3, .5, etc., the overall trend of > > which do not satisfy the final solution that should > > be. > > I set the tolerance and the tolerance I achieved are > > within the limit: satisfies the required tolerance. I > > tried three ways to solve the system: Original system > > gives negative values for some solutions, > > substitution of xi with sqrt(yi), gives complex > > numbers for some solutions and substitution of xi > > with yi^2 gives oscillating solution as I mentioned > > here. All trials satisfy the tolerance limit and > > final solutions can be obtained within 20 iterations. > > > > > > You could try again the substitution x_i = (y_i)^2 > and add new equations to your system: > x_1 - x_2 = (z_1)^2 > x_2 - x_3 = (z_2)^2 > .. > x_(n-1) - x_n = z_(n-1)^2 > with new variables z_1,...,z_(n-1). > > If this system has a solution, it will automatically > satisfy x_1 >= x_2 ... >= x_(n-1) >= x_n. > > Best wishes > Torsten.
From: Ravi on 23 Jun 2010 23:41 Also if you are getting solutions that satisfy the equations but do not represent your physical solution, it means the system of equations has multiple solutions (which nonlinear equations can have). You can specify constraints in the optimization to guide the solution. Min SSE Constraints : -xi<=0 positive constraint xi-xi-1<=0 x1<xi-1 constraint Ravi "Ravi " <soni_romi(a)yahoo.com.thisisjunkremoveit> wrote in message <hvuje0$874$1(a)fred.mathworks.com>... > Hi Don, > > SSE is not a MATLAB function. It is just an acronym for "Sum of Squares Error" which is obtained from the n equations. > > SSE=sum(fi^2) =f1^2 + f2^2 + f3^2 + ... + fn^2 > > f1, f2, ..., fn are the n nonlinear equations > > So you set up the optimization problem as > Min SSE > Constraints : -xi<=0 > > When SSE is minimized to zero, it means the equations are solved with all postive xi. > > Ravi > > > Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <738784316.7897.1277208657655.JavaMail.root(a)gallium.mathforum.org>... > > > Thank you. > > > Oscillating solution means the values of solutions > > > are 2, 0, 4, 1, 3, .5, etc., the overall trend of > > > which do not satisfy the final solution that should > > > be. > > > I set the tolerance and the tolerance I achieved are > > > within the limit: satisfies the required tolerance. I > > > tried three ways to solve the system: Original system > > > gives negative values for some solutions, > > > substitution of xi with sqrt(yi), gives complex > > > numbers for some solutions and substitution of xi > > > with yi^2 gives oscillating solution as I mentioned > > > here. All trials satisfy the tolerance limit and > > > final solutions can be obtained within 20 iterations. > > > > > > > > > > You could try again the substitution x_i = (y_i)^2 > > and add new equations to your system: > > x_1 - x_2 = (z_1)^2 > > x_2 - x_3 = (z_2)^2 > > .. > > x_(n-1) - x_n = z_(n-1)^2 > > with new variables z_1,...,z_(n-1). > > > > If this system has a solution, it will automatically > > satisfy x_1 >= x_2 ... >= x_(n-1) >= x_n. > > > > Best wishes > > Torsten.
First
|
Prev
|
Pages: 1 2 Prev: WRITING ARRAY TO A FILE AND APPENDING IT Next: Matlab GUI bar graph with different colors and stacked |