Essentials of Mechatronics

Chapter 7.7 - Matrices, Notation, And Computing

7.7   MATRICES, NOTATION, AND COMPUTING

In a computer program, rather than using separate variables x, y, u, v, and so
on, it is more convenient mathematically to use “subscripted variables” as the
elements of a vector.

The entire vector is then represented by the single symbol x, which is made
up of several elements x1, x2, and so on.

Matrices are now made up of elements with two suffices:

 

In a computer program, the subscripts appear in brackets, so that a vector
could be represented by the elements X(1), X(2), and X(3), while the elements
of the matrix are A(1,1), A(1,2), and so on.

It is in matrix operations that this notation really earns its keep. Suppose
that we have a relationship

 x = Tu

where the vectors have three elements and the matrix is 3 × 3. Instead of a
massive block of arithmetic, the entire product is expressed in just five lines
of Basic program:

FOR I=1 TO 3
  X(I)=0
  FOR J=1 TO 3
    X(I)=X(I)+T(I, J)*U(J)
  NEXT J
NEXT I

For the matrix product C = AB, the program is hardly any more complex:

FOR I=1 TO 3
  FOR J=1 TO 3
   C(I,J)=0
   FOR K=1 TO 3
    C(I,J)=C(I,J)+A(I,K)*B(K,J)
   NEXT K
  NEXT J
NEXT I

Or in Java or C it becomes

for(i = 1; i<=3; i++){
  for(j = 1; j<=3; j++) {
    c[i][j] = 0;
    for(k = 1; k<=3;k++) {
      c[i][j] += a[i][k]*b[k][j];
    }
  }
}

These examples would look almost identical in a variety of languages and
would show the same economy of programming effort.

In Matlab the shorthand of matrix operations goes even farther—but there
is a danger that the engineroom will be lost to view behind the paintwork.

Clearly, if we are to try to analyze any except the simplest of systems by computer, we should first represent the problem in a matrix form.

But beware!!

If you have no computer to hand, it will almost certainly be quicker, easier,
and less prone to errors to use non-matrix methods to solve the problem.

 

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: DC Motors
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.