Mempelajari Jaringan Syaraf Tiruan

Apa itu Jaringan Syaraf Tiruan (JST)?

Jaringan Syaraf Tiruan (JST) merupakan salah satu teknik dalam Soft Computing yang bermaksud meniru mekanisme otak biologi. Otak biologi yang terdiri dari Neron dengan Axon dan Dendritnya ditiru oleh JST berupa pembobotan pada neuronnya. Bobot dapat berisi penguatan ataupun pelemahan dengan fungsi yang berbeda-beda seperti linear, sigmoid, tangen sigmoid, dan fungsi matematis lainnya. Untuk merubah bobot agar sesuai dengan yang diharapkan perlu dibuat mekanisme pembelajaran. Salah satu teknik pembelajaran yang terkenal adalah perambatan balik (backpropagation).

Matlab menyediakan toolbox yang lengkap untuk membuat sistem JST, baik berupa fungsi ataupun layanan GUI-nya. Untuk yang gemar mempelajari Algoritma, ada baiknya Anda membaca algoritma dari M-File yang ada pada Source Code Matlab. Karena beberapa dosen tidak menyukai Matlab untuk pembelajaran karena khawatir mahasiswanya tidak berfikir tentang Algoritma pemrograman dan cenderung tinggal pakai. Sebenarnya banyak situs-situs yang menyediakan source code dengan bahasa C++ untuk sistem JST (atau mungkin Java). Akan tetapi jika anda sudah familiar dengan algoritmanya, dan ingin membangun aplikasi dengan cepat dan berpenampilan visual yang menarik, tentu saja pilihan kita jatuh ke software yang mendukung untuk itu, salah satunya adalah Matlab.

Salah satu yang kerap mengganggu saya untuk membuat aplikasi berbasis JST adalah kendala pembelajaran (learning). JST sangat membutuhkan sumber daya RAM yang tinggi, kerap kali jika neuron terlalu banyak, Matlab terkadang memunculkan pesan Out of Memory. Salah satu contohnya adalah saat saya membuat klasifikasi dari grafik yang diumpan oleh software “Wireshark” dengan target klasifikasi ke dalam kategori jaringan normal, padat ataukah tidak normal (ada virus, DOS, dan sejenisnya). Matriks gambar ukuran 200 x 300 harus sanggup saya konversi menjadi berukuran kecil bervektor kolom 100, dan tetap saja meminta saya menaikan RAM 3 Gb, padahal laptop saya memiliki RAM 2 Gb dan terpaksa saya perkecil lagi resolusinya menjadi vektor kolom 20 saja. Tentu saja akurasinya akan berkurang. Oleh karena itu saat pembelajaran sebaiknya pinjam saja komputer setara server dengan RAM yang besar dan Prosesor terbaru.
052311_0426_seputarjari1

Aslinya gambar tersebut adalah grafik trafik jaringan dengan axis dan ordinat yang dibuang dengan fungsi “Imcrop” yang merupakan fungsi cropping suatu gambar untuk menghilangkan bagian lain yang diperlukan.

052311_0426_seputarjari2

Pengolahan citra bermaksud mengkonversi gambar menjadi matriks dan vektor yang kemudian akan diolah oleh JST untuk keperluan pembelajaran ataupun klasifikasi ke dalam kelas tertentu. Sehingga saat dijalankan akan menghasilkan pesan tertentu.

052311_0426_seputarjari3

By Michael Wong

How to randomize Algorithm Numbers???

RANDOM LETTERS AND NUMBERS ALGORITHM

The algorithm begins with inspiration in getting the serial number often we find everyday. Then we combine it with the calculation SHIFT cipher algorithm.

EXAMPLE ENCRYPTION
plaintext =
1.IEYASU TOKUGAWA
2.HANZO HATTORI
3. 28-07-1563
– Using a springboard 5-4-3-2-1

Image

Image

Using 5-4-3-2-1 our way towards stepping forward If there are variables in the end as ‘z’ skip 5, then z should be stepping back to the beginning of the variable. Then loncatan’Z-0-A-1-B-2 ‘and the result is a number ‘2’. Then begitupu n so on.

Image

The final result:

U C 10 5 0             S 7 22 0 10          C K Q V 21       C W F 1 Q
14 9 Q V 20          23 14 10 J P         S 2 22 14 21     0 V 22 13 Q
P C 22 16 9

By Michael Wong

Introduction to encryption with DES

DES, secret-key decryption

On 15 May 1973, the NBS (National Bureau of Standards, now called NISTNational Institute of Standards and Technology) published a request in the Federal Register for an encryption algorithm that would meet the following criteria:

  • have a high security level related to a small key used for encryption and decryption
  • be easily understood
  • not depend on the algorithm’s confidentiality
  • be adaptable and economical
  • be efficient and exportable

In late 1974, IBM proposed “Lucifer”, which, thanks to the NSA (National Security Agency), was modified on 23 November 1976 to become the DES (Data Encryption Standard). The DES was approved by the NBS in 1978. The DES was standardized by the ANSI (American National Standard Institute) under the name of ANSI X3.92, better known as DEA (Data Encryption Algorithm).

Principle of the DES

It is a symmetric encryption system that uses 64-bit blocks, 8 bits (one octet) of which are used for parity checks (to verify the key’s integrity). Each of the key’s parity bits (1 every 8 bits) is used to check one of the key’s octets by odd parity, that is, each of the parity bits is adjusted to have an odd number of ‘1’s in the octet it belongs to. The key therefore has a “useful” length of 56 bits, which means that only 56 bits are actually used in the algorithm.

The algorithm involves carrying out combinations, substitutions and permutations between the text to be encrypted and the key, while making sure the operations can be performed in both directions (for decryption). The combination of substitutions and permutations is called a product cipher.

The key is ciphered on 64 bits and made of 16 blocks of 4 bits, generally denoted k1 to k16. Given that “only” 56 bits are actually used for encrypting, there can be 256 (or 7.2*1016) different keys!

The DES algorithm

 

The main parts of the algorithm are as follows:

  • Fractioning of the text into 64-bit (8 octet) blocks;
  • Initial permutation of blocks;
  • Breakdown of the blocks into two parts: left and right, named L and R;
  • Permutation and substitution steps repeated 16 times (called rounds);
  • Re-joining of the left and right parts then inverse initial permutation.

DES algorithm

Initial permutation

 

Firstly, each bit of a block is subject to initial permutation, which can be represented by the following initial permutation (IP) table:

 

IP
58 50 42 34 26 18 10 2
60 52 44 36 28 20 12 4
62 54 46 38 30 22 14 6
64 56 48 40 32 24 16 8
57 49 41 33 25 17 9 1
59 51 43 35 27 19 11 3
61 53 45 37 29 21 13 5
63 55 47 39 31 23 15 7

 

This permutation table shows, when reading the table from left to right then from top to bottom, that the 58th bit of the 64-bit block is in first position, the 50th in second position and so forth.

Division into 32-bit blocks

 

Once the initial permutation is completed, the 64-bit block is divided into two 32-bit blocks, respectively denoted L and R (for left and right). The initial status of these two blocks is denoted L0 and R0:

 

L0
58 50 42 34 26 18 10 2
60 52 44 36 28 20 12 4
62 54 46 38 30 22 14 6
64 56 48 40 32 24 16 8

 

 

R0
57 49 41 33 25 17 9 1
59 51 43 35 27 19 11 3
61 53 45 37 29 21 13 5
63 55 47 39 31 23 15 7

 

It is interesting to note that L0 contains all bits having an even position in the initial message, whereas R0 contains bits with an odd position.

Rounds

 

The Ln and Rn blocks are subject to a set of repeated transformations called rounds, shown in this diagram, and the details of which are given below:

rounds

Expansion function

 

The 32 bits of the R0 block are expanded to 48 bits thanks to a table called an expansion table (denoted E), in which the 48 bits are mixed together and 16 of them are duplicated:

 

E
32 1 2 3 4 5
4 5 6 7 8 9
8 9 10 11 12 13
12 13 14 15 16 17
16 17 18 19 20 21
20 21 22 23 24 25
24 25 26 27 28 29
28 29 30 31 32 1

 

As such, the last bit of R0 (that is, the 7th bit of the original block) becomes the first, the first becomes the second, etc.
In addition, the bits 1,4,5,8,9,12,13,16,17,20,21,24,25,28 and 29 of R0 (respectively 57, 33, 25, l, 59, 35, 27, 3, 6l, 37, 29, 5, 63, 39, 31 and 7 of the original block) are duplicated and scattered in the table.

exclusive OR with the key

 

The resulting 48-bit table is called R’0 or E[R0]. The DES algorithm then exclusive ORs the first key K1 with E[R0]. The result of this exclusive OR is a 48-bit table we will call R0 out of convenience (it is not the starting R0!).

Substitution function

 

R0 is then divided into 8 6-bit blocks, denoted R0i. Each of these blocks is processed by selection functions (sometimes called substitution boxes or compression functions), generally denoted Si.
The first and last bits of each R0i determine (in binary value) the line of the selection function; the other bits (respectively 2, 3, 4 and 5) determine the column. As the selection of the line is based on two bits, there are 4 possibilities (0,1,2,3). As the selection of the column is based on 4 bits, there are 16 possibilities (0 to 15). Thanks to this information, the selection function “selects” a ciphered value of 4 bits.

Here is the first substitution function, represented by a 4-by-16 table:

 

S1
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7
1 0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8
2 4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0
3 15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13

 

Let R01 equal 101110. The first and last bits give 10, that is, 2 in binary value. The bits 2,3,4 and 5 give 0111, or 7 in binary value. The result of the selection function is therefore the value located on line no. 2, in column no. 7. It is the value 11, or 111 binary.

Each of the 8 6-bit blocks is passed through the corresponding selection function, which gives an output of 8 values with 4 bits each. Here are the other selection functions:

 

S2
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 15 1 8 14 6 11 3 4 9 7 2 13 12 0 5 10
1 3 13 4 7 15 2 8 14 12 0 1 10 6 9 11 5
2 0 14 7 11 10 4 13 1 5 8 12 6 9 3 2 15
3 13 8 10 1 3 15 4 2 11 6 7 12 0 5 14 9

 

 

