Option Explicit

Option Explicit - OptionExplicit SubGauss_Elimination...

This preview shows pages 1–2. Sign up to view the full content.

Option Explicit                               Sub Gauss_Elimination() Dim a(10, 11) As Double                                          'Extra column for augmented matrix Dim row As Integer, col As Integer Dim row_begin As Integer, col_begin As Integer Dim i As Integer, j As Integer row = Cells(1, 2).Value                                          'Obtaining matrix dimensions from  spreadsheet col = row + 1 row_begin = row + 2                                              'Writes output headings col_begin = 1 Cells(row_begin, col_begin).Value = "Eliminated Matrix" row_begin = 2 * row + 2 col_begin = 1 Cells(row_begin + 1, col_begin).Value = "Solution Vector" row_begin = 0                                                    'Sets beginning location of input matrix col_begin = 3 For i = 1 To row                                                 'Gets matrix from spreadsheet     For j = 1 To col         a(i, j) = Cells(row_begin + i, col_begin + j).Value     Next j Next i Eliminate a, row                                                 'Calls subroutine to do Gauss Elimination row_begin = row + 1                                              'Sets beginning location of output  matrix col_begin = 3 For i = 1 To row                                                 'Puts matrix into spreadsheet     For j = 1 To col         Cells(row_begin + i, col_begin + j).Value = a(i, j)     Next j Next i Back_Solve a, row row_begin = 2 * row + 2                                          'Sets beginning location of solution  vector col_begin = 4 + row For i = 1 To row                                                 'Puts solution vector into spreadsheet     Cells(row_begin + i, col_begin).Value = a(i, row + 1) Next i End Sub                                                          'Finish Sub Eliminate(a, max)                                            'Subroutine to perform Gauss

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 5

Option Explicit - OptionExplicit SubGauss_Elimination...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online