Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using MATLAB, how do I perform this code? Write a function that uses Gauss Elimination to put zeros in a column of a matrix below

image text in transcribed Using MATLAB, how do I perform this code?

Write a function that uses Gauss Elimination to put zeros in a column of a matrix below a given row. The zeros will go in the same column as the row number beginning at the next row down. For example, if 1 is passed as the row number, zeros would go in column 1 beginning in row 2, the row below row 1. Use linear combinations of rows as in Gauss Elimination to put the zeros in the correct place and adjust all the other elements in the row. This is the same as Gauss Elimination except you only need to zero one column. Swap rows when necessary. The arguments passed to the function are the matrix and the row number. The function should work with any size matrix. Use loops and indexing for the calculations. Do not use MATLAB-specific indexing operators' and 'end', such as AC: ,3) or A(:, end). You must use the functions in Canvas. The function Row Compl) will return the row number with the largest absolute value in the column passed to the function. If the number returned from RowComp() is greater than the row passed to the function, the rows must be swapped. Use the Swap() function in Canvas to exchange two rows in a matrix. The Canvas functions should be local functions in your m-file copied and pasted after your function. For example, if the function is named 'ZeroCol()' and is called with: A = [45 46 8 -44 -27 -15 32 -49 -46 -33 15 23 15 -5 5 -21 25 -31 19 -32] array=Zerocol (A,1), MATLAB will display: array = 46.0000 0 0 0 -15.0000 -12.3261 34.6087 -63.3478 -33.0000 -13.7174 20.7391 -8.5652 -5.0000 19.8913 5.8696 -25.7826 -31.0000 55.3261 24.3913 -61.6522 array=Zerocol (A, 2), MATLAB will display: array = 45.0000 -44.0000 8.0000 46.0000 -27.0000 -49.0000 0.0000 0 -46.0000 23.0000 30.0204 -40.0408 15.0000 -21.0000 -8.7143 1.4286 25.0000 -32.0000 -1.8980 -21.2041 Write a function that uses Gauss Elimination to put zeros in a column of a matrix below a given row. The zeros will go in the same column as the row number beginning at the next row down. For example, if 1 is passed as the row number, zeros would go in column 1 beginning in row 2, the row below row 1. Use linear combinations of rows as in Gauss Elimination to put the zeros in the correct place and adjust all the other elements in the row. This is the same as Gauss Elimination except you only need to zero one column. Swap rows when necessary. The arguments passed to the function are the matrix and the row number. The function should work with any size matrix. Use loops and indexing for the calculations. Do not use MATLAB-specific indexing operators' and 'end', such as AC: ,3) or A(:, end). You must use the functions in Canvas. The function Row Compl) will return the row number with the largest absolute value in the column passed to the function. If the number returned from RowComp() is greater than the row passed to the function, the rows must be swapped. Use the Swap() function in Canvas to exchange two rows in a matrix. The Canvas functions should be local functions in your m-file copied and pasted after your function. For example, if the function is named 'ZeroCol()' and is called with: A = [45 46 8 -44 -27 -15 32 -49 -46 -33 15 23 15 -5 5 -21 25 -31 19 -32] array=Zerocol (A,1), MATLAB will display: array = 46.0000 0 0 0 -15.0000 -12.3261 34.6087 -63.3478 -33.0000 -13.7174 20.7391 -8.5652 -5.0000 19.8913 5.8696 -25.7826 -31.0000 55.3261 24.3913 -61.6522 array=Zerocol (A, 2), MATLAB will display: array = 45.0000 -44.0000 8.0000 46.0000 -27.0000 -49.0000 0.0000 0 -46.0000 23.0000 30.0204 -40.0408 15.0000 -21.0000 -8.7143 1.4286 25.0000 -32.0000 -1.8980 -21.2041

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_2

Step: 3

blur-text-image_3

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

Core Concepts Of Accounting

Authors: Leslie K. Breitner, Robert N. Anthony

10th Edition

0136029442, 9780136029441

More Books

Students also viewed these Accounting questions

Question

Compare the group and composite methods of depreciation.

Answered: 1 week ago

Question

We are interviewing quite a few people, why should we hire you?

Answered: 1 week ago