Sei sulla pagina 1di 18

CHE 317: COMPUTER PACKAGES FOR

CHEMICAL ENGINEERS

INTRODUCTION TO THE USE OF


EXCEL
(Lecture 3)
Instructors:
Prof. V.E Efeovbokhan and Engr. D. E. Babatunde
Other in-built functions
Click the insert function button and examine many other
available functions
With the help Practice the use of some of the function
Some examples of functions:
OTHER FUNCTIONS
• average(CELL1, CELL2, ...) OR average(GROUP)
• intercept(GROUP1, GROUP2): Calculates the y-intercept
(c) of the regression line where y = GROUP1 and x =
GROUP2.
 GROUP1 and GROUP2 must have the same size.
• slope(GROUP1, GROUP2): Calculates the slope (m) of the
regression line where y = GROUP1 and x = GROUP2.
 GROUP1 and GROUP2 must have the same size.

• Pearson(GROUP1, GROUP2): Calculates the Pearson


correlation coefficient (R) between GROUP1 and GROUP2.
• stdev(CELL1, CELL2, ...) OR stdev(GROUP): Computes the
sample standard deviation (divides by n-1) of all inputs.
BUILT-IN MATRIX FUNCTIONS
• Simultaneous linear equations occur frequently in
engineering
• Generally the term matrix (from mathematics) and
array (from Excel) can be used interchangeably to refer
to data organized in row and column
• Typical Linear Equation Set and Corresponding Matrices
BUILT-IN MATRIX FUNCTIONS
• Is represented in math as:

• and has the solution


BUILT-IN MATRIX FUNCTIONS
How Excel Handles Matrix Math.
Matrix operations are handled in two different
fashions in Excel:
• Addition of matrices and scalar multiplication
are handled by conventional cell arithmetic
(copying cell formulas)
• Whereas advanced matrix operations such as
transposition, multiplication and inversion are
handled by matrix (array) functions
BUILT-IN MATRIX FUNCTIONS
We will consider:
• MULTIPLICATION of matrix BY A SCALAR(3*A)
• SCALAR MULTIPLICATION of two matrices(B*A)-
corresponding elements
• SUBSTRACTION/ADDITION of matrices
• MATRIX MULTIPLICATION of two matrices
• TRANSPOSE of matrices
• INVERSE of matrices
• DETERMINANT of matrices
MATRIX OPERATIONS

 NAME THE MATRIX-


a. SELECT ENTERED ARRAY,
b. RIGHT CLICK,
c. SELECT NAME RANGE
d. TYPE DESIRED NAME
 TO PERFORM MATRIX OPERATIONS
• ARRAY WHERE RESULT OF OPERATION SHOULD
MUST BE SELECTED
• TYPE IN THE MATRIX FUNCTION WANTED
• PRESS CONTROL-SHIFT-ENTER TO OBTAIN RESULTS
Examples of matrix operations
Matrix Addition:
• Highlight and name the cells from B2:C4
as “A”. This is done by typing “A” in the
“name field” of the function picker
• Similarly highlight and name the range
B6:C8 as “B”.
• Highlight the destination range and type
the following formula: =A+B but do not
press “enter” instead press “control-shift-
enter” to complete the formula. This will
introduce { } characters around the
formula {=A+B} which indicate an
array operation. YOU CANNOT
SIMPLY TYPE THE BRACES.
• You should see the result in the area
highlighted (in green above).
Examples of matrix operations
You can use the method
described above to subtract
(element by element) or For
scalar multiplication (multiply
all elements by the same
value). For example: {=3*A}
would produce a new array
with all values in A multiplied
by 3. A*B matrix {A + 3 )
Matrix multiplication of two matrices
• Matrix multiplication requires that the two
matrices are “conformable” (that is, appropriate
number of rows and columns).
• The number of columns in the first matrix must
equal the number of rows in the second matrix.
• For example, you can multiply A(2,5)xB(5,3)
because the “inner” numbers are the same.
• The size of the result is governed by the “outer”
numbers, in this case (2,3).
• This should also suggest that AxB ≠ BxA
• For example, the result of A(2,5)xB(5,2) would be
C(2,2) and the result of B(5,2)xA(2,5) is C(5,5).
Matrix multiplication of two matrices

• To multiply two matrices, use the


MMULT function.
• =MMULT(first_matrix,second_matrix)
• Remember you must highlight the
destination matrix BEFORE completing
the formula with Shift-Control-Enter!

MMULT(B,A)
MMULT(A,B)

12 12 22

-3 -3 -24

-8 -10 -3
TRANSPOSE OF A MATRIX
TRANSPOSE(D)
MATRIX D
22 1 3
22 0 -7
0 6 9
1 6 5

3 9 3 -7 5 3

MATRIX INVERSION. MINVERSE(B)

DETERMINANT OF MATRIX MDETERM(array)

The determinant of a matrix is


a single value and is often
encountered in solving systems
of equations. Only square
matrices have a determinant
CLASS EXERCISE
Find
1. the inverse, transpose of the following,
2. the matrix multiplication of A and B
3. the determinant of matrix B
CLASS EXERCISE
Solve the following system of equations
1. Enter the data for the coefficient matrix and the
constant matrix (as shown).
2. Find the inverse of the coefficient matrix:
• Highlight: cells A9 to E13
• Type: =MINVERSE(A2:E6)
• Remember to CTRL+SHIFT+ENTER
3. Multiply the "inverse matrix" by the constant matrix:
• Highlight: cells G9 to G13
• Type: = MMULT(A9:E13,G2:G6)
• Remember to CTRL+SHIFT+ENTER.
 The answers to the given system will appear in the
resulting matrix.
 In the given example, the solutions are:
v = 1, w = 2, x = 3, y = 4, z = 5

Potrebbero piacerti anche