0% found this document useful (0 votes)
41 views5 pages

Lab5 Consistency

The document describes how to test if a system of linear equations is consistent or inconsistent and how to solve it using MATLAB. It explains that the augmented matrix is constructed by appending the column matrix b to the coefficient matrix A. The rank of A and the augmented matrix are calculated and if they are equal, the system is consistent. It then tests if the system has a unique solution, infinite solutions, or is inconsistent for three example systems of linear equations.

Uploaded by

tejas29032005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views5 pages

Lab5 Consistency

The document describes how to test if a system of linear equations is consistent or inconsistent and how to solve it using MATLAB. It explains that the augmented matrix is constructed by appending the column matrix b to the coefficient matrix A. The rank of A and the augmented matrix are calculated and if they are equal, the system is consistent. It then tests if the system has a unique solution, infinite solutions, or is inconsistent for three example systems of linear equations.

Uploaded by

tejas29032005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Laboratory-5 experiments

CONSISTENCY OF SYSTEM OF LINEAR EQUATIONS

Aim: To test whether the system of linear equations is consistent or not and hence to solve.

Procedure: 1) Construct the augmented matrix by appending the column matrix b into A i.e.[A:b]

2) Find the rank of A and [A:b]. If ranks are equal then declare system as
“Consistent” otherwise “Inconsistent”

3) When system is consistent

– it will have unique solution if rank of A = rank of [A:b] = number of unknowns

– it will have infinite solutions if rank of A = rank of [A:b] < number of unknowns

4) Solve the system of equations using “solve” command.

Matlab commands: input, rank

Syntax: input - Prompt for user input.

RESULT = input(PROMPT)

displays the PROMPT string on the screen, waits for input from the keyboard, evaluates any
expressions in the input and returns the value in RESULT.

rank - Matrix rank.

rank(A)

provides an estimate of the number of linearly independent rows or columns of a matrix A

Activities

Test for consistency and hence solve the following systems.

1) 2) 3)
clear

A=input('Enter the Coefficient Matrix')


b=input('Enter the RHS Matrix')

% Construct the augmented marix Ag


Ag=[A b];
% Find the rank of coefficient matrix A and augmented marix Ag
ra=rank(A);
rg=rank(Ag);

syms x y z
D=[x; y; z];
F=A*D;
SS=F==b

if (ra==rg)
disp('System is consistent')
sz=size(A);
S=solve([SS],{x y z});
if (ra==sz(end))
disp('System has Unique solution and is')
else
disp('System has infinite solutions and one particular solution
is')
end
disp(S)
else
disp('System is Inconsistent')
end
% To visualization of planes
fimplicit3(SS)
1.

System is Inconsistent

2.

System is consistent

System has infinite solutions and one particular solution is


x: 7/11
y: 3/11
z: 0
3.

System is consistent

System has Unique solution and is

x: 48250/19893
y: 71078/19893
z: 12771/6631

You might also like