S3
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 10 0 9 14 6 3 15 5 1 13 12 7 11 4 2 8
1 13 7 0 9 3 4 6 10 2 8 5 14 12 11 15 1
2 13 6 4 9 8 15 3 0 11 1 2 12 5 10 14 7
3 1 10 13 0 6 9 8 7 4 15 14 3 11 5 2 12

 

 

S4
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 7 13 14 3 0 6 9 10 1 2 8 5 11 12 4 15
1 13 8 11 5 6 15 0 3 4 7 2 12 1 10 14 9
2 10 6 9 0 12 11 7 13 15 1 3 14 5 2 8 4
3 3 15 0 6 10 1 13 8 9 4 5 11 12 7 2 14

 

 

S5
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 2 12 4 1 7 10 11 6 8 5 3 15 13 0 14 9
1 14 11 2 12 4 7 13 1 5 0 15 10 3 9 8 6
2 4 2 1 11 10 13 7 8 15 9 12 5 6 3 0 14
3 11 8 12 7 1 14 2 13 6 15 0 9 10 4 5 3

 

 

S6
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 12 1 10 15 9 2 6 8 0 13 3 4 14 7 5 11
1 10 15 4 2 7 12 9 5 6 1 13 14 0 11 3 8
2 9 14 15 5 2 8 12 3 7 0 4 10 1 13 11 6
3 4 3 2 12 9 5 15 10 11 14 1 7 6 0 8 13

 

 

S7
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 4 11 2 14 15 0 8 13 3 12 9 7 5 10 6 1
1 13 0 11 7 4 9 1 10 14 3 5 12 2 15 8 6
2 1 4 11 13 12 3 7 14 10 15 6 8 0 5 9 2
3 6 11 13 8 1 4 10 7 9 5 0 15 14 2 3 12

 

 

S8
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 13 2 8 4 6 15 11 1 10 9 3 14 5 0 12 7
1 1 15 13 8 10 3 7 4 12 5 6 11 0 14 9 2
1 7 11 4 1 9 12 14 2 0 6 10 13 15 3 5 8
1 2 1 14 7 4 10 8 13 15 12 9 0 3 5 6 11

 

Each 6-bit block is therefore substituted in a 4-bit block. These bits are combined to form a 32-bit block.

Permutation

 

The obtained 32-bit block is then subject to a permutation P here is the table:

 

P
16 7 20 21 29 12 28 17
1 15 23 26 5 18 31 10
2 8 24 14 32 27 3 9
19 13 30 6 22 11 4 25

Exclusive OR

 

All of these results output from P are subject to an Exclusive OR with the starting L0 (as shown on the first diagram) to give R1, whereas the initial R0 gives L1.

Iteration

 

All of the previous steps (rounds) are repeated 16 times.

Inverse initial permutation

 

At the end of the iterations, the two blocks L16 and R16 are re-joined, then subject to inverse initial permutation:

 

IP-1
40 8 48 16 56 24 64 32
39 7 47 15 55 23 63 31
38 6 46 14 54 22 62 30
37 5 45 13 53 21 61 29
36 4 44 12 52 20 60 28
35 3 43 11 51 19 59 27
34 2 42 10 50 18 58 26
33 1 41 9 49 17 57 25

 

The output result is a 64-bit ciphertext!

Generation of keys

 

Given that the DES algorithm presented above is public, security is based on the complexity of encryption keys.

The algorithm below shows how to obtain, from a 64-bit key (made of any 64 alphanumeric characters), 8 different 48-bit keys each used in the DES algorithm:

DES key generation algorithm

Firstly, the key’s parity bits are eliminated so as to obtain a key with a useful length of 56 bits.

The first step is a permutation denoted PC-1 whose table is presented below:

 

PC-1
57 49 41 33 25 17 9 1 58 50 42 34 26 18
10 2 59 51 43 35 27 19 11 3 60 52 44 36
63 55 47 39 31 23 15 7 62 54 46 38 30 22
14 6 61 53 45 37 29 21 13 5 28 20 12 4

 

This table may be written in the form of two tables Li and Ri (for left and right) each made of 28 bits:

 

Li
57 49 41 33 25 17 9
1 58 50 42 34 26 18
10 2 59 51 43 35 27
19 11 3 60 52 44 36

 

 

Ri
63 55 47 39 31 23 15
7 62 54 46 38 30 22
14 6 61 53 45 37 29
21 13 5 28 20 12 4

 

The result of this first permutation is denoted L0 and R0.

These two blocks are then rotated to the left, such that the bits in second position take the first position, those in third position take the second, etc.
The bits in first position move to last position.

The 2 28-bit blocks are then grouped into one 56-bit block. This passes through a permutation, denoted PC-2, giving a 48-bit block as output, representing the key Ki.

PC-2
14 17 11 24 1 5 3 28 15 6 21 10
23 19 12 4 26 8 16 7 27 20 13 2
41 52 31 37 47 55 30 40 51 45 33 48
44 49 39 56 34 53 46 42 50 36 29 32

 

Repeating the algorithm makes it possible to give the 16 keys K1 to K16 used in the DES algorithm.

LS
1 2 4 6 8 10 12 14 15 17 19 21 23 25 27 28

TDES, an alternative to the DES

 

In 1990, Eli Biham and Adi Shamir developed differential cryptanalysis, which searches for plaintext pairs and ciphertext pairs. This method works with up to 15 rounds, while 16 rounds are present in the algorithm presented above.

Moreover, while a 56-bit key gives an enormous amount of possibilities, many processors can compute more than 106 keys per second; as a result, when they are used at the same time on a very large number of machines, it is possible for a large body (a State for example) to find the right key…

A short-term solution involves catenating three DES encryptions using two 56-bit keys (which equals one 112-bit key). This process is called Triple DES, denoted TDES (sometimes 3DES or 3-DES).

Triple DES - 3DES

TDES is much more secure than DES, but it has the major disadvantage of also requiring more resources for encryption and decryption.

Several types of triple DES encryption are generally recognized:

  • DES-EEE3: 3 DES encryptions with 3 different keys;
  • DES-EDE3: a different key for each of the 3 DES operations (encryption, decryption, encryption);
  • DES-EEE2 and DES-EDE2: a different key for the second operation (decryption).

 

In 1997, NIST launched a new call for projects to develop the AES (Advanced Encryption Standard), an encryption algorithm intended to replace the DES.

The DES encryption system was updated every 5 years. In 2000, during the most recent revision, after an evaluation process that lasted for 3 years, the algorithm that was jointly designed by two Belgian candiates, Sirs Vincent Rijmen and Joan Daemen was chosen as the new standard by NIST. This new algorithm, named RIJNDAEL by its inventors, will replace the DES from now on.

Initial permutation

Firstly, each bit of a block is subject to initial permutation, which can be represented by the following initial permutation (IP) table:

 

IP
58 50 42 34 26 18 10 2
60 52 44 36 28 20 12 4
62 54 46 38 30 22 14 6
64 56 48 40 32 24 16 8
57 49 41 33 25 17 9 1
59 51 43 35 27 19 11 3
61 53 45 37 29 21 13 5
63 55 47 39 31 23 15 7

This permutation table shows, when reading the table from left to right then from top to bottom, that the 58th bit of the 64-bit block is in first position, the 50th in second position and so forth.

Division into 32-bit blocks

Once the initial permutation is completed, the 64-bit block is divided into two 32-bit blocks, respectively denoted L and R (for left and right). The initial status of these two blocks is denoted L0 and R0:

 

L0
58 50 42 34 26 18 10 2
60 52 44 36 28 20 12 4
62 54 46 38 30 22 14 6
64 56 48 40 32 24 16 8

 

R0
57 49 41 33 25 17 9 1
59 51 43 35 27 19 11 3
61 53 45 37 29 21 13 5
63 55 47 39 31 23 15 7

It is interesting to note that L0 contains all bits having an even position in the initial message, whereas R0 contains bits with an odd position.

Rounds

The Ln and Rn blocks are subject to a set of repeated transformations called rounds, shown in this diagram, and the details of which are given below:

rounds

Expansion function

The 32 bits of the R0 block are expanded to 48 bits thanks to a table called an expansion table (denoted E), in which the 48 bits are mixed together and 16 of them are duplicated:

 

E
32 1 2 3 4 5
4 5 6 7 8 9
8 9 10 11 12 13
12 13 14 15 16 17
16 17 18 19 20 21
20 21 22 23 24 25
24 25 26 27 28 29
28 29 30 31 32 1

As such, the last bit of R0 (that is, the 7th bit of the original block) becomes the first, the first becomes the second, etc.
In addition, the bits 1,4,5,8,9,12,13,16,17,20,21,24,25,28 and 29 of R0 (respectively 57, 33, 25, l, 59, 35, 27, 3, 6l, 37, 29, 5, 63, 39, 31 and 7 of the original block) are duplicated and scattered in the table.

exclusive OR with the key

The resulting 48-bit table is called R’0 or E[R0]. The DES algorithm then exclusive ORs the first key K1 with E[R0]. The result of this exclusive OR is a 48-bit table we will call R0 out of convenience (it is not the starting R0!).

Substitution function

R0 is then divided into 8 6-bit blocks, denoted R0i. Each of these blocks is processed by selection functions (sometimes called substitution boxes or compression functions), generally denoted Si.
The first and last bits of each R0i determine (in binary value) the line of the selection function; the other bits (respectively 2, 3, 4 and 5) determine the column. As the selection of the line is based on two bits, there are 4 possibilities (0,1,2,3). As the selection of the column is based on 4 bits, there are 16 possibilities (0 to 15). Thanks to this information, the selection function “selects” a ciphered value of 4 bits.

Here is the first substitution function, represented by a 4-by-16 table:

 

S1
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7
1 0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8
2 4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0
3 15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13

Let R01 equal 101110. The first and last bits give 10, that is, 2 in binary value. The bits 2,3,4 and 5 give 0111, or 7 in binary value. The result of the selection function is therefore the value located on line no. 2, in column no. 7. It is the value 11, or 111 binary.

