0% found this document useful (0 votes)
42 views24 pages

Computational Lab Manual

The document outlines various experiments conducted using MATLAB, including calculations of Reynolds number, specific volume using Vanderwaals and Redlich-Kwong equations, terminal settling velocity using Stoke's law, concentration profiles in batch reactors and CSTRs, solving ordinary differential equations, simultaneous systems of equations, and matrix operations. Each experiment includes an aim, problem statement, source code, procedure, and results indicating successful execution. The document serves as a comprehensive guide for performing these calculations and analyses using MATLAB.

Uploaded by

pthenmozhi
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)
42 views24 pages

Computational Lab Manual

The document outlines various experiments conducted using MATLAB, including calculations of Reynolds number, specific volume using Vanderwaals and Redlich-Kwong equations, terminal settling velocity using Stoke's law, concentration profiles in batch reactors and CSTRs, solving ordinary differential equations, simultaneous systems of equations, and matrix operations. Each experiment includes an aim, problem statement, source code, procedure, and results indicating successful execution. The document serves as a comprehensive guide for performing these calculations and analyses using MATLAB.

Uploaded by

pthenmozhi
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/ 24

1

EX NO:
DATE:
CALCULATION OF REYNOLDS NUMBER
Using MATLAB calculate Reynolds number at a diameter d=0.2m, using different velocity’s as
u=0.1,0.2,0.3…1m/s knowing that, Re=(rho*u*d)/mu, mu=0.001Ns/m2, rho=1000kg/m3.

AIM:
To calculate the Reynolds number for the given velocity’s by using the MATLAB and the
given data using MATLAB.
PROBLEM STATEMENT:
Diameter(d)=0.2m, velocity(u)=0.1,0.2,0.3…1m/s, viscosity(mu)=0.001, Density (rho) =
1000.
FORMULA USED:
Reynold’s Number,
Re = (rho*u*d)/mu
where,
Rho = density (kg / m3).
u = velocity (m/s).
mu = viscosity (Ns/ m2).
d = diameter(m).

SOURCE CODE:
d = 0.2;
mu = 0.001;
rho = 1000;
i=1
for u = 0.1:0.1:1
u
Re(i) = (rho*u*d)/mu;
i = i+1
end
u=0.1:0.1:1
plot(u,Re)
xlabel ('velocity')
ylabel ('reynolds number')
2

PROCEDURE:

1. Start the MATLAB.


2. Open a new ‘m’ file in editor and save it with ‘.m’ extension.
3. Type the source code and save the same.
4. Compile and run the program.
5. Report the output in MATLAB command window.

OUTPUT:
3

RESULT:
The code was executed and the output was verified successfully.
4

EXP NO:
DATE:

CALCULATION OF SPECIFIC VOLUME USING VANDERWAALS EQUATION

The Vanderwaal’s equation of state is given by (p+ a/v2)(v-b)=RT. In this equation, (V=v/n)
(n=No. of. moles), R=0.082054 liter. atm/mol. K, and a=3.592 and b=0.04267 for CO2. Find
the specific volume (liter/mol) of CO2 when p=12 atm and T=315.6K Using MATLAB.

AIM:
To calculate the specific volume of CO2 by using the vander waals equation of state
and with given data using MATLAB.

PROBLEM STATEMENT:
a=3.592; b=0.04267; p=12atm; R=0.082054 liter. atm/mol. K; T=315.6 K;

SOURCE CODE:

syms a b p t R
a=3.592; b=0.04267; p=12; R=0.082054; T=315.6;
P= [p -R*T-p*b a -a*b];
roots(P)

PROCEDURE:
1. Start MATLAB.
2. Open a new ‘m’ file in editor and save it with a (‘.m’) extension.
3. Type the source code and save the same.
4. Compile and run the problem.
5. Report the output in MATLAB command window.
5

OUTPUT:

RESULT:
The code was executed and the output was verified successfully.
6

EXP NO:
DATE:

CALCULATION OF SPECIFIC VOLUME BY REDLICH-KWONG EQUATION

Find the specific volume of n-butane at 500 K and 18 atm. Using the Redlich-Kwong
equation of state using MATLAB. V3P - V2RT + V (a - Pb2 - RTb) -ab = 0
where,
a=0.42748(R2Tc2/Pc) α b=0.08664(RTc/Pc) α=(T/Tc)0.5

