-->

Monday, April 20, 2015

Mebuat plot fungsi dengan matlab
Soal (2 a)
v  Buatlah plot sebuah fungsi x dimana -3 < x < 3 dan f(x) = x2
Perintah:
1.      Gunakan interval untuk ∆x = 1
2.      Rubahlah interval untuk ∆x = 0,5 kemudian untuk ∆x = 0,1
3.      Tampilkan ketiga plot dalam satu grafik
4.      Berikanlah label untuk masing-masing plot.
Hint: -     Gunakan perintah plot(x,y,’o’).
-          Gunakan subplot(1,3,i) dimana i adalah nomor urutan plot.
Jawab:
v  Bagian per Plot
1-    figure(1)
2-    x = -3:1:3;
3-    y = x.^2;
4-    subplot(1,3,1)
5-    plot(x,y,'o')
6-    xlabel('x')
7-    ylabel('y=x^2')
8-    title('Plot dengan perintah plot x = 1')


1-    figure(2)
2-    x = -3:0.5:3;
3-    y = x.^2;
4-    subplot(1,3,2)
5-    plot(x,y,'o')
6-    xlabel('x')
7-    ylabel('y=x^2')
8-    title('Plot dengan perintah plot x = 0.5')

1-    figure(2)
2-    x = -3:0.1:3;
3-    y = x.^2;
4-    subplot(1,3,3)
5-    plot(x,y,'o')  
6-    xlabel('x')  
7-    ylabel('y=x^2')
8-    title('Plot dengan perintah plot x = 0.1')



v  Bagian 3 plot
1-     figure(1)
2-     x = -3:1:3;
3-     y = x.^2;
4-     subplot(1,3,1)
5-     plot(x,y,'o')
6-     xlabel('x')
7-     ylabel('y=x^2')
8-     title('Plot dengan perintah plot x = 1')
9-     x = -3:0.5:3;
10-y = x.^2;
11-subplot(1,3,2)
12-plot(x,y,'o')
13-xlabel('x')
14-ylabel('y=x^2')
15-title('Plot dengan perintah plot x = 0.5')
16-x = -3:0.1:3;
17-y = x.^2;
18-subplot(1,3,3)
19-plot(x,y,'o')
20-xlabel('x')
21-ylabel('y=x^2')
22-title('Plot dengan perintah plot x = 0.1')

Plot grafiknya:





Soal (2 b)
v  Buatlah plot x-y dengan fungsi-fungsi sebagai berikut:
x(t) = (1+2sin t)cos t, y(t) = (1+2sin t)sin t, (0,2π)
v  Jawaban:
1-    t = 0:360;
2-    x = (1+2.*sin(t)).*cos(t);
3-    y = (1+2.*sin(t)).*sin(t);
4-    plot (x,y,'r')

v  Grafik plot:





Terimakasih,.... 





0 comments:

Post a Comment

Kontak Saya

No. WhatsApp:

+62 852 9091 95XX

Alamat:

Kelurahan Tembalang, Kecamatan Tembalang,
Kota Semarang, Jawa Tengah

Email:

hendriseetiawan@gmail.com