Sie sind auf Seite 1von 3

EGR 120 Introduction to Engineering File: VECTORS.

MCD

MathCad Example: Vectors and Matrices

Vectors
i := 1 .. 3 ORIGIN := 1 P :=
i

Note: Vectors must begin with subscript 0 unless the ORIGIN statement is used to define a new initial subscript (also note that ORIGIN must be in all capital letters)
Q :=
i

i =
1 2 3

Note: Type P[i:2,3,4 to enter the values for vector P

2 3 4

3 1 5

2 P = 3 4
P =3
2 2

Note: Type P= to display vector P

Note: Type P[2= to display row 2 of vector P Note: Type P[2*Q[3= to multiply element 2 of vector P by element 3 of vector Q and display the result. Note: Type Ctrl-8 for a cross product (or use X x Y on the Matrix Toolbar). Also note that cross products are only defined for 3-eleme vectors. Note: Standard multiplication of vectors results in a dot product (or use use X . Y on the Matrix Toolbar) Note: Normal arithmetic operations can be performed on vectors and matrices as long as the dimensions are compatible.

P Q = 15
3

19 P Q= 2 11
P Q = 23

13 3 Q + 2 P = 3 23

Note: Vectors P and Q above could have also been created as matrices with 3 rows and one column as illustrated below with matrices R and S)

Using Column Matrices in place of Vectors


2 R := 3 4
ORIGIN := 1

3 S := 1 5

Note: Type R:INSERT - MATRIX (or use Ctrl + M) and then specify the number of rows and columns. Then fill in the values for R. (or try Ctrl + M) Note: Matrices begin with subscript 0 unless the ORIGIN statement is used to define a new initial subscript (also note that ORIGIN must be in all capital letters)

R =3
2

Note: Type R[2= to display row 2 of column matrix R Note: Type R[2*S[3= to multiply element 2 of column matrix R by element 3 of column matrix S and display the result. Note: Type Ctrl-8 for a cross product (or use X x Y on the Matrix Toolbar). Also note that cross products are only defined for 3-elemen vectors or column matrices. Note: Standard multiplication of column matrices results in a dot pro (or use use X . Y on the Matrix Toolbar) Note: Normal arithmetic operations can be performed on vectors and matrices as long as the dimensions are compatible.

R S = 15
2 3

19 R S= 2 11
R S = 23

12 3 R + 2 S = 7 22

Matrices
1 5 2 A := 4 0 2 1 3 6
AINV := A
1

Note: Type A:INSERT - MATRIX (or use Ctrl + M) and then specify the number of rows and columns. Then fill in the values for R. (or try Ctrl + M)

Note: A normal inverse operation also inverts a matrix 0.075 0.3 0.125 (or use the X-1 symbol on the Matrix Toolbar). AINV = 0.275 0.1 0.125 0.15 0.1 0.25 Note: Use absolute values bars to find the determinant of A detA := A (or use the |x| symbol on the Matrix Toolbar) detA = 80 Solving a set of simultaneous equations using matrices The simultaneous equations 3x + 2y + 10z = 4 5x - z = 11 7y + 8z = 20 Could be written in matrix form as Ax = b where 3 2 10 A := 5 0 1 0 7 8
x := A
1

4 b := 11 20

And the solution could be found by solving the matrix equation:


b

2 x= 4 1

Das könnte Ihnen auch gefallen