HOMEWORK 2

 

The aim of homework II is to make the student gain and practice MATLAB® skills.

 

Q1. Check if the following set of equations is linearly independent and solve using left-division (i.e. Gauss-elimination)

   3x1 - 2x2 +  x3 = 2

          5x2 + 2x3 = 1

  0.5x1 + 2x2 - x3 = 5

 

Tips:

You can use either the MATLAB® command window or open a new m-file to solve the given problem

1. Write the equations in matrix form:

A = [coefficient matrix];

y = [vector of values on the right hand side of the equation];

2. Write the augmented matrix B and check its rank using the MATLAB® function “rank”. The “rank” function provides an estimate of the number of linearly independent rows or columns of a full matrix

               r = rank(B),

3. If r is equal to the number of equations (number of rows in A or B), solve the system of equations by doing left division

x = A\y;  %Left division uses a Gauss-elimination approach to solve the set of linear equations

4. The result will give the variable vector

x = [x1 ; x2 ; x3];

 

 

 

Q2. Consider three 24 L (liters) well-stirred tanks each with flow rates (L/hr) in and out such that the tanks remain full. Some amount of salt is continuously added to tank 1, 2 and 3 to keep the tank concentrations x1(t), x2(t), x3(t) constant. Find the concentrations in the tanks assuming steady state conditions.

 

 

Tips :

  1. Work on the mass balance around each tank and form the set of equations to be solved on paper
  2. Write the equations in matrix form in MATLAB®
  3. Check the rank
  4. Solve the system of equations for x1 , x2 , and x3