P5 Visualisasi Data dengan gnuplot Modul Praktikum FI2283 Pemrograman dan Simulasi Fisika Versi 213.9.29 Catatan. Dalam praktikum ini akan dipelajari dan dipraktekkan bagaimana membuat visualisasi data dengan memanfaatkan aplikasi gnuplot. Visualisasi yang dimaksud dalam hal ini masih dibatasi dalam bentuk grafik y terhadap x, di mana variabel x dan y dapat berarti data apa saja. 1 Grafik y terhadap x 49 2 Grafik dari dua berkas berbeda 51 3 Grafik dari berkas dengan banyak kolom data 53 4 Grafik sebagian data 55 5 Grafik sebagian data (lagi) 6 6 Grafik dari fungsi 61 7 Grafik dari fungsi dan berkas data 64 8 Fitting data dengan suatu fungsi 67 9 Fitting data dengan suatu fungsi (lagi) 71 1 Animasi sederhana dengan gnuplot dan convert 71 1 Grafik y terhadap x Buat berkas suatu berkas teks, dengan penyunting teks yang Anda kuasai, yang isinya adalah sebagai berikut ini 49
#x y 12 1 5 2 3-3 4-4 5-3 6 7 5 8 12 9 21 1 32 dan simpan dengan nama data-1.txt. Kemudian buat berkas teks lain yang berisi script untuk gnuplot # plot-1.gps # Plot data and produce EPS file # Sparisoma Viridi <dudung@gmail.com> # 213929.921 # Execute: gnuplot plot-1.gps # Set terminal to eps set term post eps color enhanced # Set output file set output "data-1.eps" # Set input file input="data-1.txt" # Set image size set size.9, 1. # Set bottom margin -- for some distro it needs correction set bmargin 3.5 # Set x-axis set xlabel "{/Italic x} (m)" font "Times, 24" set xtics 2 font "Times, 22" set xrange [:1] # Set y-axis set ylabel "{/Italic y} (m)" font "Times, 24" set ytics 1 font "Times, 22" 5
4 3 2 1-1 2 4 6 8 1 Gambar 1: Hasil eksekusi script plot-1.gps yang dipanggil dengan gnuplot. set yrange [-1:4] # Set grid set grid xtics ytics # Plot data plot input u 1:2 title "" pt 4 ps 2.5 dan simpan dengan nama plot-1.gps. Tugas 1. Jalankan gnuplot untuk mengeksekusi berkas teks plot-1.gps dengan cara gnuplot plot-1.gps sehingga menghasilkan berkas gambar data-1.eps sebagaimana diberikan dalam Gambar 1. Modifikasi script gnuplot sebelumnya sehingga dapat menghasilkan Gambar 2. Simpan hasil modifikasi script tersebut dengan nama plot-1a.gps. Jelaskan perbedaan hasil keluaran kedua script tersebut dalam berkas laporan.txt. 2 Grafik dari dua berkas berbeda Buat berkas suatu berkas teks, dengan penyunting teks yang Anda kuasai, yang isinya adalah sebagai berikut ini #x y 51
4 3 2 1-1 2 4 6 8 1 Gambar 2: Hasil eksekusi script plot-1a.gps yang dipanggil dengan gnuplot. -38.4 1-21 2-9.6 3-3 4 5.6 6 7 -.6 8 9 3 1 9.6 dan simpan dengan nama data-2.txt. Kemudian buat berkas teks lain yang berisi script untuk gnuplot # plot-2.gps # Plot data and produce EPS file # Sparisoma Viridi <dudung@gmail.com> # 213929.111 # Execute: gnuplot plot-2.gps # Set terminal to eps set term post eps color enhanced # Set output file set output "data-2.eps" 52
# Set input file input1="data-1.txt" input2="data-2.txt" # Set image size set size.9, 1. # Set bottom margin -- for some distro it needs correction set bmargin 3.5 # Set x-axis set xlabel "{/Italic x} (m)" font "Times, 24" set xtics 2 font "Times, 22" set xrange [:1] # Set y-axis set ylabel "{/Italic y} (m)" font "Times, 24" set ytics 1 font "Times, 22" set yrange [-1:4] # Set grid set grid xtics ytics # Plot data plot \ input1 u 1:2 w lp title "" pt 4 ps 2.5, \ input2 u 1:2 w lp title "" pt 6 ps 2.5 dan simpan dengan nama plot-2.gps. Tugas 2. Jalankan gnuplot untuk mengeksekusi berkas teks plot-2.gps dengan cara yang sama seperti sebelumnya sehingga menghasilkan berkas gambar data-2.eps sebagaimana diberikan dalam Gambar 3. Jelaskan apa perbedaan tujuan dari script ini dibandingkan dengan script sebelumnya, tuliskan dalam laporan.txt. 3 Grafik dari berkas dengan banyak kolom data Buatlah berkas teks yang berisikan #x y1 y2 y3 5 12-38.4 1 8 5-21 53
4 3 2 1-1 2 4 6 8 1 Gambar 3: Hasil eksekusi script plot-2.gps yang dipanggil dengan gnuplot. 2 11-9.6 3 14-3 -3 4 17-4 5 2-3.6 6 23 7 26 5 -.6 8 29 12 9 32 21 3 1 35 32 9.6 dan simpan dengan nama data-3.txt. Dalam gnuplot, saat memanggil perintah plot, dapat dipilih pasangan kolom data mana yang ingin ditampilkan. Untuk kolom C1 dan C2 gunakan.. u C1:C2.. Tugas 3. Modifikasi script sebelumnya sehingga dapat diperoleh Gambar 4. Simpan script tersebut dengan nama plot-3.gps dengan hasil keluarannya adalah data-3.eps. Gunakan potongan script berikut apabila diperlukan # Plot data plot \ input u 1:2 w lp pt 4 ps 2.5 \ title "3{/Italic x} + 5", \ 54
4 3 3x + 5 (x -2 )(x - 6).2(x-4)(x-6)(x-8) 2 1-1 2 4 6 8 1 Gambar 4: Isi dari berkas data-3.eps, yang merupakan hasil eksekusi script plot-3.gps. input u 1:3 w lp pt 6 ps 2.5 \ title "({/Italic x} -2 )({/Italic x} - 6)", \ input u 1:4 w lp pt 8 ps 2.5 \ title ".2({/Italic x}-4)({/italic x}-6)({/italic x}-8)" 4 Grafik sebagian data Ketik dan kompilasi program berikut ini untuk menghasilkan berkas data-4.txt /* */ gen-data.cpp 213929.1126 Sparisoma Viridi <dudung@gmail.com> Generate data for gnuplot Compile: g++ gen-data.cpp -o gen-data Execute:./gen-data #include <iostream> #include <fstream> #include <math.h> const double PI = 3.141529; using namespace std; 55
int main(int argc, char *argv[]) { // Set ouput filename char ofn[] = "data-4.txt"; ofstream fout; fout.open(ofn); if(fout.is_open()) { // Oscillation parameters double f1 = 1.; double f2 = 2.; double fi1 =.; double fi2 =.; double A1 = 1.; double A2 = 1.5; // Iteration parameters double t =.; double t1 = t + 3. / f1; double t2 = t1 + 4. / f2; double t =.; double dt = 1.E-4; // Do interation fout << "#t\tf" << endl; while(t < t2 + dt) { // Both oscillation function double y1 = A1 * sin(2 * PI * f1 * t + fi1); double y2 = A2 * sin(2 * PI * f2 * t + fi2); // Select time condition double y = (t < t1)? y1 : y2; // Plot the results fout << t << "\t"; fout << y << endl; } // Increase the time t += dt; } // Close the file fout.close(); 56
} return ; dengan mengikuti petunjuk dalam kode tersebut. Kemudian buat script untuk gnulplot berikut ini # plot-4.gps # Plot data and produce EPS file # Sparisoma Viridi <dudung@gmail.com> # 213929.1214 # Execute: gnuplot plot-4.gps # Set terminal to eps set term post eps color enhanced font "Times, 32" # Set input file input="data-4.txt" # Set image size set size.9, 1. # Set bottom margin -- for some distro it needs correction set bmargin 3.5 # Set x-axis set xlabel "{/Italic t} (s)" font "Times, 32" set xtics.1 font "Times, 3" set xrange [:.5] # Set y-axis set ylabel "{/Italic y} (m)" font "Times, 32" set ytics.5 font "Times, 3" set yrange [-1.5:1.5] # Set grid set grid xtics ytics # Set legend set key inside left top spacing 4 # All data # Set output file set output "data-4.eps" 57
# Plot data plot \ input u 1:2 w lp pt 4 ps 1.5 \ title "" # Every 1 data # Set output file set output "data-4a.eps" # Plot data plot \ input u 1:2 every 1 w lp pt 4 ps 1.5 \ title "" # Every 2 data # Set output file set output "data-4b.eps" # Plot data plot \ input u 1:2 every 2 w lp pt 4 ps 1.5 \ title "" # Every 2 data # Set output file set output "data-4c.eps" # Plot data plot \ input u 1:2 every 5 w lp pt 4 ps 1.5 \ title "" dan simpan dalam berkas teks dengan nama plot-4.gps. Jalankan dengan gnuplot sehingga menghasilkan berkas-berkas data-4.eps, data-4a.eps, data-4b.eps, dan data-4c.eps, sebagaimana ditampilkan dalam Gambar 5. Tugas 4. Jelaskan dalam berkas laporan.txt apa fungsi dari opsi every dalam penggunaan perintah plot dalam gnuplot. 58
1.5 1.5 1 1.5.5 -.5 -.5-1 -1-1.5.1.2.3.4.5 t (s) 1.5 1.5 (a) -1.5 1.5 1.5.1.2.3.4.5 t (s) (b) -.5 -.5-1 -1-1.5.1.2.3.4.5 t (s) -1.5.1.2.3.4.5 t (s) (c) (d) Gambar 5: Hasil eksekusi script plot-4.gps untuk berkas data-4.txt untuk setiap: (a) 1 data, (b) 1 data, (c) 2 data, dan (d) 5 data. 59
5 Grafik sebagian data (lagi) Kadang tidak semua data ingin ditampilkan tetapi hanya 3 data pertama dari 5 data, yang misalnya terdapat dalam berkas data-4.txt. Atau 2 data terakhirnya saja. Untuk memahaminya, perhatikan contoh script berikut ini # plot-5.gps # Plot data and produce EPS file # Sparisoma Viridi <dudung@gmail.com> # 213929.1538 # Execute: gnuplot plot-5.gps # Set terminal to eps set term post eps color enhanced font "Times, 32" # Set input file input="data-4.txt" # Set image size set size.9, 1. # Set bottom margin -- for some distro it needs correction set bmargin 3.5 # Set x-axis set xlabel "{/Italic t} (s)" font "Times, 32" set xtics.1 font "Times, 3" set xrange [:.5] # Set y-axis set ylabel "{/Italic y} (m)" font "Times, 32" set ytics.5 font "Times, 3" set yrange [-1.5:1.5] # Set grid set grid xtics ytics # Set legend set key inside left top spacing 4 # All data # Set output file set output "data-5.eps" 6
# Plot data plot \ input u 1:2 w lp pt 4 ps 1.5 \ title "" # First 3 data of 5 data # Set output file set output "data-5a.eps" # Plot data plot \ input u 1:2 every ::::3 w lp pt 4 ps 1.5 \ title "" # Last 2 data of 5 data # Set output file set output "data-5b.eps" # Plot data plot \ input u 1:2 every ::3::5 w lp pt 4 ps 1.5 \ title "" dan simpan dengan nama plot-5.gps. Jalankan sehingga dihasilkan grafikgrafik seperti dalam Gambar 6. Tugas 5. Modifikasi script plot-5.gps sehingga grafik dalam Gambar 6.b dan 6.b memberikan rentang sumbu horizontal (atau sumbu t) yang tidak kosong sebagian. Jadi untuk Gambar 6.b digambarkan s t.3 s dan untuk Gambar 6.b digambarkan.3 s t.5 s. Simpan kedua gambar dengan nama data-5a.eps dan data-5b.eps. 6 Grafik dari fungsi Bagaimana menggambarkan data dari suatu berkas teks menggunakan gnuplot telah dipelajari pada praktikum ini dalam tugas-tugas sebelum bagian ini. Berikutnya akan dipelajari bagaimana menggambarkan suatu fungsi. Untuk itu salin script berikut ini # plot-6.gps # Plot data and produce EPS file 61
1.5 1.5 -.5-1 -1.5.1.2.3.4.5 t (s) (a) 1.5 1.5 -.5-1 (b) -1.5.1.2.3.4.5 t (s) 1.5 1.5 -.5-1 (c) -1.5.1.2.3.4.5 t (s) Gambar 6: Hasil eksekusi script plot-5.gps untuk berkas data-4.txt untuk: (a) seluruh 5 data, (b) 3 data pertama, dan (c) 2 data terakhir. 62
# Sparisoma Viridi <dudung@gmail.com> # 213929.168 # Execute: gnuplot plot-6.gps # Set terminal to eps set term post eps color enhanced font "Times, 24" # Set image size set size.9, 1. # Set bottom margin -- for some distro it needs correction set bmargin 3.5 # Set x-axis set xlabel "{/Italic x} (m)" font "Times, 3" set xtics 4 font "Times, 28" set mxtics 2 set xrange [:2] # Set y-axis set ylabel "{/Italic y} (m)" font "Times, 3" set ytics 1 font "Times, 28" set mytics 2 set yrange [-2:25] set format y "%.t {/Arial x} 1^{%T}" # Set grid set grid xtics ytics mxtics mytics # Set legend set key top spacing 4 # Set output file set output "data-6.eps" # Define a function of a pre-defined dummy variabel x f(x) = (x-1)*(x-8)*(x-15)*(x-18) # Plot data plot f(x) w l lw 6\ title "{/Italics y} = \ ({/Italic x} - 1)\ ({/Italic x} - 8)\ ({/Italic x} - 15)\ ({/Italic x} - 18)" 63
2 x 1 3 y = (x - 1)(x - 8)(x - 15)(x - 18) 1 x 1 3 x 1-1 x 1 3-2 x 1 3 4 8 12 16 2 Gambar 7: Hasil eksekusi script plot-6.gps yang menggambarkan fungsi y = (x 1)(x 8)(x 15)(x 18). dengan nama plot-6.gps dan jalankan sehingga diperoleh Gambar 7. Tugas 6. Modifikasi script plot-6.gps menjadi plot-6a.gps sehingga dapat menggambarkan fungsi y = 2x 2 5x + 1.373, (1) untuk rentang x [ 2.5, 7.5] sebagaimana digambarkan dalam Gambar 8, dalam bentuk berkas data-6a.gps. 7 Grafik dari fungsi dan berkas data Salin data berikut ini #x y 2.8 1 5.2 2 7 3 9.3 4 1.5 5 13.5 6 15.3 7 16.9 8 18.7 9 2.6 64
8 x 1 1 6 x 1 1 y = 2x 2-5x + 1.373 4 x 1 1 2 x 1 1 x 1-2 x 1 1-2 2 4 6 Gambar 8: Plot Persamaan (1) untuk rentang x [ 2.5,7.5]. 1 23.4 dalam berkas teks dengan nama data-7.txt dan juga script berikut ini # plot-7.gps # Plot data and produce EPS file # Sparisoma Viridi <dudung@gmail.com> # 213929.1741 # Execute: gnuplot plot-7.gps # Set terminal to eps set term post eps color enhanced font "Times, 24" # Set image size set size.8, 1. # Set bottom margin -- for some distro it needs correction set bmargin 3.5 # Set x-axis set xlabel "{/Italic x} (m)" font "Times, 3" set xtics 2 font "Times, 28" set mxtics 2 set xrange [:1] # Set y-axis set ylabel "{/Italic y} (m)" font "Times, 3" 65
25 2 y = 2x + 3 Eksperimen 15 1 5 2 4 6 8 1 Gambar 9: Plot Persamaan y = 2x + 3 dan data dari berkas data-7.txt menggunakan script plot-7.gps. set ytics 5 font "Times, 28" set mytics 2 set yrange [:25] # Set grid set grid xtics ytics # Set legend set key top left spacing 4 # Set output file set output "data-7.eps" # Define a function of a pre-defined dummy variabel x f(x) = 2*x + 3 # Plot data plot \ f(x) w l lw 6 title "{/Italics y} = 2{/Italic x} + 3", \ "data-7.txt" u 1:2 w p pt 5 ps 2.5 t "Eksperimen" dalam berkas dengan nama plot-7.gps. Jalankan script sehingga diperoleh berkas data-7.eps seperti dalam Gambar 9. 66
Tugas 7. Buat data Anda sendiri dalam berkas teks data-7a.txt dan modifikasi script plot-7.gps menjadi plot-7a.gps sehingga dapat menggambarkan fungsi dan data yang Anda buat. 8 Fitting data dengan suatu fungsi Gnuplot memiliki perintah fit yang dapat digunakan untuk fitting data terhadap suatu fungsi yang diinginkan. Untuk pembelajaran ini akan digunakan data dalam berkas teks data-7.txt sebelumnya. Salin script berikut ini # plot-8.gps # Plot data, fit witn equation and produce EPS file # Sparisoma Viridi <dudung@gmail.com> # 213929.1824 # Execute: gnuplot plot-8.gps # Set terminal to eps set term post eps color enhanced font "Times, 24" # Set image size set size.8, 1. # Set bottom margin -- for some distro it needs correction set bmargin 3.5 # Set x-axis set xlabel "{/Italic x} (m)" font "Times, 3" set xtics 2 font "Times, 28" set mxtics 2 set xrange [:1] # Set y-axis set ylabel "{/Italic y} (m)" font "Times, 3" set ytics 5 font "Times, 28" set mytics 2 set yrange [:25] # Set grid set grid xtics ytics # Set legend set key right bottom spacing 4 # Set input file 67
input = "data-7.txt" # Set output file set output "data-8.eps" # Define a function of a pre-defined dummy variabel x f(x) = a*x + b # Fit the function to data fit f(x) input via a, b # Title for equation eqnt = sprintf("{/italics y} = %f{/italics y} + %f", a, b); # Plot data plot \ f(x) w l lw 6 title eqnt, \ input u 1:2 w p pt 5 ps 2.5 t "Eksperimen" dalam berkas dengan nama plot-8.gps. Jalankan script sehingga diperoleh berkas data-8.eps seperti dalam Gambar 1. Proses iterasi untuk menemukan nilai a dan b dalam fungsi yang digunakan, yaitu adalah seperti berikut ini f(x) = ax + b (2) Iteration WSSR : 652.38 delta(wssr)/wssr : delta(wssr) : limit for stopping : 1e-5 lambda : 4.24264 initial set of free parameter values a = 1 b = 1 / Iteration 1 WSSR : 1.2475 delta(wssr)/wssr : -62.6622 delta(wssr) : -642.132 limit for stopping : 1e-5 lambda :.424264 resultant parameter values 68
25 2 15 1 5 y = 1.997273x + 3.31818 Eksperimen 2 4 6 8 1 Gambar 1: Plot Persamaan (2) hasil perintah fit dan data dari berkas data-7.txt menggunakan script plot-8.gps. a = 2.1694 b = 1.44425 / Iteration 2 WSSR : 1.19946 delta(wssr)/wssr : -7.54342 delta(wssr) : -9.486 limit for stopping : 1e-5 lambda :.424264 resultant parameter values a = 2.981 b = 2.94458 / Iteration 3 WSSR : 1.17555 delta(wssr)/wssr : -.23467 delta(wssr) : -.239185 limit for stopping : 1e-5 lambda :.424264 resultant parameter values a = 1.99728 69
b = 3.3177 / Iteration 4 WSSR : 1.17555 delta(wssr)/wssr : -6.9433e-9 delta(wssr) : -8.16217e-9 limit for stopping : 1e-5 lambda :.424264 resultant parameter values a = 1.99727 b = 3.3182 After 4 iterations the fit converged. final sum of squares of residuals : 1.17555 rel. change during last iteration : -6.9433e-9 degrees of freedom (FIT_NDF) : 9 rms of residuals (FIT_STDFIT) = sqrt(wssr/ndf) :.36149 variance of residuals (reduced chisquare) = WSSR/ndf :.13616 Final set of parameters Asymptotic Standard Error ======================= ========================== a = 1.99727 +/-.3446 (1.725%) b = 3.3182 +/-.239 (6.724%) correlation matrix of the fit parameters: a b a 1. b -.845 1. Tugas 8. Jelaskan apa maksud bagian # Title for equation eqnt = sprintf("{/italics y} = %f{/italics y} + %f", a, b); dalam script plot-8.gps? Jelaskan jawaban Anda dalam berkas laporan.txt. 7
25 2 15 1 5 y = -.2681x 2 + 2.2479x + 2.99168 Eksperimen -5 2 4 6 8 1 Gambar 11: Plot Persamaan (3) hasil perintah fit dan data dari berkas data-7.txt menggunakan script plot-9.gps. 9 Fitting data dengan suatu fungsi (lagi) Tugas 9. Modifikasi script plot-8.gps menjadi plot-9.gps sehingga dapat mengakomodasi model atau fungsi berbentuk f(x) = ax 2 + bx + c (3) untuk data yang sama dalam berkas teks data-7.txt. Laporkan nilai-nilai a, b, dan c dalam berkas laporan.txt dan tampilkan grafiknya seperti dalam Gambar 11. 1 Animasi sederhana dengan gnuplot dan convert Salin script berikut ini # plot-1.gps # Plot data, fit witn equation and produce EPS file # Sparisoma Viridi <dudung@gmail.com> # 213929.23 # Execute: gnuplot plot-1.gps # Set terminal to eps 71
set term post eps color enhanced font "Times, 24" # Set image size set size 1.2,.8 # Set bottom margin -- for some distro it needs correction set bmargin 3.5 # Set x-axis set xlabel "{/Italic x} (m)" font "Times, 3" set xtics.5 font "Times, 28" set mxtics 4 set xrange [:2] # Set y-axis set ylabel "{/Italic y} (m)" font "Times, 3" set ytics.1 font "Times, 28" set mytics 2 set yrange [-.2:.2] # Set grid set grid xtics ytics mxtics mytics # Define a wave function PI = 3.141529 A =.2 l = 1. f = 1. T = 1. / f k = 2. * PI / l w = 2. * PI / T y(x, t) = A * sin(k*x - w*t) # Plot data a =. t = a * T timestamp = sprintf("{/italics t} = %1.2f T", a); filename = sprintf("data-1-%1.1f.eps", a); set output filename unset label set label timestamp at -.25, -.28 font ", 28" plot y(x, t) w l lw 8 t "" a =.1 t = a * T timestamp = sprintf("{/italics t} = %1.2f T", a); 72
filename = sprintf("data-1-%1.1f.eps", a); set output filename unset label set label timestamp at -.25, -.28 font ", 28" plot y(x, t) w l lw 8 t "" a =.2 t = a * T timestamp = sprintf("{/italics t} = %1.2f T", a); filename = sprintf("data-1-%1.1f.eps", a); set output filename unset label set label timestamp at -.25, -.28 font ", 28" plot y(x, t) w l lw 8 t "" a =.3 t = a * T timestamp = sprintf("{/italics t} = %1.2f T", a); filename = sprintf("data-1-%1.1f.eps", a); set output filename unset label set label timestamp at -.25, -.28 font ", 28" plot y(x, t) w l lw 8 t "" a =.4 t = a * T timestamp = sprintf("{/italics t} = %1.2f T", a); filename = sprintf("data-1-%1.1f.eps", a); set output filename unset label set label timestamp at -.25, -.28 font ", 28" plot y(x, t) w l lw 8 t "" a =.5 t = a * T timestamp = sprintf("{/italics t} = %1.2f T", a); filename = sprintf("data-1-%1.1f.eps", a); set output filename unset label set label timestamp at -.25, -.28 font ", 28" plot y(x, t) w l lw 8 t "" a =.6 t = a * T timestamp = sprintf("{/italics t} = %1.2f T", a); filename = sprintf("data-1-%1.1f.eps", a); 73
set output filename unset label set label timestamp at -.25, -.28 font ", 28" plot y(x, t) w l lw 8 t "" a =.7 t = a * T timestamp = sprintf("{/italics t} = %1.2f T", a); filename = sprintf("data-1-%1.1f.eps", a); set output filename unset label set label timestamp at -.25, -.28 font ", 28" plot y(x, t) w l lw 8 t "" a =.8 t = a * T timestamp = sprintf("{/italics t} = %1.2f T", a); filename = sprintf("data-1-%1.1f.eps", a); set output filename unset label set label timestamp at -.25, -.28 font ", 28" plot y(x, t) w l lw 8 t "" a =.9 t = a * T timestamp = sprintf("{/italics t} = %1.2f T", a); filename = sprintf("data-1-%1.1f.eps", a); set output filename unset label set label timestamp at -.25, -.28 font ", 28" plot y(x, t) w l lw 8 t "" dalam berkas teks plot-1.gps dan jalankan sehingga diperoleh berkas-berkas data-1-..eps sampai data-1-.9.eps. Konversi berkas-berkas.eps yang dihasilkan menjadi.png dengan cara menggunakan perintah berikut pada konsol convert data-1-..eps data-1-..jpg convert data-1-.1.eps data-1-.1.jpg convert data-1-.2.eps data-1-.2.jpg convert data-1-.3.eps data-1-.3.jpg convert data-1-.4.eps data-1-.4.jpg convert data-1-.5.eps data-1-.5.jpg convert data-1-.6.eps data-1-.6.jpg convert data-1-.7.eps data-1-.7.jpg convert data-1-.8.eps data-1-.8.jpg 74
convert data-1-.9.eps data-1-.9.jpg convert *.jpg data-1.gif Tugas 1. Lihat hasil konversi dari berkas *.jpg menjadi data-1.gif menggunakan penjelajah internet yang ada. Laporkan hasil pengamatan Anda dalam berkas laporan.txt. Ilustrasi snapshot grafik fungsi gelombang dapat dilihat dalam Gambar 12. Keluaran praktikum 1. data-1.txt, plot-1.gps, data-1.eps, plot-1a.gps, data-1a.eps, data-2.txt, plot-2.gps, data-2.eps, data-3.txt, plot-3.gps, data-3.eps, data-gen.cpp, data-4.txt, data-4.eps, data-4a.eps, data-4b.eps, data-4c.eps, plot-5.gps, data-5a.eps, data-5b.eps, plot-6.gps, data-6.eps, plot-6a.gps, data-6a.eps, data-7.txt, plot-7.gps, data-7.eps, data-7a.txt, plot-7a.gps, data-7a.eps, plot-8.gps, data-8.eps, plot-9.gps, data-9.eps dan. 2. laporan.txt yang berisikan jawaban dari Tugas 1, 2, 4, 6, 8, 9, dan 1. This work is licensed under a Creative Commons Attribution-ShareAlike 3. Unported License. 1 1 Sparisoma Viridi <dudung@gmail.com>,.., 213 75
.2.2.1.1 -.1 -.1 -.2.5 1 1.5 2 t =. T.2.1 -.2.5 1 1.5 2 t =.1 T.2.1 -.1 -.1 -.2.5 1 1.5 2 t =.2 T.2.1 -.2.5 1 1.5 2 t =.3 T.2.1 -.1 -.1 -.2.5 1 1.5 2 t =.4 T.2.1 -.2.5 1 1.5 2 t =.5 T.2.1 -.1 -.1 -.2.5 1 1.5 2 t =.6 T.2.1 -.2.5 1 1.5 2 t =.7 T.2.1 -.1 -.1 -.2.5 1 1.5 2 t =.8 T -.2.5 1 1.5 2 t =.9 T Gambar 12: Hasil yang diperoleh dari script plot-1.gps untuk waktu-waktu:.t,.1t,.2t,.3t,.4t,.5t,.6t,.7t,.8t, dan.9 T, di mana T adalah periode osilasi. 76