using microsoft excel built-in functions and matrix operations

Download Using Microsoft Excel Built-in Functions and Matrix Operations

If you can't read please download the document

Upload: barnard-clarence-newton

Post on 13-Jan-2016

221 views

Category:

Documents


2 download

TRANSCRIPT

  • Using Microsoft Excel Built-in Functions and Matrix Operations

  • Excel Embedded FunctionsExcel has a wide variety of Built-in Functions: Mathematical Financial Statistical Logical Database Conversion User-defined ***

  • Excel Embedded FunctionsThese functions allow us to : Perform more complex operations Combine data for parametric calculations Manipulate the contents of the datasheet Search for values in the datasheet

  • Excel Embedded FunctionsExample: Open Excel and start from an empty datasheet and enter the following data:

    txV00.511.522.533.544.555.566.577.588.599.510

  • Excel Embedded Functions Enter the following formula for an oscillating particle position at any time t with a frequency =0.75By clicking in the fx button or entering:=sin(0.75*A2)on cell B2

    txV000.50.36627310.6816391.50.90226820.9974952.50.95408630.7780733.50.4939240.141124.5-0.231295-0.571565.5-0.832396-0.977536.5-0.986817-0.858937.5-0.611688-0.279428.50.09168690.4500449.50.745853100.938

  • Excel Embedded Functions Plot the position x(t) as:

    Chart2

    0

    0.3662725291

    0.68163876

    0.9022675941

    0.9974949866

    0.9540857816

    0.7780731969

    0.4939202986

    0.1411200081

    -0.2312938124

    -0.5715613187

    -0.8323905146

    -0.9775301177

    -0.9868079357

    -0.8589344934

    -0.61168225

    -0.2794154982

    0.0916857485

    0.4500440738

    0.7458531332

    0.9379999768

    x

    Sheet1

    txV

    000.75

    0.50.36627252910.6978807164

    10.681638760.5487666517

    1.50.90226759410.3233823876

    20.99749498660.0530529013

    2.50.9540857816-0.2246501296

    30.7780731969-0.471130217

    3.50.4939202986-0.6521303861

    40.1411200081-0.7424943725

    4.5-0.2312938124-0.7296629595

    5-0.5715613187-0.615419518

    5.5-0.8323905146-0.4156421449

    6-0.9775301177-0.1580968496

    6.5-0.98680793570.1214214978

    7-0.85893449340.3840641079

    7.5-0.611682250.5933276617

    8-0.27941549820.720127715

    8.50.09168574850.7468409934

    90.45004407380.6697547585

    9.50.74585313320.4995828218

    100.93799997680.2599764884

    Sheet1

    x

    Sheet2

    V

    Sheet3

  • Excel Embedded Functions Enter the following formula for the particle velocity at any time t with a frequency =0.75By clicking in the fx button or entering:=0.75*cos(0.75*A2)on cell C2

    txV000.750.50.3662730.69788110.6816390.5487671.50.9022680.32338220.9974950.0530532.50.954086-0.2246530.778073-0.471133.50.49392-0.6521340.14112-0.742494.5-0.23129-0.729665-0.57156-0.615425.5-0.83239-0.415646-0.97753-0.15816.5-0.986810.1214217-0.858930.3840647.5-0.611680.5933288-0.279420.7201288.50.0916860.74684190.4500440.6697559.50.7458530.499583100.9380.259976

  • Excel Embedded Functions Plot the velocity V(t) as:

    Chart3

    0.75

    0.6978807164

    0.5487666517

    0.3233823876

    0.0530529013

    -0.2246501296

    -0.471130217

    -0.6521303861

    -0.7424943725

    -0.7296629595

    -0.615419518

    -0.4156421449

    -0.1580968496

    0.1214214978

    0.3840641079

    0.5933276617

    0.720127715

    0.7468409934

    0.6697547585

    0.4995828218

    0.2599764884

    V

    Sheet1

    txV

    000.75

    0.50.36627252910.6978807164

    10.681638760.5487666517

    1.50.90226759410.3233823876

    20.99749498660.0530529013

    2.50.9540857816-0.2246501296

    30.7780731969-0.471130217

    3.50.4939202986-0.6521303861

    40.1411200081-0.7424943725

    4.5-0.2312938124-0.7296629595

    5-0.5715613187-0.615419518

    5.5-0.8323905146-0.4156421449

    6-0.9775301177-0.1580968496

    6.5-0.98680793570.1214214978

    7-0.85893449340.3840641079

    7.5-0.611682250.5933276617

    8-0.27941549820.720127715

    8.50.09168574850.7468409934

    90.45004407380.6697547585

    9.50.74585313320.4995828218

    100.93799997680.2599764884

    Sheet1

    x

    Sheet2

    V

    Sheet3

  • Excel Embedded Functions We can also perform multi-dimensional calculations: Assume that the temperature of the surface of an electronic 3x3 board is given by the function:

  • Excel Embedded Functions Enter the following data for the position (x,y):

    xy00.250.50.7511.251.51.7522.252.52.75300.250.50.7511.251.51.7522.252.52.753

  • Excel Embedded Functions Use the formula for the surface temperature on cell B3 as: = EXP(0.1*(B$2+$A3))*SIN(B$2-1)*COS($A3-1)

    Sheet1

    txV

    000.75

    0.50.36627252910.6978807164

    10.681638760.5487666517

    1.50.90226759410.3233823876

    20.99749498660.0530529013

    2.50.9540857816-0.2246501296

    30.7780731969-0.471130217

    3.50.4939202986-0.6521303861

    40.1411200081-0.7424943725

    4.5-0.2312938124-0.7296629595

    5-0.5715613187-0.615419518

    5.5-0.8323905146-0.4156421449

    6-0.9775301177-0.1580968496

    6.5-0.98680793570.1214214978

    7-0.85893449340.3840641079

    7.5-0.611682250.5933276617

    8-0.27941549820.720127715

    8.50.09168574850.7468409934

    90.45004407380.6697547585

    9.50.74585313320.4995828218

    100.93799997680.2599764884

    Sheet1

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    x

    Sheet2

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    0

    V

    Sheet3

    x

    00.250.50.7511.251.51.7522.252.52.753

    0-0.4546487134-0.3776143247-0.2723157183-0.144083932300.15147127350.30095541240.4387252530.55530919260.64211416880.69202401060.69993337010.663179553

    0.25-0.631281345-0.5243188241-0.378111337-0.200061049100.21031839840.41787765350.60917156390.7710487760.89157779220.96087778390.97185995750.9208271526

    0.5-0.7763219299-0.6447841436-0.4649846304-0.246026246400.25864028180.51388749090.74913229720.94820174641.09642300971.18164508021.19515047251.1323925819

    0.75-0.8788115483-0.7299082117-0.5263716601-0.278506503800.29278583760.58173065080.84803235441.07338284911.24117220671.33764525071.35293361791.2818904631

    1-0.9299692608-0.7723979065-0.5570130076-0.294719030400.30982959830.6155945770.89739833671.13586702021.31342379581.41551276541.43169110481.3565123588

    1.25-0.9238691799-0.767331406-0.5533593122-0.292785837600.30779728850.61155661910.8915119031.12841636461.30480846651.40622778931.42230000781.3476143926

    1.5-0.85796842-0.7125966839-0.5138874909-0.271901052600.28584171770.56793351010.82791922861.04792499461.21173482431.30591977821.3208455451.2514873494

    1.75-0.7334442834-0.6091715639-0.4393026989-0.232437777500.24435511720.48550456710.70775638270.89583087071.0358656091.11638071241.12914017771.0698485175

    2-0.5553091926-0.4612191777-0.3326071694-0.175984512300.18500743120.36758777080.53586023410.67825617940.78428001680.84524003530.85490054880.8100093352

    2.25-0.3322845705-0.2759832152-0.199024673-0.105305186500.11070429890.21995628060.32064674980.40585329090.46929557810.50577268640.51155332110.4846914254

    2.5-0.0764294336-0.0634794471-0.0457780601-0.02422145500.02546331550.05059258070.07375259540.0933511210.10794360740.11633377950.11766339480.1114848368

    2.750.19746496670.16400706270.11827332320.06257914750-0.065787649-0.1307122372-0.1905490215-0.2411842549-0.2788857621-0.3005628173-0.303998044-0.2880349695

    30.47268746720.39259664320.28312018350.14980064170-0.1574810848-0.3128961931-0.4561322236-0.5773417762-0.6675908479-0.7194809248-0.727704098-0.6894920274

    Sheet3

    0

    0.25

    0.5

    0.75

    1

    1.25

    1.5

    1.75

    2

    2.25

    2.5

    2.75

    3

    x

    T

    y

  • Excel Embedded Functions Use a surface graph to plot T(x,y) as:

    Chart1

    -0.4546487134-0.631281345-0.7763219299-0.8788115483-0.9299692608-0.9238691799-0.85796842-0.7334442834-0.5553091926-0.3322845705-0.07642943360.19746496670.4726874672

    -0.3776143247-0.5243188241-0.6447841436-0.7299082117-0.7723979065-0.767331406-0.7125966839-0.6091715639-0.4612191777-0.2759832152-0.06347944710.16400706270.3925966432

    -0.2723157183-0.378111337-0.4649846304-0.5263716601-0.5570130076-0.5533593122-0.5138874909-0.4393026989-0.3326071694-0.199024673-0.04577806010.11827332320.2831201835

    -0.1440839323-0.2000610491-0.2460262464-0.2785065038-0.2947190304-0.2927858376-0.2719010526-0.2324377775-0.1759845123-0.1053051865-0.0242214550.06257914750.1498006417

    0000000000000

    0.15147127350.21031839840.25864028180.29278583760.30982959830.30779728850.28584171770.24435511720.18500743120.11070429890.0254633155-0.065787649-0.1574810848

    0.30095541240.41787765350.51388749090.58173065080.6155945770.61155661910.56793351010.48550456710.36758777080.21995628060.0505925807-0.1307122372-0.3128961931

    0.4387252530.60917156390.74913229720.84803235440.89739833670.8915119030.82791922860.70775638270.53586023410.32064674980.0737525954-0.1905490215-0.4561322236

    0.55530919260.7710487760.94820174641.07338284911.13586702021.12841636461.04792499460.89583087070.67825617940.40585329090.093351121-0.2411842549-0.5773417762

    0.64211416880.89157779221.09642300971.24117220671.31342379581.30480846651.21173482431.0358656090.78428001680.46929557810.1079436074-0.2788857621-0.6675908479

    0.69202401060.96087778391.18164508021.33764525071.41551276541.40622778931.30591977821.11638071240.84524003530.50577268640.1163337795-0.3005628173-0.7194809248

    0.69993337010.97185995751.19515047251.35293361791.43169110481.42230000781.3208455451.12914017770.85490054880.51155332110.1176633948-0.303998044-0.727704098

    0.6631795530.92082715261.13239258191.28189046311.35651235881.34761439261.25148734941.06984851750.81000933520.48469142540.1114848368-0.2880349695-0.6894920274

    0

    0.25

    0.5

    0.75

    1

    1.25

    1.5

    1.75

    2

    2.25

    2.5

    2.75

    3

    Sheet1

    txV

    000.75

    0.50.36627252910.6978807164

    10.681638760.5487666517

    1.50.90226759410.3233823876

    20.99749498660.0530529013

    2.50.9540857816-0.2246501296

    30.7780731969-0.471130217

    3.50.4939202986-0.6521303861

    40.1411200081-0.7424943725

    4.5-0.2312938124-0.7296629595

    5-0.5715613187-0.615419518

    5.5-0.8323905146-0.4156421449

    6-0.9775301177-0.1580968496

    6.5-0.98680793570.1214214978

    7-0.85893449340.3840641079

    7.5-0.611682250.5933276617

    8-0.27941549820.720127715

    8.50.09168574850.7468409934

    90.45004407380.6697547585

    9.50.74585313320.4995828218

    100.93799997680.2599764884

    Sheet2

    xV

    -0.98680793570.1214214978

    -0.9775301177-0.1580968496

    -0.85893449340.3840641079

    -0.8323905146-0.4156421449

    -0.611682250.5933276617

    -0.5715613187-0.615419518

    -0.27941549820.720127715

    -0.2312938124-0.7296629595

    00.75

    0.09168574850.7468409934

    0.1411200081-0.7424943725

    0.36627252910.6978807164

    0.45004407380.6697547585

    0.4939202986-0.6521303861

    0.681638760.5487666517

    0.74585313320.4995828218

    0.7780731969-0.471130217

    0.90226759410.3233823876

    0.93799997680.2599764884

    0.9540857816-0.2246501296

    0.99749498660.0530529013

    Sheet2

    V

    Sheet3

    x >>

    y |00.250.50.7511.251.51.7522.252.52.753

    0-0.4546487134-0.3776143247-0.2723157183-0.144083932300.15147127350.30095541240.4387252530.55530919260.64211416880.69202401060.69993337010.663179553

    0.25-0.631281345-0.5243188241-0.378111337-0.200061049100.21031839840.41787765350.60917156390.7710487760.89157779220.96087778390.97185995750.9208271526

    0.5-0.7763219299-0.6447841436-0.4649846304-0.246026246400.25864028180.51388749090.74913229720.94820174641.09642300971.18164508021.19515047251.1323925819

    0.75-0.8788115483-0.7299082117-0.5263716601-0.278506503800.29278583760.58173065080.84803235441.07338284911.24117220671.33764525071.35293361791.2818904631

    1-0.9299692608-0.7723979065-0.5570130076-0.294719030400.30982959830.6155945770.89739833671.13586702021.31342379581.41551276541.43169110481.3565123588

    1.25-0.9238691799-0.767331406-0.5533593122-0.292785837600.30779728850.61155661910.8915119031.12841636461.30480846651.40622778931.42230000781.3476143926

    1.5-0.85796842-0.7125966839-0.5138874909-0.271901052600.28584171770.56793351010.82791922861.04792499461.21173482431.30591977821.3208455451.2514873494

    1.75-0.7334442834-0.6091715639-0.4393026989-0.232437777500.24435511720.48550456710.70775638270.89583087071.0358656091.11638071241.12914017771.0698485175

    2-0.5553091926-0.4612191777-0.3326071694-0.175984512300.18500743120.36758777080.53586023410.67825617940.78428001680.84524003530.85490054880.8100093352

    2.25-0.3322845705-0.2759832152-0.199024673-0.105305186500.11070429890.21995628060.32064674980.40585329090.46929557810.50577268640.51155332110.4846914254

    2.5-0.0764294336-0.0634794471-0.0457780601-0.02422145500.02546331550.05059258070.07375259540.0933511210.10794360740.11633377950.11766339480.1114848368

    2.750.19746496670.16400706270.11827332320.06257914750-0.065787649-0.1307122372-0.1905490215-0.2411842549-0.2788857621-0.3005628173-0.303998044-0.2880349695

    30.47268746720.39259664320.28312018350.14980064170-0.1574810848-0.3128961931-0.4561322236-0.5773417762-0.6675908479-0.7194809248-0.727704098-0.6894920274

    Sheet3

    0

    0.25

    0.5

    0.75

    1

    1.25

    1.5

    1.75

    2

    2.25

    2.5

    2.75

    3

  • Matrix Operations A Matrix is a collection of independent values ordered in a row-column format: The above Matrix is said to be (3x5) or 3 by 5 because it has 3 rows and 5 columns. The first number is the first dimension or the number of rows. The second number is the second dimension or the number of columns.

  • When a Matrix has just one (1) column (Nx1) is said to be a vector. The following is a (4x1) vector: Matrices are very useful in the solution of systems of multiple linear equations arising from many problems: Electricity, Heat Transfer, Fluid Mechanics, Optics, etc.Matrix Operations

  • The fundamental Matrix operations are:Addition and SubtractionMultiplication by a ScalarTransposeMultiplication of Two MatricesDeterminantInversion

    Matrix Operations

  • Addition and Subtraction: To add or subtract two matrices they both must have the same exact dimensions. The result contains the addition or subtraction of corresponding elements. In Excel, simply enter the matrices, add or subtract the first element of each matrix into a new cell, and copy the cell to form the new matrix:Matrix Operations

    [A]1222(3x4)2-342-123-2[C]=[A]+[B]-1346(3x4)3-465[B]-21241501(3x4)1-12323-33

  • 2.Multiplication by a Scalar: The resulting matrix of a scalar-matrix multiplication has the same dimensions as the original matrix with all its elements multiplied by the scalar. In Excel, simply enter the Matrix and the Scalar, multiply the first element of the matrix times the scalar (with absolute address) into a new cell, and copy the cell to form the new matrix:Matrix Operations

    Scalar5[A]-223[C]=Scalar x [A]-101015(4x3)3-12(4x3)15-5104-2220-101052025100

  • 3. Transpose: The transpose of a matrix positions the rows on the column locations and the columns on the row locations. The result is a Matrix with the opposite dimensions as the original one ( 5x4 4x5). In Excel, use the built-in-function =transpose(). Remember to use [ctrl-shift-enter] when entering the results because the =transpose() function will occupy multiple cells:Matrix Operations

    [A]2-252transpose[A]22102(5x4)2-233(4x5)-2-213411-2453-204030-4234-4-1244-1

  • 4. Multiplication of two Matrices: To multiply two matrices the number of columns of the first matrix must equal the number of rows of the second. The resulting matrix will have as many rows as the first and as many columns as the second. In Excel, use the built-in-function =mmult(,). Remember to use [ctrl-shift-enter] when entering the results because the =mmult(,) function will occupy multiple cells:Matrix Operations

    [A]-242(2x3)331[C]=[A]x[B]861616(2x4)10-519-2[B]1-22-3(3x4)20321141

  • Another Multiplication example:Matrix Operations

    [A]3-22-10[c]=[A]x[b]10(5x5)11-201(5x1)02233-433-33321840-3125[b]2(5x1)1303

  • 5. Determinant: Only the determinants of square matrices can be obtained. The determinant of a singular matrix is zero (0). In Excel, use the built-in-function =mdeterm().Matrix Operations

    [A]3-11-2determinant[A]-40(4x4)222-213211-120

  • 6. Inversion: Only the inverse of square matrices can be obtained. The inverse of a matrix has the same dimensions as the original one. In Excel, use the built-in-function =minverse(). Remember to use [ctrl-shift-enter] when entering the results because the =minverse() function will occupy multiple cells:Matrix Operations

    [A]3-22-10inverse[A]0.190.210.06-0.010.04(5x5)11-201(5x5)0.131.430.120.13-0.622233-40.200.900.050.20-0.553-3332-0.31-0.450.060.090.2440-3120.081.16-0.080.28-0.52

  • Solution of systems of multiple linear equations: If a system of linear equations is well-posed (same number of equations as unknowns and no equation is the combination of one or more of the others) a Matrix-Vector Analogy can be found to facilitate the solution of the system. Given the following system of five (5) equations and five (5) unknowns:Matrix Operations

  • Where the unknowns x1x5 can represent electric intensity, energy, temperature, flow velocities, etc., depending on the application. An analog Matrix-Vector system can be derived as:Or simplified as:Matrix Operations

  • The solution of the system is given by:In Excel:Matrix Operations

    [A]2-321-1{b}4(5x5)-12-1-2-2(5x1)31-1-4-42-131-123-2223-202inverse[A]0.240.240.030.220.03{x}=inv[A]x{b}1.28(5x5)-0.120.16-0.080.120.06(5x1)-0.04-0.06-0.23-0.06-0.130.18-0.250.030.05-0.130.13-0.14-0.13-0.24-0.400.06-0.060.09-1.93