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:
Inversion of a matrix

Subject: Inversion of a matrix

From: Matthew

Date: 17 Mar, 2010 22:37:23

Message: 1 of 5

Hi there, I am trying to invert the following matrix (please copy and paste into an ordinary text document to see the rows and columns). My lecturer says it is possible using a tool which deals with sparse matrices, but I can't find it anywhere. I have had a look at other posts and there are some different methods for inverting matrices but none of them seem to work.

Please help!!! :(

A22 =

   -0.0281 0.0235 0.3866 -0.9402 0.1406 8.8444 -0.1241 0 -0.0457 0.0002 -0.0496 0.0268
   -0.0276 -0.0298 -1.2050 0.9590 -0.0092 -0.0079 -9.1597 0 0.0955 -0.0637 0.0183 -0.0794
   -0.0397 0.0162 -0.9453 -0.4574 -0.0629 -0.2427 -0.0665 0 -0.0049 0.0003 -0.0440 -0.0391
    0.0060 0.0004 0.1798 -0.6805 -0.0509 0.0045 0.0153 0 -0.0019 -0.0015 -0.0236 0.0211
    0.0177 0.0020 -0.0828 -0.0359 -0.2436 -0.0328 -0.0078 0 1.2443 0.0051 -0.0052 -0.0045
         0 0 1.0011 0.0064 0.0934 0 0 0 0 0 0 0
         0 0 0 0.9987 -0.0683 0 0 0 0 0 0 0
         0 0 0 0.0686 1.0031 0 0 0 0 0 0 0
   -0.0077 0.0023 0.0131 0.0029 -0.0933 0.0039 0.0008 0 -3.2212 0.0281 0.0004 0.0003
   -0.0058 -0.3049 -0.1954 -0.0209 2.2201 0.0011 0.0001 0 2.4050 -5.3327 0.0001 0.0010
   10.0618 -0.0176 17.8017 -6.0152 1.5821 -0.0036 -0.0357 0 -0.0111 -0.0014 -13.6668 0.0122
    0.0161 10.0275 -6.0314 -17.8927 -0.5327 0.0435 -0.0333 0 0.0007 -0.0002 0.0109 -13.7022

Subject: Inversion of a matrix

From: pipa

Date: 17 Mar, 2010 23:20:46

Message: 2 of 5

did u use pinv?...it will give u an answer based on least squares method but it may not be accurate.

"Matthew " <matthew.caulfield@ntlworld.com> wrote in message <hnrlj3$nh8$1@fred.mathworks.com>...
> Hi there, I am trying to invert the following matrix (please copy and paste into an ordinary text document to see the rows and columns). My lecturer says it is possible using a tool which deals with sparse matrices, but I can't find it anywhere. I have had a look at other posts and there are some different methods for inverting matrices but none of them seem to work.
>
> Please help!!! :(
>
> A22 =
>
> -0.0281 0.0235 0.3866 -0.9402 0.1406 8.8444 -0.1241 0 -0.0457 0.0002 -0.0496 0.0268
> -0.0276 -0.0298 -1.2050 0.9590 -0.0092 -0.0079 -9.1597 0 0.0955 -0.0637 0.0183 -0.0794
> -0.0397 0.0162 -0.9453 -0.4574 -0.0629 -0.2427 -0.0665 0 -0.0049 0.0003 -0.0440 -0.0391
> 0.0060 0.0004 0.1798 -0.6805 -0.0509 0.0045 0.0153 0 -0.0019 -0.0015 -0.0236 0.0211
> 0.0177 0.0020 -0.0828 -0.0359 -0.2436 -0.0328 -0.0078 0 1.2443 0.0051 -0.0052 -0.0045
> 0 0 1.0011 0.0064 0.0934 0 0 0 0 0 0 0
> 0 0 0 0.9987 -0.0683 0 0 0 0 0 0 0
> 0 0 0 0.0686 1.0031 0 0 0 0 0 0 0
> -0.0077 0.0023 0.0131 0.0029 -0.0933 0.0039 0.0008 0 -3.2212 0.0281 0.0004 0.0003
> -0.0058 -0.3049 -0.1954 -0.0209 2.2201 0.0011 0.0001 0 2.4050 -5.3327 0.0001 0.0010
> 10.0618 -0.0176 17.8017 -6.0152 1.5821 -0.0036 -0.0357 0 -0.0111 -0.0014 -13.6668 0.0122
> 0.0161 10.0275 -6.0314 -17.8927 -0.5327 0.0435 -0.0333 0 0.0007 -0.0002 0.0109 -13.7022

Subject: Inversion of a matrix

From: Roger Stafford

Date: 18 Mar, 2010 01:10:24

Message: 3 of 5

"Matthew " <matthew.caulfield@ntlworld.com> wrote in message <hnrlj3$nh8$1@fred.mathworks.com>...
> Hi there, I am trying to invert the following matrix (please copy and paste into an ordinary text document to see the rows and columns). My lecturer says it is possible using a tool which deals with sparse matrices, but I can't find it anywhere.
-------------
  The eighth column of your matrix is all zeros and it therefore has no inverse. Its determinant is zero. You had better check again with your lecturer about what is really being asked.

Roger Stafford

Subject: Inversion of a matrix

From: Steven Lord

Date: 18 Mar, 2010 13:43:13

Message: 4 of 5


"Matthew " <matthew.caulfield@ntlworld.com> wrote in message
news:hnrlj3$nh8$1@fred.mathworks.com...
> Hi there, I am trying to invert the following matrix (please copy and
> paste into an ordinary text document to see the rows and columns). My
> lecturer says it is possible using a tool which deals with sparse
> matrices, but I can't find it anywhere. I have had a look at other posts
> and there are some different methods for inverting matrices but none of
> them seem to work.

Three comments.

1) Don't invert a matrix unless you KNOW what you're doing and KNOW that you
really, truly need the inverse. If you're inverting a matrix A so that you
can solve A*x = b by using x = inv(A)*b, you do NOT need the inverse. Use
the backslash operator instead: x = A\b.

2) As Roger has called out, column 8 of your matrix contains all zeros;
therefore this matrix is singular and has no inverse.

