Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Just need MATLAB code. Write a separate program (script M-file called test_P2p1_LastName) to verify that your code works correctly. This program should define the coefficient

image text in transcribed

Just need MATLAB code. Write a separate program (script M-file called test_P2p1_LastName) to verify that your code works correctly. This program should define the coefficient matrix. 'A', and the constant vector, 'b', for each of the following five systems, use format short and compute the five corresponding answers for x two ways (as a check): using your own Gaussian Elimination code to find x; and extracting x from the answer to MATLAB's rref function with argument aug: 1. 2. 3x + 4x2 + x3 = 7 2x1 - 2x2 + x3 = -1 5x1 + 4x2 + 0.4x3 = 9 X2 + x3 = 12 Xi - 2x2 + x3 = 1 7x1 + 2x2 + 2x3 = 8 3. X1 - x2 + 2x3 = 22 4x2 = 44 2x2 + x3 = 9 4. From lecture 8, p. 13 0.0005x1 + x2 = 1 X1 + X2 = 2 5. -x2 + 2x3 + x4 + x = 4 x1 - x2 + x3 + x4 + x3 = 4 2x1 + x2 + 3x3 + 2xy + 2xs = 12 21 - 32 4x3 - 3x4 = 7 -X1 + 5x2 - X5 = -1 Your test_P2pl_LastName program should print a table with multiple rows (one row for each answer for each of the five tested systems) and two columns (one column for the GE answers and one for the tref(aug) answers) in the body of the table. It should look something like this, with row labels (shown on the left) and column labels (shown at the top of the two columns): x_from_GE x_from_rref(aug) Sys1_x1 Hint: type Sys1_ x2 >> doc printmat Sys1_x3 Sys2_x1 : Sys5_x4 Sys5_x5 If your answers are not the same (using GE and rref), you should continue to debug your code until they agree. (Note that zero values will sometimes look different.) When you are happy with your code for Part I, verify that your code works correctly (giving an error statement) if your input augmented matrix contains a non-square coefficient matrix A. Show this by inputting the augmented matrix: A = [1 2 3; 569] and b = [4 1]' (representing 2 equations in 3 unknowns). Just need MATLAB code. Write a separate program (script M-file called test_P2p1_LastName) to verify that your code works correctly. This program should define the coefficient matrix. 'A', and the constant vector, 'b', for each of the following five systems, use format short and compute the five corresponding answers for x two ways (as a check): using your own Gaussian Elimination code to find x; and extracting x from the answer to MATLAB's rref function with argument aug: 1. 2. 3x + 4x2 + x3 = 7 2x1 - 2x2 + x3 = -1 5x1 + 4x2 + 0.4x3 = 9 X2 + x3 = 12 Xi - 2x2 + x3 = 1 7x1 + 2x2 + 2x3 = 8 3. X1 - x2 + 2x3 = 22 4x2 = 44 2x2 + x3 = 9 4. From lecture 8, p. 13 0.0005x1 + x2 = 1 X1 + X2 = 2 5. -x2 + 2x3 + x4 + x = 4 x1 - x2 + x3 + x4 + x3 = 4 2x1 + x2 + 3x3 + 2xy + 2xs = 12 21 - 32 4x3 - 3x4 = 7 -X1 + 5x2 - X5 = -1 Your test_P2pl_LastName program should print a table with multiple rows (one row for each answer for each of the five tested systems) and two columns (one column for the GE answers and one for the tref(aug) answers) in the body of the table. It should look something like this, with row labels (shown on the left) and column labels (shown at the top of the two columns): x_from_GE x_from_rref(aug) Sys1_x1 Hint: type Sys1_ x2 >> doc printmat Sys1_x3 Sys2_x1 : Sys5_x4 Sys5_x5 If your answers are not the same (using GE and rref), you should continue to debug your code until they agree. (Note that zero values will sometimes look different.) When you are happy with your code for Part I, verify that your code works correctly (giving an error statement) if your input augmented matrix contains a non-square coefficient matrix A. Show this by inputting the augmented matrix: A = [1 2 3; 569] and b = [4 1]' (representing 2 equations in 3 unknowns)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Measuring Business Interruption Losses And Other Commercial Damages An Economic Approach

Authors: Patrick A. Gaughan

3rd Edition

1119647916, 9781119647911

More Books

Students also viewed these Accounting questions

Question

Psychological issues associated with officiating/refereeing

Answered: 1 week ago

Question

Problem 5 (15 points) Prove that f(n)=2n2+3n+4 is o(n3)

Answered: 1 week ago

Question

13.1 Explain the strategic role of employee benefits.

Answered: 1 week ago