Each of the 8 6-bit blocks is passed through the corresponding selection function, which gives an output of 8 values with 4 bits each. Here are the other selection functions:

S2
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 15 1 8 14 6 11 3 4 9 7 2 13 12 0 5 10
1 3 13 4 7 15 2 8 14 12 0 1 10 6 9 11 5
2 0 14 7 11 10 4 13 1 5 8 12 6 9 3 2 15
3 13 8 10 1 3 15 4 2 11 6 7 12 0 5 14 9
S3
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 10 0 9 14 6 3 15 5 1 13 12 7 11 4 2 8
1 13 7 0 9 3 4 6 10 2 8 5 14 12 11 15 1
2 13 6 4 9 8 15 3 0 11 1 2 12 5 10 14 7
3 1 10 13 0 6 9 8 7 4 15 14 3 11 5 2 12
S4
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 7 13 14 3 0 6 9 10 1 2 8 5 11 12 4 15
1 13 8 11 5 6 15 0 3 4 7 2 12 1 10 14 9
2 10 6 9 0 12 11 7 13 15 1 3 14 5 2 8 4
3 3 15 0 6 10 1 13 8 9 4 5 11 12 7 2 14
S5
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 2 12 4 1 7 10 11 6 8 5 3 15 13 0 14 9
1 14 11 2 12 4 7 13 1 5 0 15 10 3 9 8 6
2 4 2 1 11 10 13 7 8 15 9 12 5 6 3 0 14
3 11 8 12 7 1 14 2 13 6 15 0 9 10 4 5 3
S6
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 12 1 10 15 9 2 6 8 0 13 3 4 14 7 5 11
1 10 15 4 2 7 12 9 5 6 1 13 14 0 11 3 8
2 9 14 15 5 2 8 12 3 7 0 4 10 1 13 11 6
3 4 3 2 12 9 5 15 10 11 14 1 7 6 0 8 13
S7
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 4 11 2 14 15 0 8 13 3 12 9 7 5 10 6 1
1 13 0 11 7 4 9 1 10 14 3 5 12 2 15 8 6
2 1 4 11 13 12 3 7 14 10 15 6 8 0 5 9 2
3 6 11 13 8 1 4 10 7 9 5 0 15 14 2 3 12
S8
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 13 2 8 4 6 15 11 1 10 9 3 14 5 0 12 7
1 1 15 13 8 10 3 7 4 12 5 6 11 0 14 9 2
1 7 11 4 1 9 12 14 2 0 6 10 13 15 3 5 8
1 2 1 14 7 4 10 8 13 15 12 9 0 3 5 6 11

Each 6-bit block is therefore substituted in a 4-bit block. These bits are combined to form a 32-bit block.

Permutation

The obtained 32-bit block is then subject to a permutation P here is the table:

 

P
16 7 20 21 29 12 28 17
1 15 23 26 5 18 31 10
2 8 24 14 32 27 3 9
19 13 30 6 22 11 4 25

Exclusive OR

All of these results output from P are subject to an Exclusive OR with the starting L0 (as shown on the first diagram) to give R1, whereas the initial R0 gives L1.

Iteration

All of the previous steps (rounds) are repeated 16 times.

Inverse initial permutation

At the end of the iterations, the two blocks L16 and R16 are re-joined, then subject to inverse initial permutation:

 

IP-1
40 8 48 16 56 24 64 32
39 7 47 15 55 23 63 31
38 6 46 14 54 22 62 30
37 5 45 13 53 21 61 29
36 4 44 12 52 20 60 28
35 3 43 11 51 19 59 27
34 2 42 10 50 18 58 26
33 1 41 9 49 17 57 25

The output result is a 64-bit ciphertext!

Generation of keys

Given that the DES algorithm presented above is public, security is based on the complexity of encryption keys.

The algorithm below shows how to obtain, from a 64-bit key (made of any 64 alphanumeric characters), 8 different 48-bit keys each used in the DES algorithm:

DES key generation algorithm

Firstly, the key’s parity bits are eliminated so as to obtain a key with a useful length of 56 bits.

The first step is a permutation denoted PC-1 whose table is presented below:

 

PC-1
57 49 41 33 25 17 9 1 58 50 42 34 26 18
10 2 59 51 43 35 27 19 11 3 60 52 44 36
63 55 47 39 31 23 15 7 62 54 46 38 30 22
14 6 61 53 45 37 29 21 13 5 28 20 12 4

This table may be written in the form of two tables Li and Ri (for left and right) each made of 28 bits:

 

Li
57 49 41 33 25 17 9
1 58 50 42 34 26 18
10 2 59 51 43 35 27
19 11 3 60 52 44 36

 

Ri
63 55 47 39 31 23 15
7 62 54 46 38 30 22
14 6 61 53 45 37 29
21 13 5 28 20 12 4

The result of this first permutation is denoted L0 and R0.

These two blocks are then rotated to the left, such that the bits in second position take the first position, those in third position take the second, etc.
The bits in first position move to last position.

The 2 28-bit blocks are then grouped into one 56-bit block. This passes through a permutation, denoted PC-2, giving a 48-bit block as output, representing the key Ki.

PC-2
14 17 11 24 1 5 3 28 15 6 21 10
23 19 12 4 26 8 16 7 27 20 13 2
41 52 31 37 47 55 30 40 51 45 33 48
44 49 39 56 34 53 46 42 50 36 29 32

Repeating the algorithm makes it possible to give the 16 keys K1 to K16 used in the DES algorithm.

LS
1 2 4 6 8 10 12 14 15 17 19 21 23 25 27 28

TDES, an alternative to the DES

In 1990, Eli Biham and Adi Shamir developed differential cryptanalysis, which searches for plaintext pairs and ciphertext pairs. This method works with up to 15 rounds, while 16 rounds are present in the algorithm presented above.

Moreover, while a 56-bit key gives an enormous amount of possibilities, many processors can compute more than 106 keys per second; as a result, when they are used at the same time on a very large number of machines, it is possible for a large body (a State for example) to find the right key…

A short-term solution involves catenating three DES encryptions using two 56-bit keys (which equals one 112-bit key). This process is called Triple DES, denoted TDES (sometimes 3DES or 3-DES).

Triple DES - 3DES

TDES is much more secure than DES, but it has the major disadvantage of also requiring more resources for encryption and decryption.

Several types of triple DES encryption are generally recognized:

  • DES-EEE3: 3 DES encryptions with 3 different keys;
  • DES-EDE3: a different key for each of the 3 DES operations (encryption, decryption, encryption);
  • DES-EEE2 and DES-EDE2: a different key for the second operation (decryption).

In 1997, NIST launched a new call for projects to develop the AES (Advanced Encryption Standard), an encryption algorithm intended to replace the DES.

The DES encryption system was updated every 5 years. In 2000, during the most recent revision, after an evaluation process that lasted for 3 years, the algorithm that was jointly designed by two Belgian candiates, Sirs Vincent Rijmen and Joan Daemen was chosen as the new standard by NIST. This new algorithm, named RIJNDAEL by its inventors, will replace the DES from now on.

By Michael Wong

Model of Conventional Cryptosystem

Figure : Model of Conventional Cryptosystem

Model of Conventional Cryptosystem

What is Cryptanalysis ?
Cryptanalysis
• Process of attempting to discover X or K or both
• Various types of cryptanalytic attacks

Cryptosystem

Cryptanalysis is the study of taking encrypted data, and trying to unencrypt it without use of the key. The other side of cryptography, it is used to break codes by finding weaknesses within them. In addition to being used by hackers with bad intentions, this discipline is also often used by the military. It is also appropriately used by designers of encryption systems to find, and subsequently correct, any weaknesses that may exist in the system under design.

There are several types of attacks that a cryptanalyst may use to break a code, depending on how much information he or she has. A ciphertext-only attack is one where the analyst has a piece of ciphertext (text that has already been encrypted), with no plaintext (unencrypted text). This is probably the most difficult type of cryptanalysis, and calls for a bit of guesswork. In a known-plaintext attack, the analyst has both a piece of ciphertext and the corresponding piece of plaintext.

Other types of attacks may involve trying to derive a key through trickery or theft, such as in the “man-in-the-middle” attack. In this method, the cryptanalyst places a piece of surveillance software in between two parties that communicate. When the parties’ keys are exchanged for secure communication, they exchange their keys with the attacker instead of each other.

The ultimate goal of the cryptanalyst is to derive the key so that all ciphertext can be easily deciphered. A brute-force attack is one way of doing so. In this type of attack, the cryptanalyst tries every possible combination until the correct key is identified. Although using longer keys make the derivation less statistically likely to be successful, faster computers continue to make brute-force attacks feasible. Networking a set of computers together in a grid combines their strength, and their cumulative power can be used to break long keys. The longest keys used, 128-bit keys, remain the strongest, and less likely to be subject to this type of attack.

At its core, cryptanalysis is a science of mathematics, probability, and fast computers. Cryptanalysts also usually require some persistence, intuition, guesswork and some general knowledge of the target. The field also has an interesting historical element; the famous Enigma machine, used by the Germans to send secret messages, was ultimately cracked by members of the Polish resistance and transferred to the British.

What is Encryption algorithm And Decryption algorithm ?

Encryption algorithm

A key string is written parallel along with the plaintext. If the end of the key is reached, the key string is continued by repeating the key. This is continued toll the last plaintext character is reached. If you encounter a non-uppercase plaintext character, do not use the character from the key string, just skip that plaintext character and proceed to the next plaintext character. In other words, the non-uppercase plaintext character appears as it is in the ciphertext too. Let Pt and Kt be the uppercase characters in the plaintext and key-string respectively. Using the ASCII values of the characters Pt and Kt and the integer Vignere table to find the row index I that is mapped to the ASCII value of character Pt and the column index j that is mapped to the ASCII value of character Kt. Then the ciphertext character Ct would be simply the character whose ASCII value is mapped to integer entry in the cell [i, j].

Decryption algorithm

