You are on page 1of 21

LABORATORIUM TEKNIK KIMIA

FAKULTAS TEKNIK
UPN “VETERAN” JAWA TIMUR Nama : MOH AUFAL WIDAD
NPM/Semester : 19031010219/1
Praktikum : PROGRAM KOMPUTER Sesi :3
Percobaan : MATRIX DAN PLOT DALAM Paralel :E
PEMROGRAMAN MATLAB
Tanggal : 12 NOVEMBER 2019
Pembimbing : NOVE KARTIKA E., ST, MT
LAPORAN RESMI

1. Explain about matrix and plot (2 and 3 Dimension) that you know in
matlab! Mention the types and their requirement!
2. Make your program in matlab with input, output, selection statement,
looping, and matrix or plot! Give your algorithm, flowchart, and
printscreen about input & output! Be creative!
3. Create your own program with new statement outside modul and describe
why you need that statement!

4. Consider the following matrix !

4 1 2𝑁𝑃𝑀 𝐴𝑘ℎ𝑖𝑟 3 2 3
𝐴=[ 8 6 7 ] 𝐵 = [ 9 3 2]
2𝑁𝑃𝑀 𝐴𝑤𝑎𝑙 3 6 7 1 4
Determine the inverse matrix C value using the matlab program, display the
script and run the results. also include the manual calculation !
By using C = AT x B

5. Filtration is a process of separating solids from fluids using filter media.


Slurry CaCO3, 23.47 kg / m3 was put in the filter press at a constant pressure
of 338kN / m2 with a temperature of 298.2 K. The area of the plate and frame
filter was 0.873 m2 and the number of frames used was 20 units. Cake
resistance (α) 1,863 x 107 m / kg. Medium filter resistance (Rm) 10.63 x 107
m-1. Water viscosity = 8,397 kg / m.s. Calculate the time needed to get 3.37
m3 of filtrate! Display a graph between the time per minute vs the volume
obtained every minute until it reaches the desired!
1. Explain about matrix and plot (2 and 3 Dimension) that you know in
matlab! Mention the types and their requirement!

 A matrix is a collection of numbers arranged in rows or columns or


both and within a parentheses. In a matrix Matlab It can be written a =
[2 2; 3 2] and will form a 2x2 matrix.
 The graphic or plot of MATLAB serves to represent the data making
it easier to see overall. How to use a 2 dimensional plot in MATLAB
can use a plot (x, y) As for 3 dimensions can use Surf (x, y, z)
2. Make your program in matlab with input, output, selection statement,
looping, and matrix or plot! Give your algorithm, flowchart, and
printscreen about input & output! Be creative!
Algorithm:
1. Start the program
2. Choose the type of program
3. If type 1, then
a) Insert mass (m), velocity (v), interval (i), end limit (b)
b) Repeats m (mass), v (velocity), ek (kinetic energy)
c) Calculate ek = 1/2 * m * v ^ 2
d) Displays the results of m (mass), v (velocity), ek (kinetic energy)
4. If type 2, then
a) Insert mass (m), height (h), interval (i)
b) Bring up the value of gravitational acceleration (g)
c) Repeat the program m <= 100
d) Calculate ep = m * g * h
e) Displays m (m), g (acceleration due to gravity), h (height), ep
(potential energy)
5. If not, then Showing options not available
6. The program is complete
Flowchart:

start

Menginput
kan pilihan

Memasukkan m
Case 1 (massa),v(kecepatan), i
(interval)

For
x=m:i:b

Menghitung ek=½*m*v^2

Menampilkan m
(massa),v(kecepatan),
ek(energi kinetik)

m=m+i

A B
A B

Memasukkan m
Case 2 (massa), h (tinggi), i
(interval)

no
While
m<=100

yes

Menghitung
ep=m*g*h

Menampilkan m
(massa), h (tinggi), g
(Percepatan
gravitasi),ep (Energi
potensial)

m=m+i

end
Script:
clear all;
clc;
disp ('Energy calculation program');
disp ('1. kinetic energy');
disp ('2. potential energy');
pill = input ('enter selection =');
pill switch case (1) clc;
disp ('kinetic energy calculation program');
m = input ('enter mass =');
v = input ('enter speed =');
i = input ('enter interval =');
ba = input ('enter the deadline =');
fprintf ('% 9s% 9s% 9s \ n', 'm', 'v', 'oak');
for m = m: i: ba
ek = 1/2 * m * v ^ 2;
fprintf ('% 10.1f% 10.1f% 10.1f \ n', m, v, ek);
m = m + i;
end
case (2)
clc;
m = input ('mass =');
h = input ('height =');
g = 9.8;
disp ('g = 9.8');
i = input ('enter interval =');
fprintf ('% 9s% 9s% 9s% 9s \ n', 'm', 'g', 'h', 'ep');
while m <= 100
ep = m * g * h;
fprintf ('% 10.2f% 10.2f% 10.2f% 10.2f \ n', m, g, h, ep);
m = m + i;
end
otherwise
disp ('no options');
end
Run result:
3. Create your own program with new statement outside modul and describe
why you need that statement!
Algorithm:
1. Start the program
2. Insert mass (m)
3. Entering speed (v)
4. Entering intervals (i)
5. Repeating mass (m)
6. Calculate kinetic energy with the formula:
ek = ½ * m * v ^ 2
7. Displays m (mass), v (velocity), ek (kinetic energy)
8. The program is complete
Flowchart:

start

