You are on page 1of 33

Plot Function

Topik yang akan dibahas


❑ Line plots
❑ Discrete plots
❑ Chart: pie, bar, histogram
❑ Contour plot
Plot Function: Line Plot

Fungsi – fungsi line plot pada MATLAB ❑ Line plots


❑ Discrete plots
❑ plot ❑ Chart: pie, bar, histogram
❑ plotyy ❑ Contour plot

❑ plot3
❑ loglog
❑ semilogx
❑ semilogy
❑ fplot

Untuk menggambarkan fungsi secara kontinyu.


Plot Function: Line Plot

❑ Fungsi “plot” ❑ Line plots


❑ Discrete plots
Fungsi “plot” digunakan untuk menampilkan grafik ❑ Chart: pie, bar, histogram
hubungan x-y. ❑ Contour plot

Beberapa syntax yang umum digunakan pada fungsi


“plot”:

plot(X, Y)
plot(X, Y, LineSpec)
plot(X, Y, …, Xn, Yn)
plot(X, Y, LineSpec1, …, Xn, Yn, LineSpecn)
plot(Y)
plot(Y, LineSpec)

Explore more in MATLAB help.


Plot Function: Line Plot

❑ Fungsi “plot” ❑ Line plots


❑ Discrete plots
Contoh penggunaan syntax plot(X, Y) untuk menggambar ❑ Chart: pie, bar, histogram
kurva y = f(x) = sin (x) pada selang 0 ≤ x ≤ 2π. ❑ Contour plot
Plot Function: Line Plot

❑ Fungsi “plot” ❑ Line plots


❑ Discrete plots
Contoh penggunaan syntax plot(X, Y, LineSpec) untuk ❑ Chart: pie, bar, histogram
menggambar kurva y = f(x) = sin (x) pada selang 0 ≤ x ≤ ❑ Contour plot
2π.

Argumen ‘-ob’
memberikan informasi
jenis garis, bentuk
penanda (marker), dan
warna yang digunakan.
- garis solid
o Marker lingkaran
b Warna biru (blue)
Plot Function: Line Plot

❑ Fungsi “plot” ❑ Line plots


❑ Discrete plots
Argumen untuk menyatakan jenis garis. ❑ Chart: pie, bar, histogram
❑ Contour plot
Plot Function: Line Plot

❑ Fungsi “plot” ❑ Line plots


❑ Discrete plots
Argumen untuk menyatakan jenis penanda data (marker). ❑ Chart: pie, bar, histogram
❑ Contour plot
Plot Function: Line Plot

❑ Fungsi “plot” ❑ Line plots


❑ Discrete plots
Argumen untuk menyatakan jenis penanda data (marker). ❑ Chart: pie, bar, histogram
❑ Contour plot
Plot Function: Line Plot

❑ Fungsi “plot” ❑ Line plots


❑ Discrete plots
Contoh penggunaan syntax plot(X, Y, … Xn, Yn) untuk ❑ Chart: pie, bar, histogram
menggambar kurva y = f(x) = sin (x) dan y = g(x) = cos (x) ❑ Contour plot
pada selang 0 ≤ x ≤ 2π.
Plot Function: Line Plot

❑ Fungsi “plot” ❑ Line plots


❑ Discrete plots
Contoh penggunaan syntax plot(X, Y, LineSpec … Xn, Yn, ❑ Chart: pie, bar, histogram
LineSpecn) untuk menggambar kurva y = f(x) = sin (x) dan ❑ Contour plot
y = g(x) = cos (x) pada selang 0 ≤ x ≤ 2π.
Plot Function: Line Plot

❑ Fungsi “plot” ❑ Line plots


❑ Discrete plots
Contoh penggunaan syntax plot(Y) untuk menggambar ❑ Chart: pie, bar, histogram
kurva y = f(x) = sin (x) pada selang 0 ≤ x ≤ 2π. ❑ Contour plot
Plot Function: Line Plot

❑ Fungsi “plot” ❑ Line plots


❑ Discrete plots
Contoh penggunaan syntax plot(Y, LineSpec) untuk ❑ Chart: pie, bar, histogram
menggambar kurva y = f(x) = sin (x) pada selang 0 ≤ x ≤ ❑ Contour plot
2π.
Plot Function: Line Plot

❑ Fungsi “plotyy” ❑ Line plots


❑ Discrete plots
Fungsi “plotyy” digunakan untuk menampilkan grafik ❑ Chart: pie, bar, histogram
hubungan x-y dengan 2 skala pada sumbu y. ❑ Contour plot

Syntax yang digunakan plotyy(X1, Y1, X2, Y2).


Plot Function: Line Plot

❑ Fungsi “loglog” ❑ Line plots


❑ Discrete plots
Fungsi “loglog” digunakan untuk menampilkan grafik ❑ Chart: pie, bar, histogram
hubungan x-y dalam skala logaritmik. ❑ Contour plot

Syntax yang digunakan loglog(X1, Y1) dan


loglog(X1, Y1, LineSpec).
Plot Function: Line Plot

❑ Fungsi “semilogx” ❑ Line plots


❑ Discrete plots
Fungsi “semilogx” digunakan untuk menampilkan grafik ❑ Chart: pie, bar, histogram
hubungan x-y dengan skala logaritmik untuk sumbu x ❑ Contour plot
dan skala normal untuk sumbu y.

Syntax yang digunakan semilogx(X, Y).


Plot Function: Line Plot

❑ Fungsi “semilogy” ❑ Line plots


