Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / CEE 384 Numerical Methods for Engineers Fall 2016 Arizona State University MATLAB Assignment #5   Please read “MATLAB Assignment Submission Guidelines” in Blackboard before submission

CEE 384 Numerical Methods for Engineers Fall 2016 Arizona State University MATLAB Assignment #5   Please read “MATLAB Assignment Submission Guidelines” in Blackboard before submission

Math

CEE 384 Numerical Methods for Engineers Fall 2016 Arizona State University

MATLAB Assignment #5

 

Please read “MATLAB Assignment Submission Guidelines” in Blackboard before submission.  Not following the guidelines will result in loss of credit, even though you may have the correct answer(s).

 

Write code of your own and answer the questions in this assignment.

  • Submit your code through Cody Coursework for problem 1.1 and 2.1. 
  • Submit a report through Blackboard

 

Naive Gauss Elimination, Gaussian elimination with partial pivoting and LU decomposition are the basis of this assignment.  

[Hints] Consider using nested loops in your code, and MATLAB vector/matrix operations wherever appropriate to replace unnecessary loops and simplify your code.

 

 

Problem 1

 

1) Decompose a Matrix Using Naive Gauss Elimination:

 

Write a MATLAB function to perform LU decomposition using Naive Gauss elimination.  You’ll need to employ nested loops in this assignment.  Do not use the “lu” command in your code.

 

Your function should meet the following requirements:

  • It should be named luDecompose
  • The function should have one input argument: the square matrix (
    -by-
    ) to be decomposed.  In this assignment, assume this matrix is nonsingular and no division by zero occurs during the forward elimination of naive Gauss elimination.
  • The function should have two output arguments stored as an
     -by-???????????????? matrix:
    1. the lower triangular matrix, stored in the left submatrix; and 2) the upper triangular matrix, stored in the right submatrix.
  • In each iteration of the forward elimination, the function should display on screen  1) the current iteration number; and
    1. the current coefficient matrix resulted from forward elimination.
  • At the end of your function, display the final lower and upper triangular matrices on screen.

 

Your solution will be tested three times with both known and randomly generated input arguments.

  • Test 1: with input argument
     
  • Test 2: with input argument
     
  • Test 3: with magic(5)
  • Test 4: with random input matrix

 

 

Page 1 of 2

 

CEE 384 Numerical Methods for Engineers Fall 2016 Arizona State University

School of Sustainable Engineering and The Built Environment Dr. Lou and Lawrence

2) Compare Built-in Function with Your Code:

Using “lu” command to decompose

 into a lower- and an upper triangular matrix. 

 

Compare the results of your code in question 1) to those of the “lu” command.  Are the results different?  If yes, why?

 

 

 

Problem 2

1) Gaussian Elimination with partial pivoting:

 

Write a MATLAB function to solve linear equations.  You’ll need to employ nested loops in this assignment. 

 

Your function should meet the following requirements:

  • It should be named pivGauss
  • The function should have one input argument: the augmented matrix (
    -by-(???????? + 1)) representing a system of
     linear equations.  In this assignment, assume the coefficient matrix is nonsingular.
  • The function should have two output arguments stored as an
    -by-(???????? + ????????) matrix
    1. the resulting matrix from the forward elimination process using Gauss elimination with partial pivoting; and
    2. the solution to the system of linear equations as a column vector, stored in the last column of the output matrix.
  • In each iteration of the forward elimination process, the function should display on screen  1) the current iteration number; 

2) the current coefficient matrix, resulted from forward elimination with partial pivoting; and  3) the current right-hand side vector, resulted from forward elimination with partial pivoting.

  • At the end of the function, display your solution to the system of linear equations.

 

 

Your solution will be tested three times with both known and randomly generated input arguments.

  • Test 1: with input arguments
     
  • Test 2: with random input arguments
  • Test 3: with random input arguments

 

 

2) Solve the System of Linear Equations:

Using “mldivide” or “\” command, solve the system of linear equations and compare the results to those from your program.

 

Page 2 of 2

 

Option 1

Low Cost Option
Download this past answer in few clicks

9.98 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE