Solves a system of linear equations

Assignment Help Computer Engineering
Reference no: EM1384111

Write a function that solves a system of linear equations or calculates the inverse of a matrix by Gauss-Jordan elimination.  Your function should accept a matrix as an argument and return a matrix of the same dimension.

Note: Your function should be written to handle matrices of any size. Test your function with matrices of different sizes for which you know the solution to ensure that your function works correctly.

Use variable names that relate to their function and include comments that explain your program logic.

Do not use any built-in MATLAB functions except size(), input(), and zeros().

As example of what is expected from this function consider the following linear system:

3x + 2y + z = 11

2x + 3y +z = 13

x + y + 4z = 12

In this case you should pass into your function the following augmented matrix:

2341_calculates the inverse of a matrix by Gauss-Jordan elimination.png

After performing Gauss-Jordan elimination, your function should return the following reduced system:

1107_calculates the inverse of a matrix by Gauss-Jordan elimination1.png

from which we can readily determine that x = 1, y = 3, z = 2.

Furthermore, if you pass a double augmented matrix such as

1435_calculates the inverse of a matrix by Gauss-Jordan elimination2.png

Your function should return

441_calculates the inverse of a matrix by Gauss-Jordan elimination3.png

which solves the original equations

3x + 2y + z = 11

2x + 3y +z = 13

x + y + 4z = 12

as x = 1, y = 3, z = 2

and, at the same time, the equations

3x + 2y + z = -5

2x + 3y +z = -4

x + y + 4z = 9

as x = -2, y = -1, z = 3.

Additionally, if you pass to your function a square matrix on the left augmented by the identity matrix on the right, such as

705_calculates the inverse of a matrix by Gauss-Jordan elimination4.png

your function should return the identity matrix on the left and the inverse of the original square matrix on the right.

Reference no: EM1384111

Questions Cloud

Theory of broken windows : Public disorganization policies as influenced by the Broken Windows theory seem to have been effective. Can you find evidence that either lends support to or further weakens the continued use of such policies?
How would you ensure that your limited sources : If you were CEO of Marriott, how would you ensure that your limited sources of capital were used strategically? In a recessionary economy, would you invest in existing property upkeep and improvement or would you build new hotels?
Homologous chromosomes in the cell during g1 : based on diploid cell that has 28 chromosomes in G1 of interphase, Discuss how many pairs of homologous chromosomes are in the cell during g1?
What are the culturally contingent leadership behaviors : What are the culturally contingent leadership behaviors and attributes? What are the positive leadership behaviors and traits that are universally accepted that facilitate leadership effectiveness?
Solves a system of linear equations : Write a function that solves a system of linear equations or calculates the inverse of a matrix by Gauss-Jordan elimination.
Explain the historical relationships between risk : Explain the historical relationships between risk and return for common stocks versus corporate bonds.
Differential settlement between the centre line of the ring : Determine the differential settlement between the centre line of the ring beam and under the centre of beam. The inner and outer radii of the ring beam are 8m and 12m respectively.
What do you meant by a social problem : Critically discuss what is meant by a social problem and provide examples of social problems that could exist in a community. Select one social problem and describe where you could begin to make a difference locally.
Explain the process of financial planning used to estimate : Explain the process of financial planning used to estimate asset investment requirements for a corporation. Explain the concept of working capital management.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Prepare a use case diagram

Prepare a Use Case Diagram based on the given problem description.

  Why program needs to handle the error

Prompt user to enter the size of matrix n and m. Your program must accept any n x m matrix and m vectors where n and m are positive integer less than 10.

  Investigating a social engineering attack

Investigate a social engineering attack describing what has made this attack more successful and the information which was observed from this attack is sure to involve how could this attack be avoided.

  Explaining the binary tree

The left spine of the binary tree is a path starting at root and following only left-child pointers down to a leaf. State the expected number of nodes in left spine of an n-node treap. What is the expected number of leaves in an n-node treap?

  What are the kinds of information systems

What are the kinds of information systems

  Knowledge revolution and industrial revolution

What are your thought on this that would support notion that Knowledge Revolution was born from the Industrial Revolution?

  Make a binary tree using an underlying linked-list approach

Write down a C++ program to build a binary tree using an underlying linked-list approach. Include capability to traverse the tree and print out the nodes in a format which makes it readily clear how the tree is organized.

  What are java predefined methods

What are java predefined methods

  Design a class diagram for the ticket-processing system

Design a class diagram for the ticket-processing system

  Explain the importance of having a test coupled

Many will argue that it is considered a good practice to acknowledge the limitation of your research/project. Could you defend this argument.

  Sql query to determine lowest, highest, average salary

Let's assume that we wanted to determine the lowest, highest, average and total number of the salaries by department in company. What SQL query would provide us this.

  Define reasons for these recommendations

You have been asked by Champions, a local charity retail organization, to install the network in its downtown office. It currently just received the donation of four PCs running Windows XP Home Edition.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd