You are on page 1of 44

Tugas Kelompok III

Hasil pengamatan 15 minggu pertama


terhadap curah hujan di suatu wilayah
diperoleh data seperti yang tetulis
pada tabel sebelah kanan. Jika suatu
pemodelan matematis dari data
pengamatan tersebut ada
kecenderungan berbentuk
dengan a, b adalah parameter data
pengamatan, dan x, y adalah variable
data pengamatan.












Tabel Hasil Pengamatan Data Curah Hujan

Waktu
Pengamatan
(minggu ke)
Curah
Hujan
3
(mm )
1 2.175
2 3.787
3 6.7
4 11.711
5 20.495
6 35.904
7 62.789
8 109.96
9 192.419
10 336.75
11 589.3
12 1031
13 1800.95
14 3157.987
15 5525.766

1. Tentukan uraian verifikasi matematis dengan linearisasi untuk pembentukan model
tersebut agar metoda regresi linier dapat dilakukan !
JAWAB :
Karena

merupakan Regresi Non linier Eksponensial sehingga rumus


tersebut harus ditransformasikan terlebih dahulu agar metoda regresi linear
dapat dilakukan :

Dimana :


Maka metode regresi linear yang didapat adalah:


2. Bagaimana anda menghitung parameter a dan b dengan metoda regresinya !
JAWAB :
Rumus untuk mencari parameter a :

)
Rumus untuk mencari parameter b :




3. Berdasarkan (ii), tentukan nilai parameter a dan b untuk model tersebut !
JAWAB :
Waktu
pengamatan
(x)
Curah hujan
dalam mm3 (y)
log y X
2
x log y
1 2.175 0.337459261 1 0.337459261
2 3.787 0.578295305 4 1.15659061
3 6.7 0.826074803 9 2.478224408
4 11.711 1.068593981 16 4.274375924
5 20.495 1.311647923 25 6.558239613
6 35.904 1.555142835 36 9.330857011
7 62.789 1.797883566 49 12.58518496
8 109.96 2.041234731 64 16.32987785
9 192.419 2.284247953 81 20.55823158
10 336.75 2.527307604 100 25.27307604
11 589.3 2.770336441 121 30.47370085
12 1031 3.013258665 144 36.15910398
13 1800.95 3.255501656 169 42.32152152
14 3157.987 3.499410338 196 48.99174473
15 5525.766 3.74239249 225 56.13588735


untuk menghitung parameter (b) yaitu :




Transformasikan (Log b) ke (b) :


Sehingga didapat (pembulatan 4 digit)
Untuk menghitung parameter (a) yaitu :



Transformasikan (Log a) ke (a) :


Sehingga didapat (pembulatan 4 digit)
4. Validasi model yang anda buat dengan menghitung data pengamatan melalui
model tersebut !
JAWAB :


Waktu
pengamatan
(x)
Y
1 2.17874615
2 3.814330885
3 6.67774908
4 11.69073531
5 20.46697031
6 35.83152493
7 62.7302507
8 109.8218499
9 192.2651126
10 336.5985326
11 589.2830511
12 1031.657838
13 1806.123376
14 3161.980195
15 5535.678727

5. Gambarkan grafik data pengamatan yang sebenarnya dan grafik data
pengamatan model !
JAWAB :
Waktu
pengamatan
(x)
nilai Y pada
model
Nilai Y pada
data
pengamatan
1 2.17874615 2.175
2 3.814330885 3.787
3 6.67774908 6.7
4 11.69073531 11.711
5 20.46697031 20.495
6 35.83152493 35.904
7 62.7302507 62.789
8 109.8218499 109.96
9 192.2651126 192.419
10 336.5985326 336.75
11 589.2830511 589.3
12 1031.657838 1031
13 1806.123376 1800.95
14 3161.980195 3157.987
15 5535.678727 5525.766

Perbedaan (galat pada model dan data pengamatan sangat tipis)

6. Simulasikan melalui model, untuk memperkirakan data curah hujan (dalam mm3)
pada minggu ke 16. Apa pendapat anda tentang data curah hujan di masa - masa
yang akan datang menurut model yang anda peroleh tersebut.
JAWAB :

x = 16







0
1000
2000
3000
4000
5000
6000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Grafik Data Pengamatan & Model
nilai Y pada model Nilai Y pada data pengamatan
Screenshoot program
Tampilan utama

Tampilan Input Data



Tampilan Olah Data









Diagram Pencar Data Pengamatan Ditampilkan Setelah Menekan Tombol
Grafik Pengamatan


Listing Program
a) grap.php
<?php
$x = $_POST['x'];
$y = $_POST['y'];
$y_model = $_POST['y_model'];
$n = count($x);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
<title>Hasil Pengamatan</title>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$('#container').highcharts({
title: {
text: 'Hasil Pengamatan',
x: -20 //center
},
subtitle: {
text: 'Waktu (x)',
x: -20
},
xAxis: {
categories: [
<?php for ($i=1; $i <= $n; $i++) {
echo "'".$i."',";
}
?>
]
},
yAxis: {
title: {
text: 'Curah Hujan dalam mm3 (y)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},

legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: [{
name: 'Data Pengamatan',
data: [
<?php
for ($i=0; $i < $n; $i++) {
echo $y[$i].",";
}
?>
]
}, {
name: 'Data Model',
data: [
<?php for ($i=0; $i < $n; $i++) {
echo $y_model[$i].",";
}
?>
]
}]
});
});


</script>
</head>
<body>
<script src="js/highcharts.js"></script>
<script src="js/modules/exporting.js"></script>

<div id="container" style="min-width: 310px; height: 400px; margin: 0
auto"></div>

</body>
</html>
b) hitung.php
<?php
$a = $_POST[l_a];
$b = $_POST[l_b];
$x = $_POST[x_baru];
$hitung = $a * pow($b, $x);
$hitung = round($hitung,5);
?>
<table>
<tr>
<td style="background-color:#00ffd2;" align="center">Jika Waktu
Pengamatan = <?php echo $x ?></td>
</tr>
<tr>
<td style="background-color:#00ffd2;" align="center"><i>Y =
(<?php echo $a ?>)(<?php echo $b ?>)<sup><?php echo $x
?></sup></i></td>
</tr>
<tr>
<td style="background-color:#00ffd2;" align="center"><i>Y =
<?php echo $hitung?></i></td>
</tr>
</table>
c) index.php
<html>
<head>
<title></title>
</head>
<link rel="stylesheet" type="text/css" href="style.css">
<body>
<div id="container">
<div id="header">

</div>
<div id="content">
<?php
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
if($_GET['menu']=='isi_data')
{
include "masukan_data.php";
}
elseif($_GET['menu']=='proses')
{
include "proses_data.php";
}
elseif($_GET['menu']=='grapik')
{
include "grap.php";
}
elseif($_GET['menu']=='hitung')
{
include "hitung.php";
}
else
{
include "isi_jml.php";
}

?>
</div>
</div>
</body>
</html>
d) isi_jml.php
<form action="index.php?menu=isi_data" method="post">
<label>Jumlah Data</label>
<input type="text" name="jml_data">
<button type="submit">Submit</button>
</form>
e) masukan_data.php
<form action="index.php?menu=proses" method="post">
<?php
$jml_data = $_POST[jml_data];
$no = 1;
?>
<table border="0">
<tr>
<td class="judul">Waktu Pengamatan</td>
<td class="judul">Curah Hujan Dalam mm<sup>3</sup></td>
</tr>
<tr>
<td>
<?php
for ($i=0; $i < $jml_data; $i++) {
?>
<p>
<label>x<sub><?php echo $no?></sub> :</label>
<input type="text" name="x[]" size="10" />
</p>

<?php
$no++;
}
?>
</td>
<td>
<?php
$no=1;
for ($i=0; $i < $jml_data; $i++) {
?>
<p>
<label>y<sub><?php echo $no?></sub> :</label>
<input type="text" name="y[]" size="10" />
</p>

<?php
$no++;
}
?>
</td>
</tr>
</table>
<button type="submit" class="tombol"
value="hitung">Hitung</button>
</form>
f) proses_data.php
<?php
if (isset($_POST['x'])) {
$x = $_POST['x'];
$y = $_POST['y'];


// mengubah x menjadi X^2
$x_2 = array();
$i = 0;
foreach ($x as $x => $value) {
$x_2[$i] = pow($value, 2);
$i++;
}

// mengubah y menjadi Log Y
$logY = array();
$i = 0;
foreach ($y as $y => $value) {
$logY[$i] = log10($value);
$logY[$i] = round($logY[$i],5);
$i++;
}

$n = count($x_2);

$i = 0;
$x = $_POST['x'];
$y = $_POST['y'];

for ($i=0; $i < $n ; $i++) {
$xlogY[$i] = $x[$i] * $logY[$i];
}

?>
<table style="width:600px" class="tabel">
<h2 class="judul">Menentukan Nilai Parameter a & b</h2>
<tr>
<th>Waktu pengamatan (x)</th>
<th>Curah hujan dalam mm3 (y)</th>
<th>log y</th>
<th>x^2</th>
<th>x log y</th>
</tr>
<?php
$i = 0;
for ($i=0; $i < $n; $i++) {
?>
<tr>
<td align="center"><?php echo $x[$i]?></td>
<td align="right"><?php echo $y[$i]?></td>
<td align="right"><?php echo $logY[$i]?></td>
<td align="right"><?php echo $x_2[$i]?></td>
<td align="right"><?php echo $xlogY[$i]?></td>
</tr>
<?php
}
?>
<tr style="background-color:#ffcc00;">
<td align="center"><b><?php echo array_sum($x)?></td>
<td align="right"><b><?php echo array_sum($y)?></td>
<td align="right"><b><?php echo array_sum($logY)?></td>
<td align="right"><b><?php echo array_sum($x_2)?></td>
<td align="right"><b><?php echo array_sum($xlogY)?></td>
</tr>
</table>
<?php
$jml_x = array_sum($x);
$jml_logy = array_sum($logY);
$jml_x_2 = array_sum($x_2);
$jml_xlogy = array_sum($xlogY);

$log_b = (($n*$jml_xlogy) - ($jml_x*$jml_logy))/(($n*$jml_x_2) -
pow($jml_x, 2));
$log_b = round($log_b,5);
//echo $log_b;

$log_a = ($jml_logy/$n) - ($log_b*($jml_x/$n));
$log_a = round($log_a,5);
//echo $log_a;

$t_log_b = round(pow(10, $log_b),5);
//echo $t_log_b;

$t_log_a = round(pow(10, $log_a),5);
//echo $t_log_a;
?>
<br>
<br>
<hr>
<table>
<tr>
<td rowspan="2"></td>
<td>Log b = </td>
<td style="border-bottom: 1px
solid;"><i>n(&sum;X<sub>i</sub>LogY<sub>i</sub>) -
(&sum;X<sub>i</sub>)(&sum;LogY<sub>i</sub>)</i></td>
</tr>
<tr>
<td></td>
<td align="center"><i>n&sum;X<sub>i</sub><sup>2</sup> -
(&sum;X<sub>i</sub>)<sup>2</sup></i></td>
</tr>
</table>
<br>
<br>
<table>
<tr>
<td rowspan="2"></td>
<td>Log b = </td>
<td style="border-bottom: 1px solid;"><i><?php echo
$n."(".$jml_xlogy.") - (".$jml_x.")(".$jml_logy.")" ?></td>
</tr>
<tr>
<td></td>
<td align="center"><i><?php echo $n."(".$jml_x_2.") -
(".$jml_x.")<sup>2<sup>" ?></i></td>
</tr>
</table>
<br>
<br>
<table>
<tr>
<td rowspan="2"></td>
<td style="background-color:#2aff00;">Log b = </td>
<td style="background-color:#2aff00;"><i><?php echo $log_b
?></td>
</tr>
</table>
<br>
<br>
<table>
<tr>
<td rowspan="2"></td>
<td>Log a = </td>
<td style="border-bottom: 1px
solid;"><i>(&sum;LogY<sub>i</sub>)-</i></td>
<td style="border-bottom: 1px solid;"><i>(Log b)</i></td>
<td style="border-bottom: 1px
solid;"><i>(&sum;X<sub>i</sub>)</i></td>
</tr>
<tr>
<td></td>
<td align="center"><i>(n)</i></td>
<td align="center"><i></i></td>
<td align="center"><i>(n)</i></td>
</tr>
</table>
<br>
<br>
<table>
<tr>
<td rowspan="2"></td>
<td>Log a = </td>
<td style="border-bottom: 1px solid;"><i>(<?php echo $jml_logy
?>)</i></td>
<td style="border-bottom: 1px solid;"><i> - (<?php echo $log_b
?>)</i></td>
<td style="border-bottom: 1px solid;"><i>(<?php echo $jml_x
?>)</i></td>
</tr>
<tr>
<td></td>
<td align="center"><i>(<?php echo $n ?></i>)</td>
<td align="center"><i></i></td>
<td align="center"><i>(<?php echo $n ?>)</i></td>
</tr>
</table>
<br>
<br>
<table>
<tr>
<td rowspan="2"></td>
<td style="background-color:#00ffd2;">Log a = </td>
<td style="background-color:#00ffd2;"><i><?php echo $log_a
?></td>
</tr>
</table>
<br>
<br>
<table>
<tr>
<td >Transformasi (Log b) ke (b) </td>
</tr>
<tr>
<td align="center"><i>Log b = <?php echo $log_b ?></td>
</tr>
<tr>
<td align="center"><i>b = 10<sup><?php echo $log_b
?></sup></td>
</tr>
<tr>
<td align="center"><i>b = <?php echo $t_log_b ?></td>
</tr>
</table>
<br>
<br>
<table>
<tr>
<td rowspan="2"></td>
<td style="background-color:#00ffd2;">Log a = </td>
<td style="background-color:#00ffd2;"><i><?php echo $log_a
?></td>
</tr>
</table>
<br>
<br>
<table>
<tr>
<td >Transformasi (Log a) ke (a) </td>
</tr>
<tr>
<td align="center"><i>Log a = <?php echo $log_a ?></td>
</tr>
<tr>
<td align="center"><i>a = 10<sup><?php echo $log_a
?></sup></td>
</tr>
<tr>
<td align="center"><i>a = <?php echo $t_log_a ?></td>
</tr>
</table>
<br>
<br>
<table>
<tr>
<td >Maka regresi model eksponen yang di peroleh</td>
</tr>
<tr>
<td align="center"><i>Y = a b <sup>x</sup></td>
</tr>
<tr>
<td align="center"><i>Y = (<?php echo $t_log_a ?>)(<?php
echo $t_log_b ?>)<sup>x</sup></sup></i></td>
</tr>
</table>
<hr>
<table style="width:600px" class="tabel">
<h2 class="judul">Validasi model dengan menghitung data
pengamatan melalui model tersebut</h2>
<tr>
<td>Waktu pengamatan (x)</td>
<td>Y Model</td>
<td>Y Hasil Pengamatan</td>
</tr>
<?php
$x = $_POST['x'];
$y = $_POST['y'];
$y_model = array();
$i=0;
foreach ($x as $xx => $value) {
$y_model[$i] = $t_log_a * pow($t_log_b, $value);
$y_model[$i] = round($y_model[$i],5);
$i++;
}
$i = 0;
for ($i=0; $i < $n; $i++) {
?>
<tr>
<td align="center"><?php echo $x[$i]?></td>
<td align="right"><?php echo $y_model[$i]?></td>
<td align="right"><?php echo $y[$i]?></td>
</tr>
<?php
}
?>
<form action="index.php?menu=grapik" method="post">
<?php
$i = 0;
for ($i=0; $i < $n; $i++) {
?>
<input type="hidden" name="x[]" value="<?php echo $x[$i]?>">
<input type="hidden" name="y[]" value="<?php echo $y[$i]?>">
<input type="hidden" name="y_model[]" value="<?php echo
$y_model[$i]?>">
<?php
}
$x_16 = $t_log_a * pow($t_log_b, 16);
$x_16 = round($x_16,5);
?>
<button value="grapik" type="submit">Grafik</button>
</form>
</table>
<br>
<br>
<table>
<tr>
<td style="background-color:#00ffd2;" align="center">Jika Waktu
Pengamatan = 16</td>
</tr>
<tr>
<td style="background-color:#00ffd2;" align="center"><i>Y =
(<?php echo $t_log_a ?>)(<?php echo $t_log_b
?>)<sup>16</sup></i></td>
</tr>
<tr>
<td style="background-color:#00ffd2;" align="center"><i>Y =
<?php echo $x_16?></i></td>
</tr>
</table>
<form action="index.php?menu=hitung" method="post">
<label>Masukan X</label>
<input type="text" name="x_baru">
<input type="hidden" name="l_a" value="<?php echo
$t_log_a?>">
<input type="hidden" name="l_b" value="<?php echo
$t_log_b?>">
<button type="submit">Hitung</button>
</form>
<?php
}
?>
g) style.css
body{
padding: 0px;
margin: 0px;
background-image: url(gambar/bg.png);
background-repeat: repeat;
}

label {
float: left;
text-align: right;
margin-right: 20px;
width: 50px;
}

sub{
font-size: 10px;
}

table{
margin: 0 auto;
}

td{

}

#container{
width: 80%;
height: auto;
margin: 50px auto;

}
#header{
width: 100%;
height: 200px;
background-image: url(gambar/baner.jpg);
margin: 0 auto;
overflow: hidden;
margin-bottom: 30px;
}

#content {
width: 100%;
height: auto;
background-color: white;
padding: 20px;
}

.tombol{
float: left;
margin-left: 20px;
}

.judul{
padding-bottom: 20px;
text-align: center;
}

.tabel {
margin:0px;padding:0px;
width:100%;
border:1px solid #000000;

-moz-border-radius-bottomleft:0px;
-webkit-border-bottom-left-radius:0px;
border-bottom-left-radius:0px;

-moz-border-radius-bottomright:0px;
-webkit-border-bottom-right-radius:0px;
border-bottom-right-radius:0px;

-moz-border-radius-topright:0px;
-webkit-border-top-right-radius:0px;
border-top-right-radius:0px;

-moz-border-radius-topleft:0px;
-webkit-border-top-left-radius:0px;
border-top-left-radius:0px;
margin: 0 auto;
}.tabel table{
border-collapse: collapse;
border-spacing: 0;
width:100%;
height:100%;
margin:0px;padding:0px;
}.tabel tr:last-child td:last-child {
-moz-border-radius-bottomright:0px;
-webkit-border-bottom-right-radius:0px;
border-bottom-right-radius:0px;
}
.tabel table tr:first-child td:first-child {
-moz-border-radius-topleft:0px;
-webkit-border-top-left-radius:0px;
border-top-left-radius:0px;
}
.tabel table tr:first-child td:last-child {
-moz-border-radius-topright:0px;
-webkit-border-top-right-radius:0px;
border-top-right-radius:0px;
}.tabel tr:last-child td:first-child{
-moz-border-radius-bottomleft:0px;
-webkit-border-bottom-left-radius:0px;
border-bottom-left-radius:0px;
}.tabel tr:hover td{

}
.tabel tr:nth-child(odd){ background-color:#ffffff; }
.tabel tr:nth-child(even) { background-color:#ffffff; }.tabel td{
vertical-align:middle;


border:1px solid #000000;
border-width:0px 1px 1px 0px;
padding:7px;
font-size:10px;
font-family:Arial;
font-weight:normal;
color:#000000;
}.tabel tr:last-child td{
border-width:0px 1px 0px 0px;
}.tabel tr td:last-child{
border-width:0px 0px 1px 0px;
}.tabel tr:last-child td:last-child{
border-width:0px 0px 0px 0px;
}
.tabel tr:first-child td{
background:-o-linear-gradient(bottom, #ff7f00 5%, #ff7f00
100%); background:-webkit-gradient( linear, left top, left bottom,
color-stop(0.05, #ff7f00), color-stop(1, #ff7f00) );
background:-moz-linear-gradient( center top, #ff7f00 5%, #ff7f00
100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#ff
7f00", endColorstr="#ff7f00"); background: -o-linear-
gradient(top,#ff7f00,ff7f00);

background-color:#ff7f00;
border:0px solid #000000;
text-align:center;
border-width:0px 0px 1px 1px;
font-size:14px;
font-family:Arial;
font-weight:bold;
color:#ffffff;
}
.tabel tr:first-child:hover td{
background:-o-linear-gradient(bottom, #ff7f00 5%, #ff7f00 100%);
background:-webkit-gradient( linear, left top, left bottom, color-
stop(0.05, #ff7f00), color-stop(1, #ff7f00) );
background:-moz-linear-gradient( center top, #ff7f00 5%, #ff7f00
100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#ff
7f00", endColorstr="#ff7f00"); background: -o-linear-
gradient(top,#ff7f00,ff7f00);

background-color:#ff7f00;
}
.tabel tr:first-child td:first-child{
border-width:0px 0px 1px 0px;
}
.tabel tr:first-child td:last-child{
border-width:0px 0px 1px 1px;
}

th{
background-color: #00b4ff;
}

You might also like