AIM:
To find the specific volume of n-butane by using the Redlich-Kwong equation of state
and with the given data using MATLAB.

PROBLEM STATEMENT:
P=18 atm; T=500 K; Tc=425.16 K; R=0.082054; Pc=3.796 MPa;

SOURCE CODE:
T=500; P=18; R=8.314; Tc=425.16; Pc=37.46; alpha=(T/Tc).^0.5
a=(0.42748)*[(R.^2)*(Tc.^2)/Pc]*alpha
b=(0.08664)*[(R*Tc)/Pc]
coeffofv=[P-(R*T)+(a-P*b.^2-R*T*b)-(a*b)]
fprintf(‘specific volume of n butane’);
v=roots (coeffofv)

PROCEDURE:
1. Start Matlab.
2. Open a new ‘m’ file in editor and save it with a (‘.m’) extension.
3. Type the source code and save the same.
4. Compile and run the problem.
5. Report the output in Matlab command window.
7

OUTPUT:

RESULT:
The code was executed and the output was verified successfully.
8

EXP NO:
DATE:

CALCULATION OF TERMINAL SETTLING VELOCITY BY STOKE’S LAW

Consider a rigid solid sphere falling with the velocity of 0.0047m/s and the following data are
known at the conditions of interest. Viscosity of fluid is 0.1 Pa.s. Acceleration due to gravity
is 10m/s2. Density of the particle is 1180 kg/m3 & ρf = 1000kg/m3. Diameter of the particle is
2.15 mm. Calculate the terminal settling velocity with the help of stoke’s law.

AIM:
To determine the terminal settling velocity with the help of stoke’s law and with the
given data using MATLAB.

PROBLEM STATEMENT:
rho1=1180; rho2=1000; mu=0.1; g=10; d=2.15;
FORMULA USED:
V=D2g(ρs-ρf)/18μ
where,
D→ diameter of the particle in mm.
g→ Acceleration due to gravity in m/s2.
ρs→ Density of the particle in kg/m3
ρf→ Density of the fluid in kg/m3
μ→ Viscosity of the fluid in Pa.s

SOURCE CODE:
rho1=1180; rho2=1000; mu=0.1;
g=10; d=0.00215;
Vt=(rho1-rho2)*g*(d^2)/18*mu;
Vt

PROCEDURE:
1. Start Matlab.
2. Open a new ‘m’ file in editor and save it with a (‘.m’) extension.
9

3. Type the source code and save the same.


4. Compile and run the problem.
5. Report the output in Matlab command window.

OUTPUT:

RESULT:
The code was executed and the output was verified successfully.
10

EXP NO:
DATE:
CONCENTRATION PROFILE OF BATCH REACTOR

The concentration of species A in a constant volume batch reactor obeys this differential
equation dCA/dt =KCA2. With the initial condition CA (t=0)=5 mol/L and K=0.23 L/mol. S.
Compute the time it takes for CA to reduce to 2 mol/L.

AIM:
To find the time taken by the batch reactor of with the given data using MATLAB.

PROBLEM STATEMENT:
K=0.23 L/mol. s; CA(t=0)=5 mol/L;

SOURCE CODE:
Syms CA(t)
K=0.23;
Ode(t)=diff(CA,t)==-K*(CA^2);
Cond=CA(0)==5;
CAsol(t)= dsolve(ode(t),cond);
Vpasolve(CAsol==2,t)

PROCEDURE:
1. Start Matlab.
2. Open a new ‘m’ file in editor and save it with a (‘.m’) extension.
3. Type the source code and save the same.
4. Compile and run the problem.
5. Report the output in Matlab command window.
11

OUTPUT:

RESULT:
The code was executed and the output was verified successfully.
12

EXP NO:
DATE:
CONCENTRATION PROFILE OF CSTR
A mixing tank initially contains 300g of salt mixed into 1000L of water at t=0 min, a solution
of 4g/l salt enters the tank at 6l/min, at t=10 min. The solution is changed to 2g/l salt, still
entering at 6l/min. The tank is well stirred and the tank solution leaves at a rate of 6l/min.
Plot the concentration of salt (g/l) in the tank as a function of time.
AIM:
To plot the concentration graph for continuous stirred tank reactor by using the given
data.
PROBLEM STATEMENT:
C1(0)=0.3; t=[0,10]; X=[10,60];
FORMULA USED:

