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:
Homogeneous Linear System

Subject: Homogeneous Linear System

From: Tato Jandieri

Date: 20 Jan, 2009 03:23:02

Message: 1 of 4

Dear Friends,
I have a request to you and please, help me to solve to following problem:

I have a homogeneous linear system of equations:
A*b=0 (where A is a square matrix (10X10), `b` is a vector I would like to calculate (of course, not only trivial solutions) ).

`A` matrix I calculated in Visual Fortan (it is quite a big program). Its determinant is close to zero with the accuracy (10e-9). After that I tried Matlab to easily calculate `b` vector with command `null(A)`, but as the determinant is not zero (in my case 10e-9 order), I could not calculate vector `b`.
Please, would you suggest some good idea?

Thank you so much for your help in advance.
Best regards,
Tato

Subject: Homogeneous Linear System

From: John D'Errico

Date: 20 Jan, 2009 03:44:02

Message: 2 of 4

"Tato Jandieri" <vjandieri@yahoo.com> wrote in message <gl3g2m$km5$1@fred.mathworks.com>...
> Dear Friends,
> I have a request to you and please, help me to solve to following problem:
>
> I have a homogeneous linear system of equations:
> A*b=0 (where A is a square matrix (10X10), `b` is a vector I would like to calculate (of course, not only trivial solutions) ).
>
> `A` matrix I calculated in Visual Fortan (it is quite a big program). Its determinant is close to zero with the accuracy (10e-9). After that I tried Matlab to easily calculate `b` vector with command `null(A)`, but as the determinant is not zero (in my case 10e-9 order), I could not calculate vector `b`.
> Please, would you suggest some good idea?
>
> Thank you so much for your help in advance.
> Best regards,
> Tato

First, I'll try to correct a misunderstanding.

A determinant of 1e-9 may not even be close to
being a flag for a singular matrix, or it may indeed
be darn close to singularity. This is one of the
problems that students have. They are told by
their teachers and sometimes even their textbooks
that a matrix is singular if the determinant is zero.

In fact, the determinant is a terrible way to do
that computation. It is inefficient and numerically
unstable. I can even give you a 2x2 matrix which
is numerically singular, yet has a determinant fully
as large as 1!

  A = [1e9 eps;0 1e-9]
A =
        1e+09 2.2204e-16
            0 1e-09

See that A has rank 1, so it is numerically singular.

rank(A)
ans =
     1

Yet the determinant is 1.

det(A)
ans =
     1

I could as easily have constructed a matrix with
determinant that was highly ill-posed or that was
perfectly conditioned.

Now to solve your problem. If your matrix were
truly singular, then a solution to the homogeneous
problem would be just null(A).

Since it is not even close to numerical singularity,
you might look at the right singular vector that
corresponds to the smallest singular value of A.

John

Subject: Homogeneous Linear System

From: Roger Stafford

Date: 20 Jan, 2009 03:52:01

Message: 3 of 4

"Tato Jandieri" <vjandieri@yahoo.com> wrote in message <gl3g2m$km5$1@fred.mathworks.com>...
> Dear Friends,
> I have a request to you and please, help me to solve to following problem:
>
> I have a homogeneous linear system of equations:
> A*b=0 (where A is a square matrix (10X10), `b` is a vector I would like to calculate (of course, not only trivial solutions) ).
>
> `A` matrix I calculated in Visual Fortan (it is quite a big program). Its determinant is close to zero with the accuracy (10e-9). After that I tried Matlab to easily calculate `b` vector with command `null(A)`, but as the determinant is not zero (in my case 10e-9 order), I could not calculate vector `b`.
> Please, would you suggest some good idea?
>
> Thank you so much for your help in advance.
> Best regards,
> Tato

  Try this;

 [U,S,V] = svd(A,'econ');
 b = V(:,size(A,2));

This b will be a solution if the corresponding smallest singular value is zero. If not, b will be the nearest you can come to a solution. If more than one singular value is zero, there are infinitely many solutions of which this will be one.

Roger Stafford

Subject: Homogeneous Linear System

From: Tato Jandieri

Date: 20 Jan, 2009 04:53:02

Message: 4 of 4

Thank you so much for your comments!!!

Best regards,
Tato

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