Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to solve an overdetermined nonlinear system?

Subject: how to solve an overdetermined nonlinear system?

From: Elvis Chen

Date: 21 Sep, 2010 15:24:21

Message: 1 of 8

hi all,

I'm developing an algorithm and ended up with a system of nonlinear and overdetermined system in the following form:

A X = 0 (equation 1)

where

A is a nx6 matrix
X is a 6x1 vector of the following format:

X = [ x^2 y^2 z^2 xy xz yz ] '

and n = 10 in one particular case.

Given A, I'm trying to solve for [ x y z ]. There are infinite number of solution as X = 0 is an obvious one, and X' = s*X for any scalar s is also a solution.

Since any scalar multiple of a solution is also a solution, I can assume, for example, x = 1 and ended up with a second system:

A [ 1 y^2 z^2 y z y*z ]' = 0 (equation 2)

so my question is: give A, how to solve for equation 2 in matlab?

any help is very much appreciated,

Elvis

Subject: how to solve an overdetermined nonlinear system?

From: Steven_Lord

Date: 21 Sep, 2010 15:28:48

Message: 2 of 8



"Elvis Chen" <elvis.chen@gmail.com> wrote in message
news:i7ain5$7p3$1@fred.mathworks.com...
> hi all,
>
> I'm developing an algorithm and ended up with a system of nonlinear and
> overdetermined system in the following form:
>
> A X = 0 (equation 1)

HELP NULL.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: how to solve an overdetermined nonlinear system?

From: Elvis Chen

Date: 21 Sep, 2010 16:11:21

Message: 3 of 8

hi Steven,

Thanks for the prompt reply. I just tried NULL to obtain a solution but unfortunately it doesn't provide a good solution for my case. A further constrain that I failed to mention is that [x y z] are all positive numbers. X really is:

X = [ x^4 y^4 z^4 x^2*y^2 x^2*z^2 y^2*z^2 ]'

(I was trying to simplify the notation, sorry about that).


A particular case for the matrix "A" is:

>> A

A =

   -0.2508 0 0 0.1962 0 0
         0 0 0 0 0.0000 0
   -0.0324 0 0 0.0223 0.0036 0
         0 0 0 0 0.0000 0.0000
   -0.0122 -0.1356 0 0.1228 0.0435 0.0193
         0 0 -0.1173 0 0.0040 0.1002

using NULL command I got the following solutions:


>> NULL(A)

ans =

   -0.4072 0.0586
   -0.5890 -0.0241
   -0.0606 -0.6435
   -0.5204 0.0749
   -0.4583 0.0659
   -0.0527 -0.7562

>> NULL(A, 'r')

ans =

    0.8885 0
    1.2688 0.1425
    0.0342 0.8540
    1.1354 0
    1.0000 0
         0 1.0000

Neither is the solution I was looking for (or multiple of):

>> s

s =

    1.7490 2.8561 2.2153 2.2350 1.9684 2.5154

>> A*s'

ans =

   1.0e-15 *

   -0.6106
    0.0000
    0.0199
    0.0000
   -0.1041
    0.0555


any help is very much appreciated,


"Steven_Lord" <slord@mathworks.com> wrote in message <i7aivg$oo9$1@fred.mathworks.com>...
>
>
> "Elvis Chen" <elvis.chen@gmail.com> wrote in message
> news:i7ain5$7p3$1@fred.mathworks.com...
> > hi all,
> >
> > I'm developing an algorithm and ended up with a system of nonlinear and
> > overdetermined system in the following form:
> >
> > A X = 0 (equation 1)
>
> HELP NULL.
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Subject: how to solve an overdetermined nonlinear system?

From: Steven_Lord

Date: 21 Sep, 2010 17:00:29

Message: 4 of 8



"Elvis Chen" <elvis.chen@gmail.com> wrote in message
news:i7alf9$806$1@fred.mathworks.com...
> hi Steven,
>
> Thanks for the prompt reply. I just tried NULL to obtain a solution but
> unfortunately it doesn't provide a good solution for my case. A further
> constrain that I failed to mention is that [x y z] are all positive
> numbers. X really is:
>
> X = [ x^4 y^4 z^4 x^2*y^2 x^2*z^2 y^2*z^2 ]'
>
> (I was trying to simplify the notation, sorry about that).
>
>
> A particular case for the matrix "A" is:
>
>>> A
>
> A =
>
> -0.2508 0 0 0.1962 0 0
> 0 0 0 0 0.0000 0
> -0.0324 0 0 0.0223 0.0036 0
> 0 0 0 0 0.0000 0.0000
> -0.0122 -0.1356 0 0.1228 0.0435 0.0193
> 0 0 -0.1173 0 0.0040 0.1002
>
> using NULL command I got the following solutions:
>
>
>>> NULL(A)
>
> ans =
>
> -0.4072 0.0586
> -0.5890 -0.0241
> -0.0606 -0.6435
> -0.5204 0.0749
> -0.4583 0.0659
> -0.0527 -0.7562
>
>>> NULL(A, 'r')
>
> ans =
>
> 0.8885 0
> 1.2688 0.1425
> 0.0342 0.8540
> 1.1354 0
> 1.0000 0
> 0 1.0000
>
> Neither is the solution I was looking for (or multiple of):

If x and y are two vectors in the nullspace of A, then what do we know about
A*x and A*y (by definition)? What do we know about A*(c1*x+c2*y) for some
constants c1 and c2?

If I say M = null(A, 'r') then what do I know about A*(2*M(1)+17.54*M(2)),
for example?

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: how to solve an overdetermined nonlinear system?