3) Assuming that this matrix were invertible, if you were to invert your
original version of A22 and the version you created by typing in the
elements as displayed below, you may NOT receive the same results. By
default, numbers in MATLAB are stored as double precision values -- that
means roughly 16 digits of precision. As written below, we can't tell
whether the first element of A22
is -0.0281000000000000, -0.0281499999999999, or something inbetween. That
small difference may actually have a significant impact on the inverse of
the matrix.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: Inversion of a matrix

From: Yi Cao

Date: 18 Mar, 2010 14:10:21

Message: 5 of 5

Matthew,

This is a 12x12 matrix, but one of column is zero. This means variable corresponding to this column will have no effect on the rest of the system. If you accept this, you can get a pseudo-inverse as follows:

P = any(A22);
A = A22(:,P);
M = A22';
M(P,:) = (A'*A)\A';

You can test this p-inverse by checking
 
M*A22

it is diagonal of 1 except the column and row corresponding to the zero column in A22.

HTH
Yi
"Matthew " <matthew.caulfield@ntlworld.com> wrote in message <hnrlj3$nh8$1@fred.mathworks.com>...
> Hi there, I am trying to invert the following matrix (please copy and paste into an ordinary text document to see the rows and columns). My lecturer says it is possible using a tool which deals with sparse matrices, but I can't find it anywhere. I have had a look at other posts and there are some different methods for inverting matrices but none of them seem to work.
>
> Please help!!! :(
>
> A22 =
>
> -0.0281 0.0235 0.3866 -0.9402 0.1406 8.8444 -0.1241 0 -0.0457 0.0002 -0.0496 0.0268
> -0.0276 -0.0298 -1.2050 0.9590 -0.0092 -0.0079 -9.1597 0 0.0955 -0.0637 0.0183 -0.0794
> -0.0397 0.0162 -0.9453 -0.4574 -0.0629 -0.2427 -0.0665 0 -0.0049 0.0003 -0.0440 -0.0391
> 0.0060 0.0004 0.1798 -0.6805 -0.0509 0.0045 0.0153 0 -0.0019 -0.0015 -0.0236 0.0211
> 0.0177 0.0020 -0.0828 -0.0359 -0.2436 -0.0328 -0.0078 0 1.2443 0.0051 -0.0052 -0.0045
> 0 0 1.0011 0.0064 0.0934 0 0 0 0 0 0 0
> 0 0 0 0.9987 -0.0683 0 0 0 0 0 0 0
> 0 0 0 0.0686 1.0031 0 0 0 0 0 0 0
> -0.0077 0.0023 0.0131 0.0029 -0.0933 0.0039 0.0008 0 -3.2212 0.0281 0.0004 0.0003
> -0.0058 -0.3049 -0.1954 -0.0209 2.2201 0.0011 0.0001 0 2.4050 -5.3327 0.0001 0.0010
> 10.0618 -0.0176 17.8017 -6.0152 1.5821 -0.0036 -0.0357 0 -0.0111 -0.0014 -13.6668 0.0122
> 0.0161 10.0275 -6.0314 -17.8927 -0.5327 0.0435 -0.0333 0 0.0007 -0.0002 0.0109 -13.7022

Tags for this Thread

No tags are associated with 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