A key string is written parallel along with the ciphertext. If the end of the key is reached, the key string is continued by repeating the key. This is continued toll the last ciphertext character is reached. If you encounter a non-uppercase ciphertext character, do not use the character from the key string, just skip that ciphertext character and proceed to the next ciphertext character. In other words, the nonuppercase ciphertext character appears as it is in the plaintext too. Let Ct and Kt be the uppercase ciphertext character and the uppercase character part of the key-string respectively. Use the integer Vignere table to find the row index i that is mapped to the ASCII value of character Kt. In this row, find the cell that has the integer mapped to the ASCII value of character Ct. If such a cell is [i, j], the plaintext character Pt is the uppercase character whose ASCII value is mapped to the column index j

What is a Secure Channel ?

secure channel

• A stream with these security requirements:
– Authentication
• Ensures sender and receiver are who they claim to be
– Confidentiality
• Ensures that data is read only by authorized users
– Data integrity
• Ensures that data is not changed from source to destination
– Non-repudiation (not discussed today)
• Ensures that sender can’t deny message and rcvr can’t deny msg
Creating Secure Channels
• Authentication and Data Integrity
– Use Public Key Infrastructure or third-party server to authenticate each end to the other
– Add Message Authentication Code for integrity
• Confidentiality
– Exchange session key for encrypt/decrypt ops
• Bulk data transfer
• Key Distribution and Segmentation
Symmetric Key-based Secure Channel
• Sender (A) and receiver (B) share secret keys
– One key for A è B confidentiality
– One for A è B authentication/integrity
– Each message sent from A è B contains:
• Ciphertext = E_KABencrypt(nonce + msg)
• Authenticity/Integrity check = MAC_KABauth(Ciphertext)
• Different keys for each direction = 4 keys
– KABencrypt, KABauth, KBAencrypt, KBAauth.

By Michael Wong

Security Mechanisms with X 800 and RFC 2828

A security mechanism is a process (or a device incorporating such a process) that can be used
in a system to implement a security service that is provided by or within the system. Some
examples of security mechanisms are authentication exchange, checksums, digital signatures,
encryption and traffic padding (cf. p.153, RFC 2828). Security mechanisms are divided into
two groups: specific security mechanisms, which may be incorporated in a specific protocol
layer, and pervasive security mechanisms, which are not specific to any particular protocol
layer. The concepts below are taken from the X.800 Recommendations
• Specific security mechanisms
– Encipherment: encipherment can provide confidentiality of either data or traffic flow
information by converting the original information into a form that is not intelligible.
Encipherment algorithms may be reversible or irreversible. Two general classifications
of reversible encipherment algorithm are symmetric (i.e. secret key) and asymmetric (i.e.
public key).
– Digital signature: this mechanism attaches some special information to the transmitted
data, enabling the recipient to verify the source as well as the integrity of the data. The
term digital signature goes hand-in-hand with public key cryptography.
– Access control: this mechanism may use the authenticated identity of an entity, information
about the entity or capabilities of the entity to grant access rights to the
entity.
– Data integrity: two aspects of data integrity are: (i) the integrity of a single data unit or
field; (ii) the integrity of a stream of data units or fields. In general, different mechanisms
are used to provide these two types of integrity service, although provision of the second
without the first is not practical.
– Authentication exchange: peer entity authentication is assisted by means of information
exchange.
– Traffic padding mechanism: traffic padding mechanisms can be used to provide various
levels of protection against traffic analysis. Traffic padding is done by inserting bits into
gaps in data streams.
– Routing control: this mechanism allows a proper choice of routes for transferring information.
End systems may wish to instruct the network service provider to establish a
connection via a different route for a more secure communication.
– Notarization mechanism: this mechanism needs the involvement of a third party to
ensure certain properties of data exchange between the two entities.
• Pervasive security mechanisms
– Trusted functionality: may be used to extend the scope, or to establish the effectiveness,
of other security mechanisms. Any functionality which provides access to security
mechanisms should be trustworthy.
– Security labels: resources including data items may have security labels associated with
them, e.g. to indicate a sensitivity level. It is often necessary to convey the appropriate
security label with data in transit.
– Event detection: security-relevant event detection includes the detection of apparent
violations of security and may also include detection of ‘normal’ events– Security audit trails: provide a valuable security mechanism, as potentially they permit
detection and investigation of breaches of security by permitting a subsequent security
audit. A security audit is an independent review and examination of system records
and activities in order to test for adequacy of system controls, to ensure compliance
with established policy and operational procedures, to aid in damage assessment and to
recommend any indicated changes in controls, policy and procedures.
– Security recovery: security recovery deals with requests from mechanisms such as event
handling and management functions and takes recovery actions as the result of applying
a set of rules. These recovery actions may be of three kinds: immediate, temporary or
long term.

By Michael Wong

Security Services, According to RFC 2828

According to RFC 2828, a security service is a processing or communication service provided
by a system to protect system resources. Security services implement security policies and are
implemented by security mechanisms. Security services are divided into five categories:
• Authentication service: this security service verifies the identities claimed by or for an
entity (cf. p.16, RFC 2828). Authentication services are divided into two groups: data origin
authentication and peer entity authentication.
– Data origin authentication: this security service verifies the identity of a system entity
that is claimed to be the original source of received data (cf. p.53, RFC 2828). It does
not provide protection against duplication or modification of data units even though it is
sometimes thought to enable a recipient to verify that the data have not been tampered
with in transit.
– Peer entity authentication: this service provides corroboration between peer entities at
the connection establishment or during the transfer of information between them. This
service guarantees that an entity is not attempting to masquerade or to replay a previous
connection without authority (cf. p.8, Recommendation X.800).
• Access control: this service provides protection against unauthorized use of resources such
as computing resources, storage resources, communication links, etc. To use a resource, theuser should first be authenticated, after which they can be granted the right to use specific
system resources.
• Data confidentiality: this service protects data from unauthorized disclosure as the data
are transmitted from a source to a destination. Encryption and decryption are often used to
provide data confidentiality. Data confidentiality is divided into four groups:
– Connection confidentiality: this service provides confidentiality of user data on a
connection.
– Connectionless confidentiality: this service provides confidentiality of user data for
connectionless services, i.e. it protects individual data blocks.
– Selective field confidentiality: this service provides confidentiality of selected fields of
user data in a connection or in an individual data block.
– Traffic flow confidentiality: this service protects information which might be derived
from the observation of traffic flows. It serves to protect against traffic analysis.
• Data integrity: this service ensures that the data are received exactly as they were sent and
there has been no modification or replay of the data. Data integrity is classified into five
groups (cf. pp. 9–10, Recommendation X.800):
– Connection integrity with recovery: this service provides integrity for all user data on a
connection, detects any modifications, insertions, deletions or replays of any data within
an entire data sequence and attempts to recover the data if an attack is detected.
– Connection integrity without recovery: this service provides integrity for all user data on
a connection and detects any modifications, insertions, deletions or replays of any data
within an entire data sequence but does not attempt to recover the data when an attack is
detected.
– Selective field connection integrity: this service provides integrity for selected fields
within the user data transferred over a connection and takes the form of determination
of whether the selected fields have been modified, inserted, deleted or replayed.
– Connectionless integrity: this service provides integrity for individual data blocks and
may take the form of determination of whether a received data block has been modified.
Additionally, a limited form of detection of replay may be provided.
– Selective field connectionless integrity: this service provides integrity for selected fields
within individual data blocks and takes the form of determination of whether the selected
fields have been modified.
• Nonrepudiation: this service guarantees that an entity once involved in a communication
cannot later deny its involvement. This service may take one or both of two forms:
– Nonrepudiation with proof of origin: the recipient of the data is provided with proof
of the origin of the data. This will protect against any attempt by the sender to falsely
deny sending the data or their contents. A digital signature is an example of providing
nonrepudiation with proof of origin (cf. p.10, X.800).
– Nonrepudiation with proof of delivery: the sender of data is provided with proof of delivery
of the data. This will protect against any subsequent attempt by the recipient to
falsely deny receiving the data or their contents (cf. p.10, X.800).

By Michael Wong

Security Threats and Attacks, According to X.800?

According to X.800, ‘A threat to a system security includes any of the following: destruction
of information and/or other resources; corruption or modification of information; theft,
removal or loss of information and/or other resources; disclosure of information and interruption
of services’. Another, clearer definition comes from RFC 2828, which defines a threat
as ‘A potential violation of security exists when there is a circumstance, capability, action, or
event that could breach security and cause harm’. In other words, a threat is a possible danger
that might exploit vulnerability.

Threats can be classified as accidental or intentional and may be active or passive:
• Accidental vs. intentional threats – as their names imply, accidental threats exist with no
premeditated intent; for example, system malfunctions or software bugs. On the other hand,
intentional threats are planned actions for specific purposes.
• Passive vs. active threats – passive threats do not modify the information in or operations
of the victim systems; for example, wire tapping. Active threats, on the other hand, involve
modification of information in or operation of the victim systems; for example, changing
the firewall rules of a system to allow unauthorized access.
While a threat is a potential security problem that may lead to a security breach, it is not yet
an action. An attack, on the other hand, is an action to exploit a security breach. Attacks can
also be classified as insider or outsider attacks, and active or passive attacks:
• Insider vs. outsider attacks – insider attacks occur when legitimate users of a system behave
in unintended ways. Outsider attacks are initiated from outside the security perimeter by
illegitimate system users.
• Active vs. passive attacks – active attacks attempt to change system resources or affect their
operation. Examples of active attacks are masquerade, replay, modification of message and
denial of service. Passive attacks attempt to make use of information from the system without
changing system resources. Examples of passive attacks are message content disclosure
and traffic analysis.

By Michael Wong

Introduction to X 800 and RFC 2828

ITU-T Recommendation X.800 (Security Architecture for OSI) and IETF RFC 2828 (Internet
Security Glossary) are used as references to systematically evaluate and define security
requirements. Though coming from different standardization bodies, the two standards
have many points in common. X.800 is used to define general security-related architectural
elements needed when protection of communication between open systems is
required. X.800 establishes guidelines and constraints to improve existing recommendations
and/or to develop new recommendations in the context of OSI. Similarly, RFC 2828
provides abbreviations, explanations and recommendations for information system security
terminology.

Both X.800 and RFC 2828 are designed to assist security managers in defining security
requirements and possible approaches to meeting those requirements. They also
help hardware and software manufacturers to develop security features for their products
and services that follow certain standards. X.800 and RFC 2828 both mention
several aspects of security systems, namely security threat and attack, security services
and mechanisms and security management. This section gives a brief introduction to
these standards. We urge readers to read the original standard documents for more
information.

By Michael Wong

Membuat Kalkulator Sederhana dengan MATLAB

Kali ini saya akan memberikan tips, bagaimana membuat kalkulator sederhana dengan MATLAB. Pertama yang harus kamu siapkan untuk membuat kalkulator adalah antarmukanya. Di sini untuk membuat kalkulator sederhana, antarmukannya saya rancang dengan GUI MATLAB. Desain kalkulator sederhana kurang lebih seperti gambar berikut.

Tentunya desain membuat kalkulatornya tidak harus sama seperti di atas, sesuaikan dengan keinginan kamu.

Setelah desain dibuat, simpanlah desain tersebut dengan nama kalkulator.fig, dan secara otomatis MATLAB juga akan menciptakan file kalkulator.m yang berisi kode program dari kalkulator .fig tersebut. Agar latihan yang kita lakukan sama, maka kita beri nama pada masing-masing obyek. Mulai dari atas ke bawah:

Untuk menampilkan hasil digunakan Edit Text, beri nama txthasil.
Untuk angka 0 s.d 9 gunakan Push Button, untuk tombol angka 0 beri nama tb0, angka 1 beri nama tb1, dst. sampai angka 9 beri nama tb9.
Untuk tombol operator + beri nama tbplus, operator – beri nama tbmin, operator * beri nama tbkali, dan operator / beri nama tbbagi.
selanjutnya tombol CLEAR beri nama tbclear, dan tombol = beri nama tbenter.

Sekarang kita buat kode programnya. Caranya adalah klik kanan pada obyek yang akan diberi kode program, selanjutnya nanti akan keluar menu pop-up, lalu pilih View Callbacks > Callback.

Pada tombol angka, tuliskan kode seperti berikut: (contoh yang diberikan adalah kode untuk tombol angka 1)

global jj
textString = get(handles.txthasil,’String’);
if(strcmp(textString,’0.’)==1)&&(jj==0)
set(handles.txthasil,’String’,’1′) ;
else
textString =strcat(textString,’1′);
set(handles.txthasil,’String’,textString);
end
jj=0;

lakukan keseluruh tombol angka, dengan mengubah angka yang tercetak warna hijau dengan tombol angka yang bersesuaian dari 0 s.d. 9.

Kemudian kita lanjutkan ke tombol operator, berikut adalah kode program untuk tombol operator +.

textString = get(handles.txthasil,’String’);
textString =strcat(textString,’+’);
set(handles.txthasil,’String’,textString)

untuk membuat kode program pada tombol operator yang lain, sama seperti pada tombol operator +, tinggal menggantikan tanda “+” ( yang berwana hijau), dengan operator lain yang bersesuaian.

Lalu pada tombol “=” berikan kode berikut ini.

textString = get(handles.txthasil,’String’);
ans =eval(textString);
set(handles.txthasil,’String’,ans)

sedangkan untuk tombol CLEAR berikan kode berikut.

set(handles.txthasil,’String’,’0.’) ;

Sekarang coba kamu jalankan, kalkulator sederhanamu. Buat kamu yang mau menyempurnakan cara membuat kalkulator ini, bisa dishare di sini juga.

Source : manteptenan

By Michael Wong

PENGENALAN MATLAB PADA SISTEM KONTROL

Pengenalan MATLAB

Matlab adalah singkatan dari MATrix LABoratory, merupakan bahasa pemrograman yang dikembangkan oleh The Mathwork Inc. yang hadir dengan fungsi dan karakteristik yang berbeda dengan bahasa pemrograman lain yang sudah ada lebih dahulu seperti Delphi, Basic maupun C++. Matlab merupakan bahasa pemrograman level tinggi yang dikhususkan untuk kebutuhan komputasi teknis, visualisasi dan pemrograman seperti komputasi matematik, analisis data, pengembangan algoritma, simulasi dan pemodelan dan grafik-grafik perhitungan Pada awalnya Matlab dibuat untuk memberikan kemudahan mengakses data matrik pada proyek LINPACK dan EISPACK. Saat ini matlab memiliki ratusan fungsi yang dapat digunakan sebagai problem solver mulai dari simple sampai masalah-masalah yang kompleks dari berbagai disiplin ilmu.

Dalam lingkungan perguruan tinggi teknik, Matlab merupakan perangkat standar untuk memperkenalkan dan mengembangkan penyajian materi matematika, rekayasa dan kelimuan. Di industri, MATLAB merupakan perangkat pilihan untuk penelitian dengan produktifitas yang tinggi, pengembangan dan analisanya.

Kegunaan MatLab secara umum adalah sebagai berikut:

a) Matematika dan komputasi,

b) Perkembangan algoritma,

c) Pemodelan, simulasi, dan pembuatan prototype,

d) Analisa data, eksplorasi dan visualisasim

e) Pembuatan aplikasi, termasuk pembuatan antaramuka grafis.

Karakteristik MATLAB :

  • Bahasa pemrogramannya didasarkan pada matriks (baris dan kolom).
  • Lambat (dibandingkan dengan Fortran atau C) karena bahasanya langsung diartikan.
  • Automatic memory management, misalnya kita tidak harus mendeklarasikan arrays terlebih dahulu.
  • Tersusun rapi.
  • Waktu pengembangannya lebih cepat dibandingkan dengan Fortran atau C.
  • Dapat diubah ke bahasa C lewat MATLAB Compiler.
  • Tersedia banyak toolbox untuk aplikasi-aplikasi khusus.

Beberapa kelebihan Matlab jika dibandingkan dengan program lain seperti Fortran, dan Basic adalah :

  1. Mudah dalam memanipulasi struktur matriks dan perhitungan berbagai operasi matriks yang meliputi penjumlahan, pengurangan, perkalian, invers dan fungsi matriks lainnya.
  2. Menyediakan fasilitas untuk memplot struktur gambar (kekuatan fasilitas grafik tiga dimensi yang sangat memadai).
  3. Script program yang dapat diubah sesuai dengan keinginan user.
  4. Jumlah routine-routine powerful yang berlimpah yang terus berkembang.
  5. Kemampuan interface (misal dengan bahasa C, word dan mathematica).
  6. Dilengkapi dengan toolbox, simulink, stateflow dan sebagainya, serta mulai melimpahnya source code di internet yang dibuat dalam matlab( contoh toolbox misalnya : signal processing, control system, neural networks dan sebagainya).

Lingkungan Kerja MATLAB :

Secara umum lingkungan kerja Matlab terdiri dari tiga bagian yang penting yaitu:

1. Command Windows

Windows ini muncul pertama kali ketika kita menjalankan program Matlab. Command windows digunakan untuk menjalankan perintah-perintah Matlab, memanggil tool Matlab seperti editor, fasilitas help, model simulink, dan lain-lain. Ciri dari windows ini adalah adanya prompt (tanda lebih besar) yang menyatakan Matlab siap menerima perintah. Perintah tersebut dapat berupa fungsi-fungsi bawaan (toolbox) Matlab itu sendiri.

  • Workspace: Menampilkan semua variable yang pernah dibuat meliputi nama variable, ukuran, jumlah byte dan class.
  • Command History : Menampilkan perintah-perintah yang telah diketikkan pada command Window.

2. Editor Windows

Windows ini merupakan tool yang disediakan oleh Matlab yang berfungsi sebagai editor script Matlab (listing perintah-perintah yang harus dilakukan oleh Matlab). Ada dua cara untuk membuka editor ini, yaitu:

  1. Klik : File, lalu New dan kemudian M-File
  2. Ketik pada command windows : ”edit”

Secara formal suatu script merupakan suatu file eksternal yang berisi tulisan perintah MatLAb. Tetapi script tersebut bukan merupakan suatu fungsi. Ketika anda menjalankan suatu script, perintah di dalamnya dieksekusi seperti ketika dimasukkan langsung pada MatLAb melalui keyboard.

M-file selain dipakai sebagai penamaan file juga bisa dipakai untuk menamakan fungsi, sehingga fungsi fungsi yang kita buat di jendela editor bisa di simpan dengan ektensi .m sama dengan file yang kita panggi dijendela editor. Saat kita menggunakan fungsi Matlab seperti inv, abs, cos, sin dan sqrt, matlab menerima variabel berdasarkan variabel yang kita berikan. Fungsi M-file mirip dengan script file dimana keduanya merupakan file teks dengan ektensi .m . sebagaimana script M-file, fungsi m-file tidak dimasukkan dalam jendela command window tetapi file tersendiri yang dibuat dengan editor teks.

Membentuk dan menjalankan M-File:

  • Klik menu File, pilih New dan klik M-File
  • Pada editor teks, tulis argumen atau perintah
  • Simpan dengan cara klik File, pilih Save As dan beri nama dengan ekstensi .m
  • Pastikan file yang akan dijalankan berada pada direktori aktif
  • Misalkan file graf1.m berada di C:\MATLAB, maka lakukan perintah cd
  • >> cd c:\matlab
  • Kemudian jalankan file graf1.m dengan cara
  • >> graf1

3. Figure Windows

Windows ini merupakan hasil visualisasi dari script Matlab. Matlab memberikan kemudahan bagi programmer untuk mengedit windows ini sekaligus memberikan program khusus untuk itu, sehingga selain berfungsi sebagai visualisasi output yang berupa grafik juga sekaligus menjadi media input yang interaktif.

  • Simulink windows.

Windows ini umumnya digunakan untuk mensimulasikan system kendali berdasarkan blok diagram yang telah diketahui. Untuk mengoperasikannya ketik “simulink” pada command windows.

Karakter Spesial MatLab

  • Tanda % merupakan penanda komentar. Keterangan setelah tanda tersebut akan diabaikan dalam proses perhitungan. Contoh :

y = 2:2:8 % y = [2468];

y = 2.00 4.00 6.00 8.00

  • Tanda ; merupakan perintah pembatas yang tidak ditampilkan di jendela kerja, merupakan pemisah kolom dan baris dalam matriks. Contoh :

A = [1 3 5 ; 5 3 1];

  • Tanda : merupakan pembatas jangkauan, contohnya :

B = [0:2:8]

B = 0.00 2.00 4.00 6.00 8.00

  • Tanda ` merupakan transpose matriks yang merupakan suatu vector kolom

X = [3 2 4 5;7 6 5 8]

X= 3.00 2.00 4.00 5.00

7.00 6.00 5.00 8.00

X=X `

X= 3.00 7.00

2.00 6.00

4.00 5.00

5.00 8.00

  • Tanda … digunakan untuk menuliskan baris perintah yang panjang contohnya:

P = sin(1) – sin(2) + sin(3) – sin(4) + sin(5) + cos(6) + … cos(7) – cos(8) + cos(9) – cos(10) + cos(11) + cos(12)

P = 1.0273

Contoh dan fungsi kode yang dapat diketik pada command windows :

>> help ¿ : Menunjukkan semua help topic di Matlab.

>>what general ¿ : Menunjukkan instruksi-instruksi yang tersedia di

direktori general, salah satunya adalah instruksi clear.

>>help general ¿ : Menunjukkan instruksi-instruksi yang tersedia di

direktori general , dan fungsinya secara umum.

>>help clear ¿ : Menunjukkan penjelasan detail untuk instruksi clear.

(Fungsinya untuk apa, syntaxnya untuk apa, fungsi lain yang terkait apa)

>> help ops ¿ : Menunjukkan penulisan operator2 di dalam Matlab.

>>clc; ¿

>>x ¿

clc digunakan untuk membersihkan layar, tetapi nilai variable yang tersimpan dimemori tidak akan hilang sehingga dapat ditampilkan kembali ke layer dengan memanggil nama variabelnya.

>>clear; ¿

>>x ¿

clear digunakan untuk membersihkan layer sekaligus menghapus variable dari memori sehingga kita tidak dapat menampilkan nilai variable ke layer. (muncul pesan ??? Undefined function or variable ‘x’.)

>> x=4;

>> y=5;

>> z=x+y;

>> z

Merupakan contoh barisan instruksi untuk melakukan penjumlahan.

Angka dan Operasi Aritmatika

Ada tiga jenis angka di MATLAB yaitu :

  1. Bilangan bulat yaitu bilangan yang tidak mengandung desimal. Contohnya: >> xi = 10
  2. Bilangan real yaitu bilangan yang mengandung desimal contohnya :>> xr = 12.6054

    >> realmax % batas atas bilangan real di matlab

    ans = 1.7977e+308

    >> realmin % batas minimum bilangan real di matlab

    ans = 2.2251e-308

  3. Bilangan kompleks

>> i

ans = 0 + 1.0000i

>> x = 1 + sqrt(3)*i

x = 1.0000 + 1.7321i

>> A= [1 j;-j*5 2]

A= 1.0000 0 + 1.0000i

0 – 5.0000i 2.0000

Beberapa penggunaan operator aritmatika antara dua operand (A dan B) ditunjukkan pada tabel berikut ini :

Operasi Simbol
Penambahan +
Pengurangan
Perkalian *
Pembagian / atau \
perpangkatan ^

Variabel Pada Matlab

Matlab memiliki tiga variabel sebagai nonnumbers yaitu:

  1. –Inf (Negative Infinity)
  2. Inf (Infinity)
  3. Nan (Not an number)

Matlab hanya memiliki dua jenis tipe data yaitu Numeric dan String. Dalam matlab setiap variabel akan disimpan dalam bentuk matrik. User dapat langsung menuliskan variabel baru tanpa harus mendeklarasikannya terlebih dahulu pada command window. Contoh pembuatan variabel pada matlab:

Penamaan variabel pada matlab bersifat caseSensitif karena itu perlu diperhatikan penggunaan huruf besar dan kecil pada penamaan variabel. Apabila terdapat variabel lama dengan nama yang sama maka matlab secara otomatis akan me-replace variabel lama tersebut dengan variabel baru yang dibuat user.

Fungsi Pemrograman Dalam MATLAB

Fungsi Dasar

1. Fungsi Matematika Dasar

Tabel 1.1a Fungsi Matematika Dasar

Fungsi Keterangan
Abs Menghitung nilai absolut
Exp Memperoleh nilai dari e pangkat bilangan tertentu (e = 2.718282)
log Menghitung logaritma natural (ln) suatu bilangan
Sqrt Menghitung akar pangkat 2 dari suatu bilangan
Ceil Membulatkan bilangan ke bilangan bulat terdekat menuju plus tak berhingga.
Fix Membulatkan bilangan ke bilangan bulat terdekat menuju nol..
Floor Membulatkan bilangan ke bilangan bulat terdekat menuju minus tak berhingga.
Gcd Menghitung nilai faktor pembagi terbesar
Isprime Menghasilkan true jika merupakan bilangan prima.
Log10 Menghitung logaritma suatu bilangan untuk dasar 10.
Mod Menghitung nilai modulus.
Primes Menghasilkan daftar bilangan.
Rem Menghitung nilai remainder.
Round Membulatkan bilangan ke bilangan bulat terdekat.

2. Fungsi Trigonometri

Fungsi trigonometri banyak digunakan terkait dengan sudut. Nilai perhitungan yang dalam fungsi trigonometri sudut dalam radian.

Tabel 1.1b Fungsi Trigonometri

Fungsi Keterangan
Sin Menghitung sinus suatu bilangan, dimana bilangan dalam radian.
Cos Menghitung cosinus suatu bilangan, dimana bilangan dalam radian.
Tan Menghitung tangen suatu bilangan, dimana bilangan dalam radian.
Acos Menghitung arccosinus (invers cos) suatu bilangan yang menghasilkan sudut dalam radian, dimana bilangan harus antara -1 dan 1.
Asin Menghitung arcsinus suatu bilangan yang menghasilkan sudut dalam radian, dimana bilangan harus antara -1 dan 1.
Atan Menghitung arctangensuatu bilangan yang menghasilkan sudut dalam radian.
Cosh Menghitung cosinus hiperbolik dari suatu sudut dalam radian.
Sinh Menghitung sinus hiperbolik dari suatu sudut dalam radian.
Tanh Menghitung tangen hiperbolik dari suatu sudut dalam radian.
Cosd Menghitung cosinus suatu bilangan, dimana bilangan dalam derajat.
Sind Menghitung sinus suatu bilangan, dimana bilangan dalam derajat.
Tand Menghitung tangen suatu bilangan, dimana bilangan dalam derajat.
Sec Menghitung suatu bilangan, dimana bilangan dalam radian.
Csc Menghitung suatu bilangan, dimana bilangan dalam radian.
Cot Menghitung suatu bilangan, dimana bilangan dalam radian.

3. Fungsi Analisis Data

Matlab menyediakan sejumlah fungsi penting untuk digunakan dalam meng-analisis data, antara lain ditunjukkan pada Tabel 1.1c.

Tabel 1.1c Fungsi Analisis Data

Fungsi Keterangan
Max Menghasilkan nilai terbesar dari suatu vektor atau matriks
Min Menghasilkan nilai terbesar dari suatu vektor atau matriks
Mean Menghasilkan nilai mean
Dll …..

Vektor dan Matriks dalam Matlab

a. Vektor

Vektor baris :

>> v = [-2 sin(45) 4 6]

v =

-2.0000 0.8509 4.0000 6.0000

>> length(v) % menghitung panjang vektor

ans =

3

Vektor kolom :

>> x = [6; 5 ; 9]

x =

6

5

9

b. Matriks

Dapat diasumsikan bahwa didalam matlab setiap data akan disimpan dalam bentuk matriks. Dalam membuat suatu data matriks pada matlab, setiap isi data harus dimulai dari kurung siku ‘[‘ dan diakhiri dengan kurung siku tutup ‘]’. Untuk membuat variabel dengan data yang terdiri beberapa baris, gunakan tanda ‘titik koma’ (;) untuk memisahkan data tiap barisnya.

Matlab menyediakan beberapa fungsi yang dapat kita gunakan untuk menghasilkan bentuk-bentuk matriks yang diinginkan. Fungsi-fungsi tersebut antara lain:

  • zeros : untuk membuat matriks yang semua datanya bernilai 0
  • ones : matriks yang semua datanya bernilai 1
  • rand : matriks dengan data random dengan menggunakan distribusi uniform
  • randn : matris dengan data random dengan menggunakan distribusi normal
  • eye : untuk menghasilkan matriks identitas

Cara Menginputkan Matrik.

Contoh :

Matrik A=

Ada 4 cara untuk menginputkan matrik yakni :

Cara 1:

>>a=[1 2 3;4 5 6;7 8 9]

Cara 2 :

>>a=[1 2 3 enter

  1. 5 6 enter
  2. 8 9];

Cara 3:

>>a1=[1 2 3];

>>a2=[4 5 6];

>>a3=[7 8 9];

>>a=[a1;a2;a3;];

>>a

Cara 4 :

>>a=input(‘Masukkan matrik= ‘);

>>Masukkan matrik=[1 2 3;4 5 6;7 8 9]

>>disp(a)

Operasi dan Fungsi pada Matriks

  • Tabel 1.2. Operasi dan fungsi pada matriks yang sering digunakan :
Perintah Keterangan Contoh
Det Menghasilkan determinan matriks Det(A)
Size Menghasilkan ukura matriks Size(A)
+ Menjumlahkan matriks C = A + B
* Mengalikan matriks C = A * B
.* Mengalikan elemen dengan elemen, dengan ketentuan memiliki ukuran yang sama C = A .* B
^ Memangkatkan matriks dengan suatu skalar C = A^ k
.^ Memangkatkan elemen per elemen matriks dengan skalar C = A .^ k
Transpose matriks A’
./ Membagi elemen per elemen dengan ketentuan memiliki ukuran yang sama C = A ./ B
\ Menghasilkan solusi AX = B C = A \ B
/ Menghasilkan solusi XA = B C = A / B
Inv Menghasilkan invers matriks dengan ketentuan matriks merupakan matriks bujur sangkar C = Inv(A)

Grafik Matlab

Grafik 2 Dimensi

  • Command Plot

>> Plot (X,Y,’ro’)

>> Plot (Nilai fungsi,fungsi,’warna_garis/data_point’)

  • Colors : b(blue), r(red), g(green), y(yellow), m(magenta),

c(cyan), k(black)

  • Markers : (o),(x),(*),(.),(+),(d),(s),(p),(h)
  • Line Style : (-),(:),(-.),(- -),

Contoh 1 :

>>n = 25

>>t = 0 : 1/n : 10

>>y = sin(t);

>>plot (t,y,’ro’)

>>title (‘Grafik Y = Sin(t)

>>grid

>>xlabel(‘t’), >>ylabel(‘Amplitude’)

Hasil Plot :

Contoh 2 : Menampilkan 2 grafik dalam 1 bidang

>>t=0:0.1:10;

>>x=sin(t);

>>y=cos(t);

>>z=cos(2*t+10);

>>plot(t,x,’r-‘)

>>hold on

>>plot(t,y,’bo’)

>>hold on

>>plot(t,z,’k–‘)

>>title(‘Mulitple Plot’)

>>xlabel(‘t’),ylabel(‘Amplitude’)

>>grid

>>legend(‘x=Sin(t)’,…

‘y=cos(t)’,’z=cos(2*t+10)’)

>>hold off

Hasil Plot :

Contoh 3 : Menampilkan 2 grafik dalam 2 bidang (terpisah)

>> t=0:0.1:10;

>> x=sin(t);

>> y=sin(t+30);

>> subplot(2,1,1)

>> plot(t,x,’r-‘)

>> grid on

>>xlabel(‘t’),ylabel(‘Amplitude’)

>> title(‘ Grafik x = Sin(t)’)

>> subplot(2,1,2)

>> plot(t,y,’bo’)

>> grid on

>> xlabel(‘t’),ylabel(‘Amplitude’)

>> grid on

>> title(‘Grafik y = sin(t+30)’)

>> hold off

Hasil Plot :

Grafik 3 Dimensi

Matlab mempunyai heberapa fungsi tersendiri untuk mem­plot 3-D object. Fungsi-fungsi terscbut adalah plot kurva di ruangan (plot3). mesh surfaces (mesh), surfaces (surf) dan plot kontur (countour). Juga ada dua fungsi untuk memplot permukaan yang khusus, sphere dan cylinder.Untuk Iebih mengetahui 3-D graphic, ketikkan help graph3d Command Window.

Contoh :

>> n=25;

>> x=0:1/n:3;

>> plot3(x,sin(5*x),sin(5*x));

>> grid

Hasil Plot :

Matematika Dalam Teknik Kontrol

Fungsi Polinomial

Matlab menyediakan fungsi operasi standar dari polinom, seperti akar poli-nomial, evaluasi, dan turunan. Sebagai tambahan, fungsi-fungsi berikut diberikan untuk aplikasi lebih lanjut, seperti pencocokan kurva dan ekspansi fraksi parsial.

Fungsi Keterangan
Conv Perkalian polinomial
Deconv Pembagian polinomial
Poly Polinomial dengan akar-akar tertentu
Polyder Turunan polinomial
Polyfit Pencocokan kurva polinomial
Polyval Evaluasi polinomial
Polyvalm Evaluasi matrik polinomial
Residue Ekspansi fraksi parsial
Roots Mencari akar-akar polinomial

Transformasi

a). Transformasi Laplace

Contoh :

Tentukan transformasi laplace dari fungsi berikut ini :

f = 0,03(1-cos2t)

Jawab : Command windows :

>> f = sym(‘1-cos2*t)’)

>> F = laplace(f)

Atau pada M-file :

Syms t % Untuk inisialisasi variabel

f = 1-cos2*t

laplace(g)

b). Invers Laplace

Contoh :

Tentukan invers transformasi laplace dari fungsi berikut :

F(s) =

Jawab :

Command Windows :

>> F = exp(-1)/(s-1)

>> f = ilaplace(f)

Atau pada M-File :

Syms s % Untuk inisialisasi variabel

F = exp(-1)/(s-1)

ilaplace(F)

Differensial

Contoh :

  1. Turunan pertama dari fungsi y

>> syms x; ¿

>> y=x^3+2*x^2+6*x+7; ¿

>> z=diff(y) ¿

Akan muncul sebagai berikut :

z =

3*x^2+4*x+6

  1. Turunan kedua dari fungsi y

>>z=diff(y,2) ¿

Akan muncul sebagai berikut :

z =

6*x+4

Kontrol PID

PID Controller merupakan salah satu jenis pengatur yang banyak digunakan. Selain itu sistem ini mudah digabungkan dengan metoda pengaturan yang lain seperti Fuzzy dan Robust. Sehingga akan menjadi suatu sistem pengatur yang semakin baik Tulisan ini dibatasi pada sistem dengan Unity Feedback System, yang gambarnya sebagai berikut :

Gambar Block Diagram Untuk Unity Feedback System

  1. Tiga Jenis Controller dan karakteristiknya:
  2. Kontroler Proporsional (P)

Pengaruh pada sistem :

  • Menambah atau mengurangi kestabilan
  • Dapat memperbaiki respon transien khususnya : rise time, settling time.
  • Mengurangi waktu naik, tidak menghilangkan Error steady state

Untuk menghilangkan Ess, dibutuhkan KP besar, yang akan membuat sistem lebih tidak stabil.

1. Kontroler Integral (I)

Pengaruh pada sistem :

  • Menghilangkan Error Steady State
  • Respon lebih lambat (dibanding P)
  • Dapat menimbulkan ketidakstabilan (karena menambah orde sistem)

2. Kontroler Derivatif (D)

Pengaruh pada sistem :

  • Memberikan efek redaman pada sistem yang berosilasi sehingga bisa memperbesar pemberian nilai Kp .
  • Memperbaiki respon transien, karena memberikan aksi saat ada perubahan error.
  • D hanya berubah saat ada perubahan error, sehingga saat ada error statis D tidak beraksi Sehingga D tidak boleh digunakan sendiri.

Fungsi transfer dari PID controller akan tampak sebagai berikut :

KP + + KDs =

  • KP = Proportional Gain
  • KI = Integral Gain
  • KD = Derivatif Gain

Tabel Respon PID Controller Terhadap Perubahan Konstanta

Respon Loop Tertutup Waktu Naik Overshoot Waktu Turun Kesalahan Keadaan Tunak
Kp Menurun Meningkat Perubahan Kecil Menurun
Ki Menurun Meningkat Meningkat Hilang
Kd Perubahan Kecil Menurun Menurun Perubahan Kecil

Simulasi Sistem

Simulasi dengan M-File

Untuk meng-analisa suatu sistem, software hanya memerlukan masukan berupa transfer function yang ditulis dalam Laplace Transform (dalam s-domain) atau matriks. contoh, suatu sistem kontrol memiliki transfer function sebagai berikut :

Ketikkan listing berikut pada M-File :

num = [1];

den = [1 2 10];

step(num,den)

title(‘Open Loop Response’)

Respon sistem terbuka (open loop response) dapat dilihat pada gambar di bawah ini :

Simulasi dengan Simulink

Pada M-File kurva respon sistem dibuat dengan menggunakan listing program, sedangkan pada simulink kita bisa menganalisa sistem dengan menggunakan block diagram.

Analisa dengan mennggunakan simulink:

IV. TUGAS DAN JAWABAN

1. Buatlah matriks A dan B ordo 4×4, dan tentukan :

>> A=[ 6 5 8 7 ; 4 6 7 4 ; 3 4 2 8 ; 8 4 6 2 ]

A =

6 5 8 7

4 6 7 4

3 4 2 8

8 4 6 2

>> B=[ 5 4 6 7 ; 5 7 8 9 ; 8 6 4 2 ; 8 7 4 6 ]

B =

5 4 6 7

5 7 8 9

8 6 4 2

8 7 4 6

1. Invers matriks A dan B

>> inv(A)

ans =

-0.0525 -0.1377 0.0623 0.2098

-0.3902 0.3508 0.1508 0.0607

0.2820 -0.0098 -0.2098 -0.1279

0.1443 -0.1213 0.0787 -0.0770

>> inv(B)

ans =

0.2809 -0.2697 0.0618 0.0562

-0.4944 0.3146 0.0112 0.1011

0.1180 0.1067 0.2360 -0.3764

0.1236 -0.0787 -0.2528 0.2247

2. A x (B – 1)

>> A*(B-1)

ans =

149 130 110 119

117 107 95 99

98 91 73 92

104 90 92 96

3. Invers A x B

>> inv(A)*B

ans =

1.2262 0.6689 -0.3279 -0.2230

1.4951 2.2246 1.3115 1.0918

-1.3410 -1.0951 0.2623 0.6984

0.1279 -0.3393 -0.0984 -0.3869

4. A2

>> A^2

ans =

136 120 141 140

101 100 112 116

104 79 104 69

98 96 116 124

5. Elemen matriks A dan B dengan 4

>> A=[ 4 4 4 4 ; 4 4 4 4 ; 4 4 4 4 ; 4 4 4 4 ]

A =

4 4 4 4

4 4 4 4

4 4 4 4

4 4 4 4

>> B=[ 4 4 4 4 ; 4 4 4 4 ; 4 4 4 4 ; 4 4 4 4 ]

B =

4 4 4 4

4 4 4 4

4 4 4 4

4 4 4 4

6. Pangkatkan dengan 2 setiap matriks A dan B

>> A.^2

ans =

16 16 16 16

16 16 16 16

16 16 16 16

16 16 16 16

>> B.^2

ans =

16 16 16 16

16 16 16 16

16 16 16 16

16 16 16 16

7. Determinan matriks A dan B

>> det A

ans =

65

>> det B

ans =

66

2. Ubah persamaan liner berikut menjadi persamaan matriks dan cari nilai x1, x2, x3, dan x4 !

2×1 + x2 + 4×3 + 5×4 = 8

x1 – 2×2 – 1×3 + 5×4 = 4

9×1 + 3×2 + 3×3 + 4×4 = 10

4×1 + 3×2 + 7×3 – 1×4 = 47

Jawab :

>> A = [2 1 4 5 ; 1 -2 -1 5 ; 9 3 3 4 ; 4 3 7 -1]

A =

2 1 4 5

1 -2 -1 5

9 3 3 4

4 3 7 -1

>> B = [8;4;10;47]

B =

8

4

10

47

>> C = inv(A)*B

C =

5.9000

-17.3000

10.0000

-5.3000

>> x1=5.9000;x2=-17.3000;x3=10.0000;x4=-5.3000;

>> B=[x1;x2;x3;x4]

B =

5.9000

-17.3000

10.0000

-5.3000

3. Buat tampilan grafik plot, stem, bar, dan stair dari 2 persamaan dalam 1 grafik! :

A = (3x+2)3 Dimana : n = 5;

B = 5x3+4 x = 0 : 1/n : 10

Jawab :

– Bahasa programnya

n=5

x=0: 1/n :10

A=(3*x+2).^3

B=(5*x.^3)+4

plot(x,A,’bp’)

hold on

plot(x,B,’rs’)

hold on

title(‘Grafik Tugas Meri’)

xlabel(‘X’),ylabel(‘A dan B’)

grid

legend(‘A=(3*x+2).^3′,’B=(5*x.^3)+4’)

hold off

Grafik Plot

– Bahasa programnya

n=5

x=0: 1/n :10

A=(3*x+2).^3

B=(5*x.^3)+4

stem(x,A,’bp’)

hold on

stem(x,B,’rs’)

hold on

title(‘Grafik Tugas Meri’)

xlabel(‘X’),ylabel(‘A dan B’)

grid

legend(‘A=(3*x+2).^3′,’B=(5*x.^3)+4’)

hold off

Grafik Stem

Bahasa Programnya:

n=5

x=0: 1/n :10

A=(3*x+2).^3

B=(5*x.^3)+4

bar(x,A,’bp’)

hold on

bar(x,B,’rs’)

hold on

title(‘Grafik Tugas Meri’)

xlabel(‘X’),ylabel(‘A dan B’)

grid

legend(‘A=(3*x+2).^3′,’B=(5*x.^3)+4’)

hold off

Grafik Bar

Bahasa Programnya:

n=5

x=0: 1/n :10

A=(3*x+2).^3

B=(5*x.^3)+4

stairs(x,A,’bp’)

hold on

stairs(x,B,’rs’)

hold on

title(‘Grafik Tugas Meri’)

xlabel(‘X’),ylabel(‘A dan B’)

grid

legend(‘A=(3*x+2).^3′,’B=(5*x.^3)+4’)

hold off

Grafik Stairs

  1. Bagaimana cara menampilkan dua fungsi sinus dan cosinus pada masing fungsi yang disajikan dalam grafik yang berbeda. Misalnya anda gunakan contoh kasus pada soal ke-3, fungsi pertama anda tampilkan pada figure (1),sementara fungsi kedua anda tampilkan pada figure (2)!

Jawab:

– bahasa programnya

n=5

x=0 : 1/n :10

A=(3*x+2).^3

B=(5*x.^3)+4

C=sin(A)

D=cos(B)

figure(1)

plot(x,C,’b-‘)

hold on

title(‘Grafik Sinus’)

xlabel(‘X’),ylabel(‘Fungsi Sinus’)

grid

figure(2)

plot(x,D,’r-‘)

hold on

title(‘Grafik Cosinus’)

xlabel(‘X’),ylabel(‘Fungsi Sinus’)

grid

hold off

Grafik Soal No.3(Figure 1)

Grafik Soal No.3(Figure 2)

5. Tentukan transformasi fungsi laplace berikut:!

syms t

F= (t^3 + 3*t^2 + 4*t + 3)

laplace(F)

F =

t^3+3*t^2+4*t+3

ans =

6/s^4+6/s^3+4/s^2+3/s

  1. syms t

F= 3*(2*t-3)+(t-3)

laplace(F)

F =

7*t-12

ans =

7/s^2-12/s

  1. syms t

F= (3*sin(5*t*(pi/180)))

laplace(F)

F =

3*sin(1/36*t*pi)

ans =

1/12*pi/(s^2+1/1296*pi^2)

  1. syms t

F=(5*cos(3*t*(pi/180)))

laplace(F)

F =

5*cos(1/60*t*pi)

ans =

5*s/(s^2+1/3600*pi^2)

Tentukan transformasi Laplace balik dari fungsi-fungsi berikut:

  1. F(s) = ((s2 +3s +2)/(s3 +5s2 +10.5s +9))

Jawab :

syms s

F=((s^2 +3*s +2)/(s^3 +5*s^2 +10.5*s +9))

ilaplace(F)

F =

(s^2+3*s+2)/(s^3+5*s^2+21/2*s+9)

ans =

exp(-3/2*t)*cos(3/2*t)-1/3*exp(-3/2*t)*sin(3/2*t)

  1. F(s) = ((s+1)/(s3+6s2+11s+6))

Jawab :

syms s

F=((s+1)/(s^3+6*s^2+11*s+6))

ilaplace(F)

F =

(s+1)/(s^3+6*s^2+11*s+6)

ans =

-exp(-3*t)+exp(-2*t)

  1. F(s) = ((4s+5)/(s2+5s+18.5))

Jawab :

syms s

F=((4*s+5)/(s^2+5*s+18.5))

ilaplace(F)

F =

(4*s+5)/(s^2+5*s+37/2)

ans =

4*exp(-5/2*t)*cos(7/2*t)-10/7*exp(-5/2*t)*sin(7/2*t)

4. F(s) = ((s2-16)/(s3+8s2+24s+32))

Jawab :

syms s

F==((s^2-16)/(s^3+8*s^2+24*s+32))

ilaplace(F)

ans =

0

ans =

4*exp(-5/2*t)*cos(7/2*t)-10/7*exp(-5/2*t)*sin(7/2*t)

6. Buatlah gambar M-file dan simulink grafik keluaran sinyal dari TF persamaan berikut :

G(s) = s+2/2s2+3s

G(s) = 2s+1/5s2+2s+1

Jawab :

V. ANALISA

Pada praktikum kali ini, sebelum melakukan percobaan kami diperkenalkan dengan yang namanya Matlab, daerah lingkungan kerjanya, karakter-karakter spesial matlab yang juga perlu kita ketahui serta cara-cara meimplentasikan fungsi, vektor, matriks maupun grafik ke dalam matlab. Matlab adalah bahasa pemograman yang berbeda dengan bahasa pemograman tingkat tinggi seperti visual basic,Delphi dan lain-lain, matlab memiliki kelebihan sendiri yaitu dapat menyelesaikan persoalan komputasi teknis, visualisasi dan pemrograman seperti komputasi matematik, analisis data, pengembangan algoritma, simulasi dan pemodelan dan grafik-grafik perhitungan.

Matlab memiliki aturan/kaidah sendiri dalam penulisan perintah programnya misalnya kita ingin membuat persamaan matriks maka kita harus mengawalinya dengan tanda [ dan diakhiri tanda ] serta tanda ; sebagai pemisah baris satu dan baris selanjutnya. Dan untuk mengetahui invers atau determinan dari matriks tersebut kita tinggal berikan perintah inv atau det. Bukan hanya matriks, bisa juga turunan,integral,laplace, laplace balik dan lain-lain.

Selain dapat menyelesaikan perhitungan matematik,MatLab juga dapat menyajikan data input dalam tampilan Grafik. Grafik yang disajikan dapat berupa 3D atau 2D berupa plot, stem, bar atau stair. Tergantung bagaimana input yang kita berikan. Bahkan matlab juga dapat bermanfaat untuk pengoperasian fungsi laplace dan membuat diagram blok. PID controller yang merupakan salah satu jenis pengaturan yang dilakukan dapat disimulasikan dengan metode Simulink pada matlab. Setelah melakukan banyak percobaan diatas saya baru mengerti bahwa dalam penulisan perintah program pada matlab diperlukan ketelitian yang sangat tinggi karena salah sedikit saja maka pesan error akan ditampilkan , tapi disini matlab lagi-lagi memliki kelebihan ketika mengalami kesalahan atau error maka matlab akan memberitahu kita baris mana yang mengalami kesalahan penulisan program tersebut, sehingga kita tidak susah lagi untuk mencari kesalahan dimana yang terjadi.

VI. KESIMPULAN

  1. Software MATLAB mampu menyelesaikan persoalan komputasi teknis, visualisasi dan pemrograman seperti komputasi matematik, analisis data, pengembangan algoritma, simulasi dan pemodelan dan grafik-grafik perhitungan.
  2. MatLab memiliki sensitivitas yang tinggi dalam mengeksekusi input yang dimasukan.
  3. MATLAB mampu mensimulasikan suatu data masukan dengan tampilan 2 dimensi dan 3 dimensi.
  4. Fasilitas Simulink Windows pada MATLAB sangat membantu dalam simulasi kontrol (PID Controller).
  5. Software MATLAB, Matrix Laboratory, dikembangkan berdasarkan metode matrik (penggunaan baris dan kolom).

DAFTAR PUSTAKA

Korps Asisten Dasar Sistem Kendali. 2009. Modul Praktikum Dasar Sistem Kendali. Inderalaya : Universitas Sriwijaya

http://www.google.co.id/pengoprasian program matlab. Diakses tanggal 28 mei 2009.

http://www.members.ivcos.co.uk/roadevil/article.php?sid=2beton .Diakses tanggal 28 mei 2009.

http://www.rtcuifm@yexa.eng-ui.ac.id). Diakses tanggal 28 mei 2009.

http://www.blogspot.com/elektronika. Diakses tanggal 28 mei 2009.

By Michael Wong