_____________________________________________________________________
BAB III MENGGAMBAR GRAFIK
BAB III
MENGGAMBAR GRAFIK
3.1. Grafik Dua Dimensi
Menggambar fungsi dengan satu variabel pada Maple dilakukan dengan
perintah plot. Perintah ini hanya dapat digunakan untuk fungsi eksplisit, baik fungsi
sederhana maupun fungsi parameter, untuk data kontinu maupun berupa array.
Perhatikan worksheet berikut:
> restart;
> plot(cos(x) + sin(x), x=0..Pi);
> plot(tan(x), x=-Pi/3..Pi/3);
> plot([sin(t), cos(t), t=-Pi..Pi]);
> plot(sin(t),t);
[Pada contoh terakhir di atas, domain tidak diberikan; Maple menggunakan t=-10..10.
[ Empat plot di atas juga dapat dilakukan dengan cara sebagai berikut:
> plot(cos + sin, 0..Pi):
> plot(tan, -Pi..Pi):
> plot([sin, cos, -Pi..Pi]):
> plot(sin):
[Untuk ekspresi yang mempunyai diskontinuitas pada interval yang diberikan:
> plot(tan(x), x = -2*Pi..2*Pi, y = -4..4, discont = true);
> plot( -1 + 2*Heaviside(x-1) , x = -1..2, discont = true);
_____________________________________________________________________
Program Studi Matematika
Jurusan Matematika FMIPA Universitas Brawijaya
16
_____________________________________________________________________
[ Plot beberapa fungsi dalam satu frame
> plot([sin(x), x-x^3/6], x=0..2, color=[red,blue],
style=[point,line]);
BAB III MENGGAMBAR GRAFIK
[plot titik
> l := [[ n, sin(n)] $n=1..10];
> plot(l, x=0..15, style=point,symbol=circle);
l := [ [ 1, sin( 1 ) ], [ 2, sin( 2 ) ], [ 3, sin( 3 ) ], [ 4, sin( 4 ) ], [ 5, sin( 5 ) ], [ 6, sin( 6 ) ], [ 7, sin( 7 ) ],
[ 8, sin( 8 ) ], [ 9, sin( 9 ) ], [ 10 , sin( 10 ) ] ]
_____________________________________________________________________
Program Studi Matematika
Jurusan Matematika FMIPA Universitas Brawijaya
17
_____________________________________________________________________
[plot dalam koordinat polar (dengan kurva dipertebal)
> plot([sin(4*x),x,x=0..2*Pi],coords=polar,thickness=3);
BAB III MENGGAMBAR GRAFIK
Untuk meggambarkan fungsi implisit dua dimensi, perintah yang digunakan adalah
implicitplot. Perhatikan contoh berikut:
> with(plots):
implicitplot(x^2 + y^2 = 1,x=-1..1,y=1..1,numpoints=500);
implicitplot(r = 1 - cos(theta),
r=0..2,theta=0..2*Pi,coords=polar,numpoints=500);
Catatan:
Jika gambar diklik, maka contex bar akan menampirkan tombol menu untuk
gambar.
_____________________________________________________________________
Program Studi Matematika
Jurusan Matematika FMIPA Universitas Brawijaya
18
_____________________________________________________________________
> restart; with(plots):
BAB III MENGGAMBAR GRAFIK
> plot3d(sin(x+y),x=-1..1,y=-1..1);
> plot3d(sin(x*y),x=-Pi..Pi,y=-Pi..Pi);
> plot3d(sin(x*y),x=-Pi..Pi,y=-x..x);
> plot3d([x*sin(x)*cos(y),x*cos(x)*cos(y),x*sin(y)],
x=0..2*Pi,y=0..Pi);
> plot3d(x*exp(-x^2-y^2),x=-2..2,y=2..2,grid=[49,49]);
19
_____________________________________________________________________
c4:= [cos(x)-2*sin(0.4*y),sin(x)+2*cos(0.4*y),y]:
plot3d({c1,c2,c3,c4},x=0..2*Pi,y=0..10,grid=[25,15],
style=patch);
plot3d({c1,c2,c3,c4},x=0..2*Pi,y=0..10,grid=[25,15],
style=patch,color=sin(x));
BAB III MENGGAMBAR GRAFIK
_____________________________________________________________________
Program Studi Matematika
Jurusan Matematika FMIPA Universitas Brawijaya
20
_____________________________________________________________________
BAB III MENGGAMBAR GRAFIK
3.3. Animasi
Selain membuat grafik statis, Maple juga mampu membuat grafik animasi dari
fungsi dengan dua variabel (plot fungsi dua dimensi yang bergerak). Perhatikan
contoh worksheet berikut:
> with(plots):
> animate( sin(x*t),x=-10..10,t=1..2,frames=50);
> animate([sin(x*t),x,x=4..4],t=1..4,numpoints=100,frames=100);
> animate([sin(x*t),x,x=4..4],t=1..4,coords=polar,numpoints=100, frames=100);
> animate(sin(5*x*t),x=-3..3,t=0..1,view=0..1);
> animate( [u*sin(t),u*cos(t),t=-Pi..Pi],u=1..8,view=[8..8,-8..8]);
> animate( [u*t,t,t=1..8*Pi],
u=1..4,coords=polar,frames=60,numpoints=100);
> animate( {x-x^3/u,sin(u*x)}, x=0..Pi/2,u=1..16 );
> animate( {x-x^3/u,sin(u*x)}, x=0..Pi/2,u=1..16 ,color=
red);
> s := t->100/(100+(t-Pi/2)^8): r := t -> s(t)*(2sin(7*t)-cos(30*t)/2):
animate([u*r(t)/2,t,t=Pi/2..3/2*Pi],u=1..2,numpoints=200,coords=polar,axes=none,
color=green);
Catatan:
Seperti hal pada grafik, ketika gambar animasi diklik, contex bar menunjukkan
tombol-tombol operasi untuk animasi
_____________________________________________________________________
Program Studi Matematika
Jurusan Matematika FMIPA Universitas Brawijaya