FAKULTAS TEKNIK
UPN “VETERAN” JAWA TIMUR Nama : MOCHAMAD DHANI D
NPM/Semester : 19031010178/1
Praktikum : PEMROGRAMAN KOMPUTER Sesi :1
Percobaan : MATRIX DAN PLOT PADA Paralel :D
MATLAB
Tanggal : 10 NOVEMBER 2019
Pembimbing : DR.T.IR.SUSILOWATI
LAPORAN RESMI
Soal :
1. Explain about matrix and plot ( 2 or 3 dimension ) that you know in Matlab.
Mention the types and their requirement
2. Make your program in the Matlab with input, output, selection statement,
looping, and matrix / plot ! Give your algorithm, flowchart, and printscreen
about input and output. Be creative!
3. Saya mempunyai kesetimbangan suatu reaksi apabila reaksi tersebut
memiliki nilai konstanta kesetimbangan sebesar 2,06 x 10-3 sec-1. Untuk
mengetahui orde pada reaksi tersebut diuat grafik garis terlurus.
a. Hitunglah berapa banyak M pada detik ke 1 – 10 apabila Mi =
(Jumlah 2 NPM terakhir)
2,303 𝑀𝑖
𝐾= 𝑙𝑜𝑔
𝑡 2𝑀𝑖 − 𝑀
b. Orde 0, perbandingan antara t (sec) dengan M
c. Orde 1, perbandingan antara t (sec) dengan Ln M
d. Orde 2, perbandingan antara t (sec) dengan 1/M
166
grafik antera waktu (menit) vs volume yang didapat setiap menitnya hingga
mencapai yang diinginkan
Rumus :
µ 𝑥 𝛼 𝑥 𝐶𝑠 𝑅𝑚 𝑥 µ 𝑡 𝐾𝑝+𝑉
𝐾𝑝 = 𝐴 𝑥 (−𝛥𝑃) 𝐵= = +𝐵
𝐴 𝑥 (−𝛥𝑃) 𝑉 2
167
Jawaban
b. Line Matrix
Line Matrix is a matrix that consist of only one line Example :
A = [ 2 1 3 -7 ]
c. Column Matrix
Column Matrix is a matrix that consist of only one column. Example :
(Ndraha, 2015)
168
a. 2 Dimensional Plot (2 Dimension Graphs)
2 dimensional computer graphics commonly called 2D or field are the
shapes of objects that have length and width. Graph 2 Dimension is a drawing
technique that is based on x (flat) axis coordinate and y (a vertical) axis. In
order to appear perfectly, the image to be displayed with this technique should
have the minimum and maximum x and y coordinates of the resolution used.
The 2D computer graph is a computer-based digital image, which is a two-
dimensional image object (2D). The 2D Graphic Model is a combination of
geometric models (also called vector graphics), digital images (raster
graphics), mathematical functions, and so on. These components can be
modified and manipulated by two-dimensional geometry transformations,
such as translation, rotation, and dilation. There are two commands in matlab
that serve to draw the function graph that is "ezplot" and "plot" ·
➢ Plot
Suppose we will draw a graph of y with the values of y1, y2, y3,
y4, y5, y6 are 1, 5, -6, 8, 9, and 19 respectively.
Solution:
>> y = [1 5 -6 8 9 19];
169
➢ Ezplot
Ezplot (y) is a command in MATLAB to view the y chart based on
known equations.
Example :
170
2. I. Algoritma
1. Start program
2. Display Area of triangle
3. Input height and pedestal
4. Processing for x1=x1:1:10 dan while x<=10
5. Processing L=1/2*pedestal*height
6. Display plot
7. End
171
II. Flowchart
Start
Menampilkan
Program Perulangan
dan Luas Segitiga
Memasukkan
Tinggi dan
Alas
For
X1=x
1:1:10
No
If x<=10
Yes
Memproses
rumus
L=0.5*x1*x
Menampilkan
hasil luas
Memproses
Plot
Menampilkan
Plot
Selesai
172
III. Listing
clc;
disp('Looping Program');
disp('==================');
disp(' Area Of Triangle ');
x=input('Input height = ');
x1=input('Input Pedestal = ');
for x1=x1:1:10
while x<=10
L=0.5*x1*x;
x=x+1;
fprintf('%0s%4.2f%0s\n',’The result is = ',L,' cm');
plot(L,x,'-squarer');
grid on
hold on
end
end
173
IV. Hasil Listing
174
Plot
175
3. I. Algoritma
1. Memulai program
2. Menampilkan Program no 3
3. Menginputkan 2 NPM terakhir,Waktu awal,Interval waktu,Waktu akhir
4. Memproses rumus k=2.06*(10^(-3))
5. Melakukan perulangan for ul=to:ti:ta
6. Memproses rumus M=(2*Mi)-(exp(log(Mi)-(k*to)))
7. Menampilkan waktu awal dan hasil M
8. Menampilkan pilihan orde
9. Menginputkan orde yang ingin digunakan
a. Pilihan 1
1. Menampilkan Grafik orde 0
2. Memproses Plot
3. Menampilkan Plot
b. Pilihan 2
1. Menampilkan Grafik orde 1
2. Memproses Plot
3. Menampilkan Plot
c. Pilihan 3
1. Menampilkan Grafik orde 2
2. Memproses Plot
3. Menampilkan Plot
10. Selesai
176
II. Flowchart
Start
Menampilkan
Program No 3
Memasukkan 2 NPM
terakhir,Waktu
awal,Interval waktu,
waktu akhir
For
Ul=to:ti:ta
Menampilkan hasil
M
Menampilkan
pilihan orde
Memasukkan pilihan
orde
Pilihan 1 Yes
Memproses plot
Orde 0
No
Menampilkan plot
A B
177
A B
Pilihan 2 Yes
Memproses plot
Orde 1
No
Menampilkan plot
Pilihan 3 Yes
Memproses plot
Orde 2
No
Menampilkan plot
Selesai
178
III. Listing
clc;
disp('Program No 3');
disp('============');
Mi=input('Masukkan 2 NPM terakhir = ');
to=input('Masukkan waktu awal = ');
ti=input('Masukkan interval waktu = ');
ta=input('Masukkan waktu akhir = ');
disp(' Waktu M');
k=2.06*(10^(-3));
for ul=to:ti:ta
M=(2*Mi)-(exp(log(Mi)-(k*to)));
fprintf('%4i%10.2f\n',to,M);
to=to+ti;
end
disp('Untuk Pilihan Orde');
disp('1. Orde 0 ');
disp('2. Orde 1 ');
disp('3. Orde 2 ');
pil=input('Masukkan orde yang ingin digunakan = ');
switch pil
case 1
x=linspace(to,ta,10);
y=(2*Mi)-(exp(log(Mi)-(k*x)));
plot(x,y,'-b',x,y,'.r');
xlabel('Waktu (sec)');
ylabel('M');
title('Grafik Orde 0');
grid on
hold on
case 2
179
x=linspace(to,ta,10);
y=log((2*Mi)-(exp(log(Mi)-(k*x))));
plot(x,y,'-b',x,y,'.r');
xlabel('Waktu (sec)');
ylabel('Ln M');
title('Grafik Orde 1');
grid on
hold on
case 3
x=linspace(to,ta,10);
y=1./((2*Mi)-(exp(log(Mi)-(k*x))));
plot(x,y,'-b',x,y,'.r');
xlabel('Waktu (sec)');
ylabel('1/M');
title('Grafik Orde 0');
grid on
hold on
end
180
IV. Hasil Listing
• Orde 0
181
• Orde 1
• Orde 2
182
4. I. Algoritma
1. Memulai program
2. Menampilkan Perhitungan Waktu Filtrasi untuk mendapatkan Vm3 Filtrat
3. Memproses rumus A=n*luas;
Kp=(vis*a*Cs)/((A^2)*P);
B=(vis*Rm)/(A*P);
t=((Kp/2)*(V^2))+(B*V);
z=t/60;
laju=V/z;
tmenit=t/60;
4. Menampilkan hasil
5. Memproses Plot
6. Menampilkan Plot perbandingan antara t(menit) dengan V(m3)
7.Selesai
183
II. Flowchart
Start
Menampilkan
Program Perulangan
dan Luas Segitiga
Memproses rumus
A=n*luas;
Kp=(vis*a*Cs)/((A^2)*P);
B=(vis*Rm)/(A*P);
t=((Kp/2)*(V^2))+(B*V);
z=t/60;
laju=V/z;
tmenit=t/60;
Menampilkan Hasil
perhitungan
Memproses
plot
Menampilkan Plot
perbandingan antara
t(menit) dengan
V(m3)
End
184
III. Listing
clc;
disp('Perhitungan Waktu Filtrasi untuk mendapatkan Vm3 Filtrat');
disp('<><><><><><><><><><><><><><><><><><><><><><><><>');
luas=0.873;
V=3.37;
P=338000;
Cs=23.47;
Rm=10.63*(10^7);
a= 1.863*(10^7);
vis=8.937;
n=25;
A=n*luas;
Kp=(vis*a*Cs)/((A^2)*P);
B=(vis*Rm)/(A*P);
t=((Kp/2)*(V^2))+(B*V);
z=t/60;
laju=V/z;
tmenit=t/60;
fprintf('%0s%4.4f%2s%\n','Waktu yang dibutuhkan untuk mendapat Vm3 filtrat
adalah ',tmenit,' (menit) ');
x=linspace(1,t/60,60);
y=laju*x;
plot(x,y,'.r',x,y,'-b');
xlabel('t (second)');
ylabel('Volume (m3)');
title(' Perbandingan antara t(menit) dengan V(m3)');
grid on
hold on
185
IV. Hasil Listing
186
DAFTAR PUSTAKA
187