❑ Discrete plots
Fungsi “semilogy” digunakan untuk menampilkan grafik ❑ Chart: pie, bar, histogram
hubungan x-y dengan skala logaritmik untuk sumbu y ❑ Contour plot
dan skala normal untuk sumbu x.

Syntax yang digunakan semilogy(X, Y).


Plot Function: Line Plot

❑ Fungsi “fplot” ❑ Line plots


❑ Discrete plots
Fungsi “fplot” digunakan untuk menampilkan grafik ❑ Chart: pie, bar, histogram
hubungan x-y dengan memberikan nilai batasnya. ❑ Contour plot

Syntax yang digunakan fplot(function, [x1 x2]).


Plot Function

Fungsi – fungsi discrete plot pada MATLAB ❑ Line plots


❑ Discrete plots
❑ stem ❑ Chart: pie, bar, histogram
❑ stairs ❑ Contour plot

❑ stem3
❑ scatter
❑ scatter3

Untuk menggambarkan grafik dengan penekanan data.


Plot Function: Discrete Plot

❑ Fungsi “stem” ❑ Line plots


❑ Discrete plots
Fungsi “stem” digunakan untuk menampilkan grafik ❑ Chart: pie, bar, histogram
data dengan memperlihatkan garis/batang dari sumbu ❑ Contour plot
ke data yang bersangkutan.

Syntax yang digunakan stem(X, Y) dan stem(Y).


Plot Function: Discrete Plot

❑ Fungsi “stem” ❑ Line plots


❑ Discrete plots
Fungsi “stem” digunakan untuk menampilkan grafik ❑ Chart: pie, bar, histogram
data dengan memperlihatkan garis/batang dari sumbu ❑ Contour plot
ke data yang bersangkutan.

Syntax yang digunakan stem(X, Y) dan stem(Y).


Plot Function: Discrete Plot

❑ Fungsi “stairs” ❑ Line plots


❑ Discrete plots
Fungsi “stairs” menampilkan grafik dalam bentuk anak ❑ Chart: pie, bar, histogram
tangga. ❑ Contour plot

Syntax yang digunakan stairs(X, Y) dan stairs(Y).


Plot Function: Discrete Plot

❑ Fungsi “scatter” ❑ Line plots


❑ Discrete plots
Fungsi “scatter” menampilkan grafik dengan data acak. ❑ Chart: pie, bar, histogram
❑ Contour plot
Syntax yang digunakan scatter(X, Y.
Plot Function

Fungsi – fungsi chart pada MATLAB ❑ Line plots


❑ Discrete plots
❑ bar ❑ Chart: pie, bar, histogram
❑ bar3 ❑ Contour plot

❑ barh
❑ bar3h
❑ histogram
❑ area
❑ pie
❑ pie3
Plot Function: Chart Plot

❑ Fungsi “bar” ❑ Line plots


❑ Discrete plots
Fungsi “bar” menampilkan grafik dalam bentuk batang. ❑ Chart: pie, bar, histogram
Jika data berupa matriks, maka data diperlihatkan tiap ❑ Contour plot
baris.

Syntax yang digunakan bar(X, Y) dan bar(Y).


Plot Function: Chart Plot

❑ Fungsi “barh” ❑ Line plots


❑ Discrete plots
Fungsi “barh” menampilkan grafik dalam bentuk batang ❑ Chart: pie, bar, histogram
ke ara horisontal. Jika data berupa matriks, maka data ❑ Contour plot
diperlihatkan tiap baris.

Syntax yang digunakan barh(X, Y) dan barh(Y).


Plot Function: Chart Plot

❑ Fungsi “area” ❑ Line plots


❑ Discrete plots
Fungsi “area” menampilkan luasan terarsir dari suatu ❑ Chart: pie, bar, histogram
grafik fungsi. ❑ Contour plot

Syntax yang digunakan area(X, Y).


Plot Function: Chart Plot

❑ Fungsi “pie” ❑ Line plots


❑ Discrete plots
Fungsi “pie” menampilkan grafik histogram dalam ❑ Chart: pie, bar, histogram
bentuk pie. ❑ Contour plot

Syntax yang digunakan pie(X), pie(X, explode),


pie(X, labels)
Plot Function: Chart Plot

❑ Fungsi “pie” ❑ Line plots


❑ Discrete plots
Fungsi “pie” menampilkan grafik histogram dalam ❑ Chart: pie, bar, histogram
bentuk pie. ❑ Contour plot

Syntax yang digunakan pie(X), pie(X, explode),


pie(X, labels)
Plot Function: Contour Plot

Fungsi – fungsi contour plot pada MATLAB ❑ Line plots


❑ Discrete plots
❑ contour ❑ Chart: pie, bar, histogram
❑ contourf ❑ Contour plot

Syntax yang umum digunakan


contour(x, y, z, n)
contourf(x, y, z, n)
Plot Function: Contour Plot

❑ Line plots
❑ Discrete plots
❑ Chart: pie, bar, histogram
❑ Contour plot
Plot Function

Fungsi subplot
Untuk membuat beberapa grafik dalam 1 halaman yang sama.
Plot Function

Fungsi comet
Untuk menampilka animasi penggambaran grafik.
Plot Function

Soal: Bidang momen


q = 1 ton/m’
Diketahui balok dengan
konfigurasi seperti gambar
di samping. Dengan
menggunakan fungsi area, A B
gambarkan bidang momen
yang tejadi pada balok 4.0 m 2.0 m
tersebut.

You might also like