You are on page 1of 17

LABORATORIUM TEKNIK KIMIA

FAKULTAS TEKNIK
UPN “VETERAN” JAWA TIMUR Nama : FARDA ANIS KHURIYAH
NPM/Semester : 19031010189 / I
Praktikum : PEMROGRAMAN KOMPUTER Sesi : III
Percobaan : MATRIX DAN PLOT DALAM Paralel :E
PEMROGRAMAN MATLAB
Tanggal : 12 NOVEMBER 2019 LAPORAN RESMI
Pembimbing : NOVE KARTIKA E., ST , MT

SOAL :
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 NPM Akhir 3 2 3
A= 8 6 7 B= 9 3 2
2 NPM Awal 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!

130
JAWABAN:
1. Matrix and plot
a. Matrix
Mattrixs more simple then pascal, matrixs in matlab is formed in such
a way that can be run with easy. Matrix is a group of numbers
arranged in a form array square or rectangle consisting of rows or
columns. Matrix in matlab is usually written in square brackets ([ ])
and usually written line by line. Semicolons (,) are used to separate
columns, and semicolons (;) to separate rows. Can use spaces to
separate columns and press enter to new rows to separate rows.

Example
Script
A=rand(5)
B=magic(5)
C=(1:5:25)

Run Result

131
Plot
The role of graphics in sience and engineering is very important.
To make a line graph, a function for which you can use a plot. This
function has a different form depending on the argument given. For
example given data in the form of array and stored in vector y, the plot
(y) will be displayed as a graph of the y element against the index of the
element. If two arguments x and y are specified, the ploy (x,y) will be
displayed as a graph of y versus x.

Example
Script
clear all;
clc;
a=4:4:120
b=4:8:240
c=4:6:180
plot(a,b,'-r',b,c,'-b',a,c,'-c');

132
Run results

Run result graph

133
2. Straight-line motion program
Algorithm
1. Start the program
2. Input choice of motions
3. If you choose 1
a. Input the distance (s)
b. Input time (t)
c. Input the interval (i)
d. Repeat the program until x=s:i:20
e. Show the distance, time, speed
f. Calculate speed (v) with formulas
V=s/t
4. If you choose 2
a. Input initial speed (v0)
b. Input initial distance (s0)
c. Input distance (st)
d. Input time (t)
e. Input interval (i)
f. Repeat the profram until st<=20
g. Calculates acceleration (a) and final speed (vt)
a=(2*st)/(t^2)
vt=v0+(a*t)
h. End the program

134
Flowchart

Start

Input choice
of motion

Yes Input
distance (s)
Case 1
time (t)
interval (i)
No

for
x=s:i:20

Bring up
Interval, speed

v=s/t

A B

135
A B

Input
Initial speed (v0)
yes Initial distance (s0)
Case 2
distance (st)
time (t)
interval (i)

There is
no While
selection st<=20
motion

Bring up
distance, time,
acceleration dan
final speed

Calculate
a=(2*st)/(t^2)
vt=v0+(a*t)

st=st+i

End

136
Script
clear all;
clc;
disp('=====================');
disp('CALCULATION OF MOTION');
disp('=====================');
disp('1. glb');
disp('2. glbb');
disp('');
choice=input('your choice= ');
switch choice
case 1
disp('calculating glb');
s=input('enter distance= ');
t=input('enter time= ');
i=input('enter interval=');
fprintf('%15s%24s%26s\n','distance' ,'time','speed');
for x=s:i:20;
v=s/t;
fprintf('%15.2f%24.2f%26f\n',s,t,v);
s=s+i;
end
case 2
disp('calculating glbb');
v0=input('enter initial speed=');
s0=input('enter initial distance=');
st=input('enter distance=');
t=input('enter time=');
i=input('enter interval=');
fprintf('%3s%10s%17s%23s\n','distance','time','acceleration','final speed');
while st<=20;

137
a=(2*st)/(t^2);
vt=v0+(a*t);
fprintf('%3.2f%12.2f%17.2f%23.2f\n',st,t,a,vt);
st=st+i;
end
otherwise
disp('no motion option');
end

138
Run result

139
3.

140
4. Calculate the determinant and invers matrix
Manual calculation
a. Determine the value of the matrix C
4 1 89 3 2 3
A= 8 6 7 B= 9 3 2
18 3 6 7 1 4

4 8 18
A= 1 6 3
T

89 7 6
C=ATxB
4 8 18 3 2 3
C= 1 6 3 X 9 3 2
89 7 6 7 1 4

12+72+126 8+ 24+18 12+16+72


C= 3+54 +21 2+18+ 3 3+12+12
267+63+ 42 178+ 21+ 6 267+ 14+24

210 50 100
C= 78 23 27
381 205 305

Determine the determinant


210 50 108 210 50
C= 78 23 27 78 23
381 205 305 381 205

C= (210x23x305+50x27x381+100x78x205) –
(100x23x381+210x27x205+50x78x305)
C= (1.473.150+514.350+1.599.00) - (876.300+1.162.350+1.189.500)
C= 3.586.500-3.228.150
C= 358.350

141
b. Determine the minor matrix
224 52 108
C= 78 23 27
117 35 50

1. Minor line 1, column 1


23 27
20 5 305
= (23x350)-(27x205)
= 1480
2. Minor line 1, column 2
78 27
381 305
= (78x305)-(27x381)
= 13503
3. Minor line 1, column 3
78 23
381 205
= (78x205)-(23x381)
= 7227
4. Minor line 2, column 1
50 100
205 305
= (50x205)-(100x305)
= -5250
5. Minor line 2, column 2
210 100
381 305
= (210x305)-(100x381)
= 25950
6. Minor line 2, column 3
210 50
381 205
= (210x205)-(50x381)

142
= 24000
7. Minor line 3, column 1
50 100
23 27
= (50x27)-(100x23)
= -950
8. Minor line 3, column 2
210 10 0
78 27
= (210x27)-(100x78)
= -2130
9. Minor line 3, column 3
2 10 50
78 23
= (224x23)-(52x78)
= 930

1480 13503 7227


C= −5250 25950 24000
−950 −2130 930

b. Determine the cofactor matrix


1480 −13503 7227
C= 5250 25950 −24000
−950 2130 930

Determine adjoin matrix


1480 5250 −950
C = −13503 25950 2130
T

7227 −24000 930

143
c. Determine the invers matrix
1
C-1= × Adj C
det C
1480 5250 −950
1
-1
C = × −13503 25950 2130
358350
7227 −24000 930

1480 5250 −950


358350 358350 358350
−13503 25950 2130
C-1=
358350 358350 358350
7227 −24000 930
358350 358350 358350

144
Calculations with matlab

145
5. Filter program on the filter press
Algoritma
1. Start the program
2. Put in Cs, Visair, DeltaP, a, filter plate, T, N, Vol, Rm
3. Enter filter large and filtrate volume
4. Calculate the total large of frames(A), Kp, intercept(B), time(t)
5. Change the time value to minutes and calculate the rate
6. Make the plot or graph between time and volume
7. Displays the result of the calculation of the time and filtration rate and
displays the results of the graph
8. End the program

146

You might also like