From: Elvis Chen

Date: 21 Sep, 2010 18:06:05

Message: 5 of 8

hi Steven,
 (quoted message truncated)

again, thanks for the prompt reply.

I understand that the solution is a linear combination of the vectors in NULL(A). NULL(A) returns orthonormal basis, but I'm not sure what NULL(A,'r') returns (and the properties of).

My question was that since variables in X are not independent of each other, is there a way to further constrain the solution for A X = 0.

I'll see if I can formulate other constrains for my problem that find the correct linear combination of the vectors in NULL(A).

thanks,


"Steven_Lord" <slord@mathworks.com> wrote in message <i7aobe$d24$1@fred.mathworks.com>...
>
>
> "Elvis Chen" <elvis.chen@gmail.com> wrote in message
> news:i7alf9$806$1@fred.mathworks.com...

> > numbers. X really is:
> >
> > X = [ x^4 y^4 z^4 x^2*y^2 x^2*z^2 y^2*z^2 ]'
> >


> If x and y are two vectors in the nullspace of A, then what do we know about
> A*x and A*y (by definition)? What do we know about A*(c1*x+c2*y) for some
> constants c1 and c2?
>
> If I say M = null(A, 'r') then what do I know about A*(2*M(1)+17.54*M(2)),
> for example?
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Subject: how to solve an overdetermined nonlinear system?

From: Roger Stafford

Date: 21 Sep, 2010 19:45:22

Message: 6 of 8

"Elvis Chen" <elvis.chen@gmail.com> wrote in message <i7ain5$7p3$1@fred.mathworks.com>...
> hi all,
>
> I'm developing an algorithm and ended up with a system of nonlinear and overdetermined system in the following form:
>
> A X = 0 (equation 1)
>
> where
>
> A is a nx6 matrix
> X is a 6x1 vector of the following format:
>
> X = [ x^2 y^2 z^2 xy xz yz ] '
>
> and n = 10 in one particular case.
>
> Given A, I'm trying to solve for [ x y z ]. There are infinite number of solution as X = 0 is an obvious one, and X' = s*X for any scalar s is also a solution.
>
> Since any scalar multiple of a solution is also a solution, I can assume, for example, x = 1 and ended up with a second system:
>
> A [ 1 y^2 z^2 y z y*z ]' = 0 (equation 2)
>
> so my question is: give A, how to solve for equation 2 in matlab?
>
> any help is very much appreciated,
>
> Elvis
- - - - - - - - - - - -
  You are correct in asserting that the problem is non-linear and in my opinion the problem cannot be solved based on linear algebra concepts such as singular value decomposition or eigenvectors. There are only three degrees of freedom in the space of X values in spite of its six dimensions. If you place the constraint that x^2+y^2+z^2 = 1 you can attempt to find the minimum of the sum of the squares of the elements of A*X, but that is clearly a non-linear problem with respect to the (x,y,z) space.

  I would suggest using fmincon of the optimization toolbox using the three parameters x, y, and z. Your objective function to be minimized would be

 f(x,y,z) = sum((A*X).^2);

where, as you have said, X = [x.^2;y.^2;z.^2;x.*y;x.*z;y.*z]. The constraint would be ceq(x,y,z) = x.^2+y.^2+z.^2-1 = 0.

Roger Stafford

Subject: how to solve an overdetermined nonlinear system?

From: Elvis Chen

Date: 21 Sep, 2010 20:52:06

Message: 7 of 8

hi Roger,

Thanks very much. while I don't know how fmincon works, I think it may be the way to go. I do have a constrain that I can use:

[a^4 b^4 c^4 2*a^2*b^2 2*a^2*c^2 2*b^2*c^2] X = L

where (a,b,c,L) are known. I'll try to figure out how fmincon works and will report back.



 
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <i7b20i$pv4$1@fred.mathworks.com>...
> You are correct in asserting that the problem is non-linear and in my opinion the problem cannot be solved based on linear algebra concepts such as singular value decomposition or eigenvectors. There are only three degrees of freedom in the space of X values in spite of its six dimensions. If you place the constraint that x^2+y^2+z^2 = 1 you can attempt to find the minimum of the sum of the squares of the elements of A*X, but that is clearly a non-linear problem with respect to the (x,y,z) space.
>
> I would suggest using fmincon of the optimization toolbox using the three parameters x, y, and z. Your objective function to be minimized would be
>
> f(x,y,z) = sum((A*X).^2);
>
> where, as you have said, X = [x.^2;y.^2;z.^2;x.*y;x.*z;y.*z]. The constraint would be ceq(x,y,z) = x.^2+y.^2+z.^2-1 = 0.
>
> Roger Stafford

Subject: how to solve an overdetermined nonlinear system?

From: Roger Stafford

Date: 21 Sep, 2010 22:57:05

Message: 8 of 8

"Elvis Chen" <elvis.chen@gmail.com> wrote in message <i7b5tm$gpg$1@fred.mathworks.com>...
> ....... I do have a constrain that I can use:
>
> [a^4 b^4 c^4 2*a^2*b^2 2*a^2*c^2 2*b^2*c^2] X = L
>
> where (a,b,c,L) are known.
- - - - - - - - - -
  You should realize that this is a very different constraint than the isotropic constraint x^2+y^2+z^2 = 1 and will in general give a quite different answer. Your constraint is to a pair of infinite-extending parallel planes on opposite sides, and equal distances, from the origin:

 a^2*x+b^2*y+c^2*z = sqrt(L) and a^2*x+b^2*y+c^2*z = -sqrt(L) .

Roger Stafford

Tags for this Thread

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.

Contact us