Memasukkan m
(massa),v(kecepat
an), i (interval)

No
While
m<=100

yes

Menghitung
ek=½*m*/v^2

Menampilkan m
(massa),v(kecepat
an),ek(Energi
kinetik)

m=m+i

end
Script:
clear all;
clc;
disp ('###############################');
disp ('kinetic energy calculation');
disp ('###############################');
disp ('');
m = input ('enter mass =');
v = input ('enter speed =');
i = input ('enter interval =');
disp ('');
fprintf ('% 9s% 14s% 20s \ n', 'mass', 'velocity', 'kinetic energy');
disp ('=============================================== ======
');
while m <= 100
disp (‘m’);
break
disp (‘program dicekal’);
ek = 1/2 * m * v ^ 2;
fprintf ('% 8.1f% 12.1f% 20.1f \ n', m, v, ek);
m = m + i;
end
Run result :

I choose to use kind of statement in matlab outside modul it’s break statement.
I use this statement because in my program there is a looping and the function of
break statement is to go to stop looping in iteration early, other than this statement
has function to stop iteration without continue the looping. Therefore, I very need
this statement in order to applied in my program.
4 1 19 3 2 3
4. 𝐴 = [ 8 6 7 ] 𝐵 = [9 3 2] Determine the invers matrix C, by
21 3 6 7 1 4
using C = AT x B
a. Script :
clear all:
clc;
a=[4 1 19; 8 6 7; 21 3 6]
b=[3 2 3; 9 3 2; 7 1 4]
c=a'*b
b. Run result :
c. Manual calculation
C = AT x B
4 8 19 3 2 3
= [ 1 6 3 ] x [ 9 3 2]
21 7 6 7 1 4
12 + 72 + 133 8 + 24 + 19 12 + 16 + 76
= [ 3 + 54 + 21 2 + 18 + 3 3 + 12 + 12 ]
63 + 63 + 42 42 + 21 + 6 63 + 14 + 24
217 51 104
C = [ 78 23 27 ]
168 69 101
1
C-1 = det 𝐶 Adj C
217 51 104 217 51
Det C = [ 78 23 27 ] 78 23
168 69 101 168 69
= (504.091+231.336+796.536)-(401.856 +404.271+401.778)
= (1.531.963) – (1.207.905)
= 324.058
Adj C = CT
23 27 51 104 51 104
K11 = [ ] K21 = [ ] K31 = [ ]
69 101 69 101 23 27
= 460 =2.025 = -1.015
78 27 217 104 217 104
K12 = [ ] K22 = [ ] K32 = [ ]
168 101 168 101 78 27
= 3.342 =4.445 = -2.253
78 23 217 51 217 51
K13 = [ ] K23 = [ ] K33 = [ ]
168 69 168 69 78 23
= 1.518 = 6.405 = 1.013

460 2.025 −1.015


Kofaktor = [ 3.342 4.445 −2.253]
1.518 6.405 1.013
460 −3.342 1.518
Adj C = [2.025 4.445 −6.405]
1.015 −2.253 1.013
460 −3.342 1.518
-1 1
C = 324.058 [ 2.025 4.445 −6.405]
1.015 −2.253 1.013
460/324.058 −3.342/324.058 1.518/324.058
C-1= [ 2.025/324.058 4.445/324.058 −6.405/324.058 ]
1.015/324.058 −2.253/324.058 1.013/324.058
5. a. Algorithm:
1. Start the program
2. Enter Medium Barriers. Volume, Cross-sectional Area, Number of
Frames, Cake Barriers, Water Viscosity, Slurry, Pressure, and
Temperature
3. Calculation of time
4. Display the calculation results
5. Enter the start time, interval and end time
6. Repetition of for the beginning to the end time
7. Calculation of volume based on time
8. Showing the calculation results
9. Enter functions y and x
10. Display graph
11. End
b. Flowchart:
c. Script :
clc;
disp('################################');
disp('FILTERPRESS TIME CALCULATION');
disp('################################');
a=input('Medium Barries (Rm) =10.63x107 m^-1');
v=input('Volume (V) =3.37 m^3');
A=input('Cross-sectional Area (A) =0.873 m^2');
n=input('Number of Frames = 25');
c=input('Cake Barries = 1.863x107');
vs=input('Water Viscosity =8.397 kg/ms');
cs=input('Slurry (Cs) = 23.47 kg/m^3');
dp=input('Pressure (P) =338000');
T=input('Temperature =298.15 K');
dp=338000;
n=25;
A=0.873;
cs=23.47;
c=1.863*107;
a=10.63*107;
vs=8.397;
v=3.37;
T=298.155;
Kp=((vs*c*cs)/((A*n)^2*dp));
B=(vs*a)/(A*dp);
t=(((Kp*v)/2+B)*v)/60;
disp(' Time ');
fprintf('%0s%4.3f%0s\n','t= ',t,' minutes');
disp('###################################');
ww=input('Enter the start time = ');
itv=input('Enter interval = ');
wk=input('Enter the end time = ');
disp('---------------------------------------------');
disp(' Time Volume');
disp('---------------------------------------------');
for ww=ww:itv:wk
y=(v*ww)/t;
fprintf('%9.3f%27.3f\n',ww,y);
plot(ww,y,'-squarer');
title('Graph of the relationship between timw and volume');
Xlabel('Time');
Ylabel('Volume Filtrat');
grid on
hold on
ww=ww+itv;
end
Run result :

You might also like