dC/dt = C1r1 – C2r2


where,

C → Concentration of the solution in g/l


r → Flow rate in l/min
t → Time taken in min

SOURCE CODE:

syms c1(t) c2(t)


ode1 = diff(c1,t) == (24-6*c1);
cond1 = c1(0) == 0.3;
tsol(t) = dsolve(ode1,cond1);
ode2 = diff(c2,t) == (12-6*c2);
cond2 = c2(10) == tsol(10);
csol(t) = dsolve(ode2,cond2);
t = [0 10]; X = [10 60];
plot(t,tsol(t),X,csol(X))

PROCEDURE:
1. Start Matlab.
2. Open a new ꞌmꞌ file in the editor and save it with a (ꞌ.mꞌ) file extension.
3. Type the source code and save the same.
4. Compile and run the problem.
5. Report the output in Matlab command window.
13

OUTPUT:

RESULT:
The code was executed and the output was verified successfully.
14

EXP NO:
DATE:
SOLVING THE ORDINARY DIFFERENTIAL EQUATIONS
Use the ordinary differential equation (ODE)45 and (ODE)23 to solve the initial value
problem for a first order differential equation.
y’=-ty/√ (2-y2), y(0)=1, t<[0,5]

AIM:
To solve the initial value problem for a first order differential equation by using the
given data using MATLAB.

PROBLEM STATEMENT:
tspan[0,5] ; y0=1;

SOURCE CODE:
tspan=[0,5]; y0=1;
[t,y]=ode45(@(t,y)-t*y/sqrt(2-y^2),tspan,y0);
[a,b]=ode23(@(t,y)-t*y/sqrt(2-y^2),tspan,y0);
plot(t,y,ꞌ-oꞌ,a,b,ꞌ--ꞌ)
xlabel(ꞌtꞌ)
ylabel(ꞌyꞌ)

PROCEDURE:

1. Start Matlab.
2. Open a new ꞌmꞌ file in the editor and save it with a (ꞌ.mꞌ) file extension.
3. Type the source code and save the same.
4. Compile and run the problem.
5. Report the output in Matlab command window.
15

OUTPUT:

RESULT:
The code was executed and the output was verified successfully.
16

EXP NO:
DATE:
SOLVING SYSTEM OF EQUATIONS USING MATLAB

Solve the simultaneous system of equations.


-2x1+5x2+x3+3x4+4x5-x6= 0,
2x1-x2-5x3-2x4+6x5+4x6= 1,
-x1+6x2-4x3-5x4+3x5-x6= -6,
4x1+3x2-6x3-5x4-2x5-2x6= 10,
-3x1+6x2+4x3+2x4-6x5+4x6= -6,
2x1+4x2+4x3+4x4+5x5-4x6= -2.

AIM:
To solve the simultaneous system of equations using the given data by using MATLAB.

PROBLEM STATEMENT:
Solve for x1 x2 x3 x4 x5 and x6

SOURCE CODE:
syms x1 x2 x3 x4 x5 x6
eqn1= -2*x1+5*x2+x3+3*x4+4*x5-x6==0;
eqn2= 2*x1-x2-5*x3-2*x4+6*x5+4*x6==1;
eqn3= -x1+6*x2-4*x3-5*x4+3*x5-x6==-6;
eqn4= 4*x1+3*x2-6*x3-5*x4-2*x5-2*x6==10;
eqn5= -3*x1+6*x2+4*x3+2*x4-6*x5+4*x6==-6;
eqn6= 2*x1+4*x2+4*x3+4*x4+5*x5-4*x6==-2;
solve([eqn1,eqn2,eqn3,eqn4,eqn5,eqn6],[ x1,x2,x3,x4,x5,x6])
17

PROCEDURE:

1. Start Matlab.
2. Open a new ꞌmꞌ file in the editor and save it with a (ꞌ.mꞌ) file extension.
3. Type the source code and save the same.
4. Compile and run the problem.
5. Report the output in Matlab command window.

OUTPUT:

RESULT:
The code was executed and the output was verified successfully.
18

