Вы находитесь на странице: 1из 4

138

Matrix Math Using LabVIEW

3. Can the following arrays be multiplied? If so, what will be the size of the product

array?
A and C
B and D
C and B

A3 * 2 =

2
3
J
1

4
2
2 B2 * 4 = c
4
K
5

1
6

3
1

4
d
3

C2 * 2 = c

2
5

1
3
d D3 * 1 = 3
7
J K
4

ANS: In order to multiply, the number columns in the first array must
equal the number of rows in the second. The size of the result is equal to
the number of rows in the first array by the number of columns in the
second.
[A] [C]YES, result will be 3 2
[B] [D]NO
[C] [B]YES, result will be 2 4
4. Which LabVIEW function should be used to multiply arrays?

ANS: A B function, located at


Function Palette / Mathematics Group / Linear Algebra Group /
A B Function
5. When trying to solve simultaneous equations, is a large condition number a

good thing or a bad thing?


ANS: A bad thinga large condition number suggests the solution may be
subject to round-off and truncation errors. A condition number near 1 is
ideal.
6. When trying to solve simultaneous equations, what does a determinant of zero
on the coefficient matrix tell you?
ANS: The coefficient matrix is singular; no solution is possible.

PROBLEMS
1.

Create a VI that adds the following arrays, if array addition is possible.


a. A = c

2.4
d
6.5

3.1
4.8

B = c

2.2
5.3

4.9
d
8.1

2
3
J
1

7
5
4

1
2
K
9

D =

2
c. E = 3
J
1

7
5
4

1
2
K
9

6
F =
- 1
J
0

b. C =

3
5
J K
1
- 2
3
2

4
6
K
7

Problems 139

2. Create a VI that multiplies the following arrays, if multiplication is possible.

a. [A][B]

A = c

2.4
d
6.5

3.1
4.8

b. [C][D]

2
C = 3
J
1

B = c

4.9
d
8.1

2.2
5.3

7
5
4

1
2
K
9

3
D = 5
J K
1

7
5
4

1
2
K
9

D =

c. [D][C]
C =

2
3
J
1

3
5
J K
1

3. Create a VI that multiplies the following arrays, if multiplication is possible.

a. [E][F]
2
2
J
1

7
7
4

1
1
K
9

F =

2
1
J
8

4
3
2

1
1
4

7
9
1

2
G = 2
J1

7
7
4

1
1
K
9

1
H = 2
J7

4
4
2

2
1
4

5
2
K
3

E =

8
2
3

9
6
K
5

b. [G][H]

4. Check the determinant to see if the following arrays can be inverted. If inversion

is possible, create a VI that inverts the arrays.


2
a. E = 3
J
1

7
5
4

1
2
K
9

2
2
J
1

7
7
4

1
1
K
9

2
c. F = 1
J
8

4
3
2

1
1
4

b. G =

7
9
1

8
2
3

9
6
K
5

140

Matrix Math Using LabVIEW

5. Check the condition number of the following arrays.

2
a. E = 3
J
1

7
5
4

1
2
K
9

b. G =

2
2
J
1

7
7
4

1
1
K
9

c. F =

2
1
J
8

4
3
2

1
1
4

7
9
1

8
2
3

9
6
K
5

6. The following matrix systems represent sets of simultaneous linear equa-

tions written in matrix form. Check the condition number and determinant
of the coefficient matrix, then, if a solution is possible, create a VI to solve
the equations.
2
3
J
1

7
5
4

1
2
K
9

rhs =

2
b. C = 2
J
1

7
7
4

1
1
K
9

3
rhs = 5
J K
1

a. C =

-2 4 1
1 -4 6
c. C =
8
3 3
3
7 -3

3
2

1
2

3
5
J K
1

-2
-4
rhs =
-1
-5

7. Solve the following sets of simultaneous linear equations, if possible. Check

the determinant of the coefficient matrix to see if a solution is possible.


a. 2x1 + 7x2 + 1x3 = 3
3x1 + 5x2 + 2x3 = 5
1x1 + 4x2 + 9x3 = 1
b. 2x1 + 7x2 + 1x3 = 3
3x1 + 5x2 + 2x3 = 5
-x1 + 2x2 - x3 = 1
c. 7a
3a
a
5a

+
+
+
-

2b
8b
4b
2b

+
+
-

c + d = 4
2c + 2d = 1
9c - 2d = 3
3c + 4d = 2

Problems 141

8. LabVIEW provides two ways to solve sets of simultaneous linear equations:

inverting the coefficient matrix and multiplying by the right-hand-side vector,


and using the Solve Linear Equations function (actually a VI). Use both methods
to solve the following set of equations and compare the results. Do both
methods yield the same result?
2x1 + 7x2 + 1x3 = 3
3x1 + 5x2 + 2x3 = 5
1x1 + 4x2 + 9x3 = 1
9. Use Kirchhoffs Laws to develop three equations to solve for the three cur-

rents (I1, I2, I3) indicated in Figure 4.67. The known quantities are as follows:
E = 20 V
R1 = 120 ohms
R2 = 150 ohms
R3 = 30 ohms
Figure 4.67
Series-parallel circuit.

I1

R1

I2

I3

R3

R2