Closed

matlab

This project was awarded to TellezMiotta for \$40 USD.

\$10 - \$30 USD
24
Project Description

Simple MATLAB project.

Please have done by Friday 1pm EST

MATLAB

2 parts

Part 1

1. Write a function, named swap, to swap two rows in a matrix. You will pass the matrix and two row numbers to exchange.

2. Write a function that takes a matrix, a row number and a scalar as arguments (inputs) and multiplies each element of the row of the matrix by the scalar returning (outputs) the updated matrix.

3. Write a function that takes a matrix, two row numbers and a scalar as arguments and returns a matrix with a linear combination of the rows. For example, if the rows passed to the function were i and j and the scalar was alpha, each element of row j would become alpha aik + ajk , where k represents columns 1 through the number of columns in the matrix.

4. Write a function that takes a matrix, a row number and a column number. Compare the entry in the row and column inputted by the user to the other entries below it in the same column. Then, return the row number that contains the largest absolute value in the column. For example, if your matrix is [ 1, 9, 4, 5 ; 11, − 2, 3, 0; 0, − 6, 5, 4; 3, 5, 7, − 3 ] and you pass row 2, column 2, the function should return 3. Row 3 has the largest absolute value in column 2 including and below row 2.

Part 2 (requires things from part 1)

Project

Gaussian Elimination with back substitution is a method used to solve a system of linear equations written inthe form Ax=b

where 'A' is the coefficient matrix and 'b' is the constant matrix.

Create a function that accepts 'A' and 'b' and returns the solution of the system of linear equations using

Gaussian Elimination with Back Substitution. The function has two main parts, using: row operations - to obtain 0 for all the entries below the main diagonal and back substitution - to find the solutions of the systemof linear equations. To perform the row operations in this function, call the functions created in Part 1:

swap (Problem 1), linear combination (Problem 3) and finding the row with largest absolute value in a

column (Problem 4).

Note: The row operation of making the main diagonal entry 1 was omitted.

The only MATLAB function allowed is size.

All other MATLAB functions are NOT ALLOWED.

The colon operator (:) CANNOT be used for indexing. For example, B(:,1) or A(2,:).

MATLAB functions for finding inverse of matrices NOT ALLOWED: inv() and A/B or A\B where A and B are

matrices.

Use one file to create the function. The main (first) function for the file is Gaussian Elimination with BackSubstitution and the functions from Part 1 would be sub-functions or local functions.

Format of the File:

function [outputArguments] = MainFunctionName(inputArguments)

%Comment providing function summary.

% Comments explaining inputs, outputs and detailed behavior if [url removed, login to view] Body

%Statements go here.

The function should assign all outputArguments

end

% Local function definition. You would have THREE local functions.

function [outputArguments] = LocalFunctionName(inputArguments)

%Comment providing function summary.

% Comments explaining inputs, outputs and detailed behavior if [url removed, login to view] Body

%Statements go here. The function should assign all outputArguments

end

Provide detailed comments. Explain the inputs and outputs and outline the different steps in the function.

Hire Freelancers who also bid on this project

• Forbes
• The New York Times
• Time
• Wall Street Journal
• Times Online