EXP NO:
DATE:
MATRIX OPERATIONS USING MATLAB
Let

and

Find the following:


ⅰ. A+B ⅴ. A2 ⅴⅰⅰⅰ. BT ⅻ. Pseudo inverse of B
ⅰⅰ. A-B ⅴⅰ. B2 ⅸ. A-1 ⅻⅰ. Eigen value of A
ⅰⅰⅰ. A*B ⅴⅰⅰ. AT ⅹ. B-1 ⅺⅴ. Eigen value of B
ⅰⅴ. A/B ⅴⅰⅰⅰ. BT ⅺ. Pseudo inverse of A

AIM:
To solve the given matrix problem by using the given data using MATLAB.
PROBLEM STATEMENT:
A=[1 0 1; 2 3 4; -1 6 7;] B=[1 4 2; 4 5 6; -1 2 1;]
SOURCE CODE:
A=[1 0 1; 2 3 4; -1 6 7;]
B=[1 4 2; 4 5 6; -1 2 1;]
add=A+B
sub=A-B
multi=A*B
divide=A/B
sqrofa=A*A
sqrofb=B*B
transofa=Aꞌ
transofb=Bꞌ
invofa=inv(A)
invofb=inv(B)
19

pinvofa=pinv(A)
pinvofb=pinv(B)
eigofa=eig(A)
eigofb=eig(B)
PROCEDURE:

1. Start Matlab.
2. Open a new ꞌmꞌ file in the editor and save it with a (ꞌ.mꞌ) file extension.
3. Type the source code and save the same.
4. Compile and run the problem.
5. Report the output in Matlab command window.

Output:
20

RESULT:
The code was executed and the output was verified successfully.
21

EXP NO:
DATE:
SABATIER PLOT USING MICROSOFT EXCEL

Obtain the Sabatier plot for the calculated hydrogen binding gibbs free energy and current
density.
Energy = [-33.8, -24.1, 48.2, 56, -5.8]
Current = [0.025, 0.045, 0.082, 0.016, 0.500]

AIM:
To plot the graph for Sabatier hydrogen binding gibbs free energy and current density.

PROBLEM STATEMENT:
Energy = [-33.8, -24.1, 48.2, 56, -5.8]
Current = [0.025, 0.045, 0.082, 0.016, 0.500]

PROCEDURE:
1. Open new excel sheet.

2. Type the readings to be plotted in separate rows.

3. Select these rows and click the insert option in the clipboard.

4. Select scatter charts that we needed from the clipboard.

5. The chart for the readings will be plotted and shown in screen.

6. Give the chart name and axis names.

7. Save the file and exit.


22

OUTPUT:

RESULT:
The graph was drawn from the given Sabatier plot for the calculated hydrogen
binding gibbs free energy and current density.
23

EXP NO:
DATE:
CALCULATION OF REYNOLDS NUMBER USING MS EXCEL

Using the MS Excel calculate the Reynolds number at a diameter D=0.2m, using the different
velocity’s as u=0.1, 0.2, 0.3… …. 1 m/s, knowing that Re= (ρud/μ), μ=0.001, ρ=1000.

AIM:
To calculate the Reynolds number for the given velocity’s using the given data by MS
Excel.
PROBLEM STATEMENT:
d=0.2m; u=0.1,0.2,0.3,…….1 m/s; μ=0.001; ρ=1000;

SOURCE CODE:
Sub loopcell()
Dim d As Double
Dim mu As Double
Dim v As Double
Dim rho As Double
Dim reynum As Double
d = 0.2
mu = 0.01
rho = 100
reynum = 0
Dim values() As Variant
ReDim values(1 To 10)
For v = 1 To 10
reynum = d * v * rho / mu
values(v) = reynum
Next v
Dim message As String
message = "values"
For v = 1 To 10
message = message & vbCrLf & values(v)
Next v
MsgBox "The Reynolds numbere are" & vbCrLf & message
End Sub
PROCEDURE:
1. Open a new excel sheet.
2. Go to the visual basic and open the new module and save it with Reynum.
3. Type the source code and save the same.
4. Compile and run the program.
5. Report the output in excel message dialogue box.
24

OUTPUT:

RESULT:

The code was executed and the output was verified successfully.

You might also like