Write a function that solves a system of linear equations

Assignment Help Computer Engineering
Reference no: EM13371408

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: EM13371408

Questions Cloud

Whats being asked of me i cant do i need help i need this : whats being asked of me i cant do. i need help i need this spreadsheet done because i am sooooo lost. it says refer to
Work-based learning log guidelinesyou must choose and : work-based learning log guidelinesyou must choose and describe one to three theories ideas or management practices from
Build a new and different simulation of your own using : build a new and different simulation of your own using newtons laws of motion and notepad. nbspfor example choose one
Question 1examine how the emergence of the internet is : question 1examine how the emergence of the internet is likely to affect the competitive landscape of the banking
Write a function that 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
1 provide a clear statement of the research topic and the : 1. provide a clear statement of the research topic and the underlying relationship that you are modeling. identify the
The electric power consumed each month by a chemical plant : the electric power consumed each month by a chemical plant is thought to be related to the average ambient temperature
Sas is a leading business analytics software company that : sas is a leading business analytics software company that consistently ranks well in fortune magazines best places to
1 you need to select a different topic topics should be : 1. you need to select a different topic. topics should be sufficiently specific avoiding general topics such as

Reviews

Write a Review

Computer Engineering Questions & Answers

  Draw the binary tree that allocations create

Listing the nodes in the order of their visit for an LNR (inorder) scan.

  Is filename generation happen on variable assignment

Will the following command always rightly loop through each of the positional parameters?

  The decades to include various methodologies

The System Development Life Cycle has developed over the decades to include a variety of Methodologies. Each of these Methodologies utilizes the same methods in a different way. define the primary SDLC Methodologies, their advantages and disadvant..

  Write down a program named gotoofar

Write down a program named GoTooFar in which you declare an array of five integers and store five values in the array. Initialize a subscript to zero. Write a try block in which you access each element of the array, subsequently increasing the sub..

  Cbc-mode encryption

Let a variant of CBC-mode encryption in which the sender simply increments the IV by 1 each time a message is encrypted in place of choosing the IV at random each time.

  Design a detail report that will display all courses

make a switchboard design with control buttons that lead to students, instructors, courses, course schedules, and course rosters. Allow a user to add, update, or delete records in each area. Jesse wants to see storyboards that show the proposed sc..

  Relationship between programming languages and applications

The consultants suggested using object-oriented technology. still the internal information systems team was hesitant to use object-oriented technology. They instead suggested using structured programming.

  Define the type of input data used

express the type of input data used for a business related function.

  Write c program ''myls'' that functions like unix command ''ls''

Write C program 'myls' that functions like unix command 'ls'.

  What are the solutions to address those barriers

What are connectivity standards and how do they affect the capability of one provider to connect to another?

  Give an understanding on the different types of systems

give an understanding on the different types of systems

  Write down a c++ program for little man''s computer

A text file containing machine code (not assembly code) for little man's computer following instruction set . Instructions are in different lines (no need for semicolon at the end of each instruction)

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