You are on page 1of 13

SOLVING LINEAR AND NON

LINEAR SYSTEM OF ALGEBRAIC


EQUATIONS IN MATLAB
GROUP: 5
MOHAMMAD AASIF (20JE0569)
RITIKA SAINI (20JE0582)
MUDIT VIRMANI (20JE0585)
NAVYA SEN (20JE0607)
NIKHIL KUMAR JAISWAL (20JE0622)
INTRODUCTION TO LINEAR AND NON LINEAR
SYSTEM OF ALGEBRAIC EQUATIONS:
• In chemical engineering, linear and non-linear systems of algebraic
equations are commonly used to model and analyze various processes.
• A linear system is one where the variables are related by linear equations,
while a non-linear system involves at least one equation that is not linear.
• Linear systems are often easier to solve than non-linear systems, as they can
be represented in matrix form and solved using techniques such as Gaussian
elimination or LU decomposition.
• However, many chemical engineering problems involve non-linear
relationships between variables, such as reaction kinetics or mass transfer,
which require more advanced numerical methods to solve.
EXAMPLES IN CHEMICAL ENGINEERING
DOMAIN
LINEAR SYSTEM OF EQUATIONS:
• Material balance equations in a chemical reactor.
• Heat transfer equations: Heat transfer equations in chemical engineering .
• Mass transfer equations: Mass transfer equations in chemical engineering.

NON LINEAR SYSTEM OF EQUATIONS:

• Chemical reaction kinetics: The rate of a chemical reaction is often nonlinear and can be described
using nonlinear algebraic equations.
• Equations of state: The equations of state used to describe the thermodynamic properties of fluids are
often nonlinear.
• Nonlinear heat transfer equations: In some cases, the heat transfer equations in chemical engineering
may be nonlinear.
SOLVING LINEAR SYSTEM OF ALGEBRAIC EQUATIONS

We have following three methods for solving these:


1) By using successive substitution
2) Tearing method / Iterating method
3) By converting into matrix ( LU factorization method )

SOLVING WITH MATLAB

1) linsove : X = linsolve(A,B) solves the linear system A*X=B using LU factorization


with partial pivoting when A is square, and QR factorization with
column pivoting otherwise.
2) solve : SOL = solve(PROB, X0, GLOBALSOLVER) solves the problem using the
specified GLOBALSOLVER. GLOBALSOLVER is either a MultiStart or
GlobalSearch object.
3) mldivide (\) : A\B is the matrix division of A into B, which is roughly the
same as INV(A)*B , except it is computed in a different way.
PROBLEM BASED ON SYSTEM OF LINEAR ALGEBRAIC
EQUATIONS
Problem statement:
Consider a staged adsorption column for the separation of a binary mixture of components
A and B. The column has n stages, with each stage containing a certain amount of
adsorbent. The adsorption is described by the Langmuir isotherm, and the mass transfer
between the gas and liquid phases is assumed to be in equilibrium. The inlet gas
composition and flow rate are known, as well as the inlet liquid flow rate. The aim is to
develop a model to predict the outlet gas and liquid compositions and flow rates for each
stage of the column. L , x0 y1 ,G

L,xn-1 yn ,G
• Equilibrium relation at any stage can be given as:
ym = a x m + b
G, yn
L, xn-1

L, xn G, yn+1

• Continuity equation can be given as:

Lxn-1 + Gyn+1 – Lxn - Gyn = 0 (under steady)

• By putting the value of y from equilibrium relation:

Lxn-1 + G( a xn-1 + b ) – Lxn – G( a xn + b) = 0

=> L xn-1 - ( L + Ga )xn + G a xn+1 =0


• Let’s solve for n = 6
• Mass balance equations can be written as:
n=1
L x0 - ( L + Ga )x1 + G a x2 =0
Þ (L + Ga ) x1 + Gax2 = -Lx2

n =2
L x1 - ( L + Ga )x2 + G a x3 =0

n=3
L x2 - ( L + Ga )x3 + G a x4 =0

n=4
L x3 - ( L + Ga )x4 + G a x5 =0

n=5
L x4 - ( L + Ga )x5 + G a x6 =0

n=6
Lx5 - (L + Ga )x6 = G( b – y7)
• Since L , G , a and b are constants and x0 , y7 are known.
• Matrix form can be written as
x1 -Lx0
-( L+ Ga) Ga 0 0 0 0 0
x2 0
L -(L + Ga) 0 0 0 0 0
x3
0 L -(L + Ga) Ga 0 0 = 0
0 0 L -( L + Ga) Ga 0 x4
0
0 0 0 0 -( L + Ga) Ga x5
G(b – y7)

x6

X B
A

AX = B
Solution will be given as: X = A\B

• MATLAB CODE FOR PROBLEM:


clc
Clear
% constant values are taken from a problem given in book
a = 0.998;
b=0;
L = 4/3;
G = 5/3;
x0 = 0;
y7 = 0.1;
syms x1 x2 x3 x4 x5 x6
eqn1 = L*x0 - (L + G*a)*x1 + G*a*x2==0;
eqn2 = L*x1 - (L + G*a)*x2 + G*a*x3==0;
eqn3 = L*x2 - (L + G*a)*x3 + G*a*x4==0;
eqn4 = L*x3 - (L + G*a)*x4 + G*a*x5==0;
eqn5 = L*x4 - (L + G*a)*x5 + G*a*x6==0;
eqn6 = L*x5 - (L + G*a)*x6 - G*(b -y7)==0;
sol = solve([eqn1,eqn2,eqn3,eqn4,eqn5,eqn6],[x1,x2,x3,x4,x5,x6]);
RESULTS:
sol =

struct with fields:

x1: 1546937375124950/61266455220906601
=> 0.025249337
x2: 2786967335144950/61266455220906601
=> 0.0454892865
x3: 3780979327144950/61266455220906601
=> 0.0617136949
x4: 4577782527144950/61266455220906601
=> 0.0747192327
x5: 5216502527144950/61266455220906601
=> 0.0851445136
x6: 5728502527144950/61266455220906601
=> 0.0935014521
PROBLEM BASED ON SYSTEM OF NON LNEAR ALGEBRAIC EQUATIONS:

1) The Peng-Robinson equation of state is a common equation used in the industry, and it is
given by:
P = (RT/(v-b)) - (aα/(v(v+b)))
where P is the pressure, T is the temperature, R is the gas constant, v is the molar volume, a
and b are constants that depend on the gas, and α is a parameter that depends on the
temperature and the gas. this equation is non linear in terms of volume.

2) Another example of a system of nonlinear algebraic equations in chemical engineering is


the set of equations used to describe a chemical reactor. The equations are based on the law
of mass conservation and the law of mass action.

• MATLAB FUNCTION USED : “fsolve”


Why we need software like MATLAB for solving linear and non linear system of
algebraic equations?

As we have seen the problem based on system of linear algebraic equations of


adsorption column, in which we had taken number of trays as 6. But in real industry we
generally have more than 6 number of trays . So we can not solve such big number of
trays with that accuracy . Thus , we need software like MATLAB for solving these
problems.
THANK YOU

You might also like