Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB: Help me make RREF using pesudocode Algorithm1 Here are my 3 row operations function [B] = interchange(A, i, j) [row,col]=size(A); if(i>row || j>row ||

image text in transcribedimage text in transcribed

MATLAB: Help me make RREF using pesudocode Algorithm1

Here are my 3 row operations

function [B] = interchange(A, i, j) [row,col]=size(A); if(i>row || j>row || row==col) disp('Error : Array index out of range'); else for k=1:col temp=A(i,k); A(i,k)=A(j,k); A(j,k)=temp; end end B=A; end

function [B] = scaling(A, i, s) [row,col]=size(A); if(i>row || row==col) disp('Error : Array index out of range'); else for k=1:col A(i,k)=s*A(i,k); end end B=A; end

function [B] = replacement(A, i, j, s) [row,col]=size(A); if(i>row || j>row || row==col) disp('Error : Array index out of range'); else for k=1:col A(i,k)=A(i,k)+s*A(j,k); end end B=A; end

3 RREF (40 points) Next, you will use these row operations to write a function that performs Gauss- Jordan elimination and compute the reduced row echelon form of any matrix. We will call the function sy rref, because the rref function already exists in MATLAB Specification: function R = sy.rref (A) Input: a rectangular matrix A. Output: the reduced row echelon form of A. For full credit, your function should handle the following: Partial pivoting: At each step, you should swap the current row with the one whose entry in the pivot column has the largest absolute value. Free variables: Due to numerical error, the entries in a column corre- sponding to a free variable may be extremely small but not precisely zero. Therefore, you should consider an entry to be zero if its absolute value is smaller than 10-12 We suggest first implementing the algorithm without considering these two issues, then adding code to deal with them one at a time. Implementation tips: There are two different ways one can implement Gauss-Jordan elimination. . In Section 1.2 under The Row Reduction Algorithm", the book describes it in two phases: first do Gaussian elimination (Steps 1-4), then perform row operations equivalent to back-substitution (Step 5). Gauss-Jordan elimination can also be done in a single phase: every time you find a pivot, perform scaling so the pivot entry becomes 1, then perform elimination on all the other rows, both above and below the pivot row. You may use either approach in your implementation. Below, we provide pseudocode for the latter approach. In either case, since we want to be able to handle free variables, the pivot 80+ 0 % 0 0 % * entry won't necessarily be on the di- 000 agonal. Instead, you'll need to keep k 0 0 0 0 track of both the pivot row, say k, and 0 0 0 0 the pivot column, l, as you go along: 0 0 0 0 see the illustration on the right. Algorithm 1 RREF 1: initialize pivot row k= 1. pivot column l=1 2: while 13km and 1

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

PC Magazine Guide To Client Server Databases

Authors: Joe Salemi

1st Edition

156276070X, 978-1562760700

More Books

Students also viewed these Databases questions

Question

Choosing Your Topic Researching the Topic

Answered: 1 week ago

Question

The Power of Public Speaking Clarifying the

Answered: 1 week ago