Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

% Lab_4_Gauss Elimination.m Name: Date: clear all%Clear (remove from memory) all variables, functions, items clo %Clear Command Window A = [2 -4 10 23; 11

image text in transcribed
image text in transcribed
% Lab_4_Gauss Elimination.m Name: Date: clear all%Clear (remove from memory) all variables, functions, items clo %Clear Command Window A = [2 -4 10 23; 11 11 101 0; -2-8-13-14) % 3 by 4 matrix %A-2-4 10 23 -67; 11 11 1010 13:-2-8-13-14 91: 1 15-18 176] % 4 by 5 matrix %A-(12-2 11 22-37 13; 10 10 101 013-41;-12-9-13-14 91 22; % continues to % 12 15-18-176 -4;4-21-28 29 -22 24] %5 by 6 matrix (m,n) - size(A) % Check if the defined matrix above is the format applicable to our script ifn=m+1 fprintf("Your defined matrix is a %g by %g matrix \t", m, n) fprintf("Please redefine the matrix and re-run the script ') error('This script is only applicable to am by n matrix with nm+1) end % To make the elements in the first column zero % Use a for-loop to perform Gauss elimination in the first column of the % matrix using element A(1,1) as pivot for k=2:m % Looping to change row 2 to row m if A(1,1)=0 %if A(1,1), the pivot, is not zero A(k) --A(1,-)*A(k. 17A(1,1)+A(k.:) else error('Pivot element cannot be zero at Ag%),1,1) end end Make sure the program runs correctly for the current 3 by 4 matrix. What is the matrix A after running the program? Make another for-loop to do Guus elimination in the second column. What is your new pivot? What is the matrix A now? Page 4 of 6 Try the following commands to replace the for-loop in the previous script. Explain what each command in the following textbox is doing. A = [2 -4 10 23; 11 11 101 0; -2 -8 -13 -14] for j=1:m-1 % Performing the Gauss elimination process for i=j+lim A(1,: --AG.:)A(ij)AGJ)+A(1,:) end end What is the matrix A now? Solve the same problem you solved by hand at the beginning using your MATLAB program What is the row echelon form? What is the matrix A at the beginning and at the end after running the program

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

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions

Question

What proactive strategies might you develop?

Answered: 1 week ago

Question

=+applying to all or most employers and employees?

Answered: 1 week ago

Question

=+associated with political parties and if so, which ones? Are

Answered: 1 week ago