Laporan Matlab Baru.docx

  • Uploaded by: Anonymous 8cT9Hsebyt
  • 0
  • 0
  • December 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Laporan Matlab Baru.docx as PDF for free.

More details

  • Words: 4,207
  • Pages: 64
MATHEMATIC EXPERIMENT

PRACTICUM REPORT MATLAB

By : MEIDY ADELINA (4163312017) BILINGUAL MATHEMATICS EDUCATION 2016

MATHEMATICS DEPARTMENT FACULTY OF MATHEMATICS AND NATURAL SCIENCES 2018

I. TITLE OF PRACTICUM

: MATLAB PRACTICUM

II. PURPOSE

: 1. Knowing the use of MATLAB for simple calculation operations. 2. Know how to create, manipulate, and operate matrices, both simple and very complex matrices in MATLAB 3. Able to use M-files in MATLAB 4. Knowing the work on Mathematical Operations in MATLAB 5. Able to display a graph in a simple or two-dimensional form with MATLAB 6. Able to display and describe 3-dimensional plots in MATLAB 7. Able to make a mathematical function in MATLAB 8. Able to analyze functions, namely determining the value of zero, the maximum value and the minimum value of a function in MATLAB

III. DATE OF PRACTICUM : 1. October, 1st 2018 (2nd Practicum ) 2. October, 8th 2018 ( 3rd Practicum ) 3. October, 15th 2018 ( 4th Practicum ) 4. October, 22nd 2018 ( 5th Practicum ) 5. October, 29th 2018 ( 6th Practicum ) 6. November, 5th 2018 ( 7th Practicum ) 7. November, 12nd 2018 ( 8th Practicum ) 8. November, 19th 2018 ( 9th Practicum ) IV. TOOL & MATERIAL

: A. TOOLS NO

TOOLS

QUANTITY

1

Laptop

1 unit

2

Printer

1 unit

3

Clamp

1 unit

4

Ducktape

1 pc

5

Scissors

I unit

B. MATERIALS

V. LITERATURE REVIEW

NO

MATERIALS

QUANTITY

1

Diktat Book

1 pc

2

Paper

: What is MATLAB ?

Matlab (matrix laboratory) is a software brand developed by Mathworks.Inc. It is a high-level programming language, which is often used for numerical analysis and computation techniques, namely in solving problems involving mathematical operations such as elements, matrices, optimization, approximation and others. ( Ariyanto, 2011 )

MATLAB is a computer program that can help solve various mathematical problems that we often encounter in the technical field. We can utilize MATLAB's ability to find solutions to various numerical problems quickly, starting with the most basic things, for example system 2 equations with 2 variables: x - 2y = 32 12x + 5y = 12

to complex ones, such as looking for polynomial roots, interpolating from a number of data, calculating with matrix, signal processing, and numerical methods. One very useful aspect of MATLAB is its ability to describe various types of graphics, so that we can visualize data and complex functions. For example, the following three images were created

with the command surf in MATLAB. What is History of the Matlab Application Matlab was created in the late 1970s by Cleve Moler, who later became Chair of the Computer Science Department at the University of New Mexico. He designed it to provide access for students to use LINPACK and EISPACK without having to learn Fortran. His work soon spread to other universities and received a warm welcome among the applied mathematics community. Jack Little, an engineer, met his work during Moler's visit to Stanford University in 1983. Realizing its commercial potential, he joined Moler and Steve Bangert. They rewrote MATLAB in C

programming

language,

then

founded

The

MathWorks in 1984 to continue its development. The rewritten library is now known as JACKPAC. In 2000, MATLAB was rewritten with the use of a new set of libraries for matrix manipulation, LAPACK. Matlab was first adopted by control design engineers (also Little specialties), then spread quickly to various other fields. Now matlab is used in the field of education, especially in the teaching of linear algebra and numerical analysis, as well as popular among scientists who pursue the field of image processing. This interface program continues to evolve from what was originally a LINPACK and EISPACK project developed using the FORTRAN language, then developed by using C ++ language and assembler (mainly for MATLAB basic functions). Now matlab

has developed into a sophisticated programming environment. This is due to the high need for computer programs that provide computing, modeling and simulation tools with various facilities, so various features are added to Matlab from year to year. Matlab is now equipped with various facilities namely Simulink, Toolbox, Blockset, Stateflow, Real Time Workshop, GUIDE and others. Besides that the results of the Matlab program can already be exported to C / C ++, Visual Basic, Fortran, COM, Java, Excel, and the web / internet. Thus the results from Matlab can be compiled and become a program whose execution time is faster, and can be accessed in various ways. The usefulness of Mathlab in Mathematics Matlab also brings features in physics, statistics and visualization functions. Matlab is widely used in: 

Mathematics and computing



Development and algorithm



Modeling

programming,

simulation,

and

prototype making 

Data analysis, exploration and visualization



Numerical analysis and statistics



Engineering application development

In the university environment, MATLAB is used as a standard learning tool for the introduction and advanced stages in mathematics, engineering and science. In industry, MATLAB is one tool that can be selected

for

research,

development

and

analysis.Specifically, Matlab can be used in the design and simulation of control systems. With this software, the control system designers can easily get the transfer function of a system.

Automatic control currently provides a very large role in human life, especially in the fields of science and industry. Some of them are robots, temperature regulation of a tank, regulation of air humidity in a room, air pressure in a closed pipe that is kept constant, etc. Mastery of the control system both in terms of theory and practice will produce a system with a response that is in accordance with needs. ( Andrew, 2016 ) VI. PROCEDUR & RESULT

: CHAPTER 2 BASIC OPERATION IN MATHLAB A. PROCEDURE

1. Basic Arithmetic Operation Basic operation in Matlab has a similar function with calculator. The basic arithmetic operation that can be solved in Matlab are addition, substraction, multiplication, division and degree. Below are the Matlab procedures to solved those problem: • Type the data into command window appropriate with the direction at book, after we typed it, click enter and the result will be shown at the bottom of the data like the picture below.

Based on these experiment, we can conclude that the arithmetic operation in Matlab is quiet similar with using calculator and we can solve mix arithmetic operation problem with Matlab.

2. Using Varible There are some rules when use variable in Matlab, one of these is the variable must be started with alphabet. Below is the procedure to using variable in Matlab:

In the picture above, it shows error on the display because we do not declare variable x before, but we did the operation using x. Then, we did the operation using a and b the result showed in the display because the variable has been declare before the operation. 3. Number Format The settings about number format can be set in preference in command window or M-File display. There are some number format in Matlab, below is the procedure:

To using the format number, we must be typed it before the operation.

4. Complex Number Operation

5. Mathematics Function The mathematics function in Matlab, such as: basic mathematic

function,

trigonometry

function,

exponential function, integration function and complex number function. Below is the procedure: For the first step, you need to type all of the data in command window or M-File with using this function 6.

Command In Mathlab

Mathlab has several commands that can make it easier for users to operate mathlab. This command is a rounding command on numbers and additional commands in mathlab.

CHAPTER 3 ( VECTORS AND MATRICES ) A. PROCEDURE 1. Make a Vector



To

create

a

row

vector

in

matlab,

type

Nama_Vektor = [after that in square brackets type vector elements that must be followed by a space between each element] 

To make a column vector in matlab, type Nama_Vektor = [after that in square brackets type vector elements. In column vectors, spaces or commas (,) are used to separate columns and semicolons (;) or press enter is used to separate lines].



To make a vector with the different elements being the same. For example, vector K = 1 3 5 7 9, the difference possessed by vector K is the same, namely 2. Formula to make this vector is Nama_Vektor = [m: p: n], where the variable m shows the first element, p is different and n is the element last of vectors.

2. Matrix To make a matrix in matlab, it is the same as creating a vector. Type Nama_Matriks = [type the first row matrix elements then type semicolon (;) type the second row element of the semicolon (;) and so on until the nth row]

3. Special Matrix In matlab there are several special matrices available, including ones (m, n) eye (m) zeros (m, n) rand (m) randn (m). In this special matrix there is no need to type matrix elements one by one, but just type the function. For example, see the picture below.

4. Transposition of a Matrix To make a matrix transposition available in matlab, by typing trans_1 or trans_2 and so on = then the name of the matrix with the addition of a single comma above (‘). Like the example see in the picture below.

5. Inverse and Determinants of Matrices For the calculation of inverse and determinant of a matrix in matlab, it can be done by writing the inverse function and the determinant in matlab. To use the inverse function type inv (Name_Matrix), while for functions use determinant type det (Nama_Matriks). To use it can be seen in the picture below.

6. Matrix Manipulation The index matrix is used to indicate the position of the elements. In a one-dimensional (vector) matrix, the elements are only in the row or column index. The formula below is used to manipulate a matrix. Vector_name (row or column index), while for matrix, matrix__name (index_line, column_ index). Examples are in the picture below.

Several rows or columns of a matrix can be taken simultaneously. This can be done using a colon operator (:). In this case the colon operator (:) states the boundary of the matrix to be taken. Examples of the use of colon operators can be seen in the picture below.

The matrix can also be manipulated by exchanging one or several elements. Examples are in the following picture.

7. Removing the Matrix Element The matrix elements that have been formed can also be deleted. This can be done by using square brackets "[]" to fill or type in the brackets. An example can be seen in the picture below.

B. RESULT 1. Given matriks J=

and L=

, K=

,

.

Determine the operation of the matrix element perelement in the operating conditions below: 

What is J. * K = K. * J



What is 3. * (K + L) = 3. * K + 3. * L

Matrix whose elements are 2nd and 3rd row, 1st and 2nd columns of T.

Add 5th row to the T matrix with elements 12, 13, 14, 15.

Change the element in the 3rd row of the 2nd column with the number 100

Delete all rows in the 2nd and 3rd columns.

2. Determine the inverse and determinant of the matrix:

3. Determine the inverse and determinant of the matrix :

CHAPTER 4 ( SCRIPT-FILE ) A. PROCEDURE 1. Using M-File Open through the menu in the main window by selecting the file menu, then select NEW, then select M-File or by pressing the Ctrl and N keys simultaneously. 2.

M-Files As Scripts

Open M-File then type the script below % Use of Simple Arithmetic Operators: x = 2; y = 3; x+y 2*y+3*y x ^ 2-2 * y then save the file in the MATLAB DIRECTORY then run by clicking the button marked down arrow. B. RESULT 1. Using M-File

CHAPTR 5 (MATHEMATICAL OPERATIONS IN MATRICS ) 1. Addition and Subtraction  Open the Matlab application  Type the command in the command window that already exists in the matlab window  Then perform addition and subtraction operations by following the commands for addition and subtraction of two matrices with the same order  After typing the command, then execute it by pressing the enter key.  Displays results as shown below.

2. Multiplication  Type the multiplication operation command in the Windows command  Then execute it by pressing the enter key  Displays results as shown below.

3. Distribution of Matrices ( Left division PX = Q )  Type the operation command for the left divide command in the command window  Type the matrix form that you want to find the division using the left division  Then type the operation X = P \ Q  Then look for the matrix inverse  Then the division operation is obtained  Displays results as shown below.

( Right division XP = Q ) 

Type the operation command, the command divide right in the command window



Type the matrix form that you want to find the division using the left division



Then type operation X = Q / P



Then look for the matrix inverse



Then the division operation is obtained



Displays results as shown below.

4. Operation of elements per element  Typing the command operations of the per-element element, namely operation of addition, subtraction, processing, division and assignment in the command window  Then execute it  Displays results as shown below

5. Matrix As Mathematical Functions ( Example 1: Vector as a function ) 

Type the vector command operation as a function in the command window



Then explore it



Display the results in the image below

Example 2 (The application of functions to a vector) 

Type the operation of the command applying a function to the vector



Then execute it



Display the results in the image below

CHAPTER 6 ( PLOT 2 DIMENSIONS ) 1. Command Plot Open the mathlab application, type the plot creation command (x, y) in the M-file, then click Run, then the plot will be displayed in the figure window.

Modify the plot with commands that are available in mathlab by changing the color of the curve line, changing the line type, and adding markers with various marker shapes and colors.

2. Enhancing Image Display Formatting a plot using commands and plot editors, for example, adds the x-label, y-label, and grid by typing the command in M-file and the plot window will appear.

3. Drawing Function Type the command to plot the curve y = x3 + 1 with intervals x = -4 to x = 4 in the M-file, then click Run, and the plot will be displayed in the Figure window.

4. Fplot command Typing the fplot command is the function plot y = 2x3 + 2 cos (2x) sin (2x) + 3 tan (2x) at intervals of 5 ≤ x ≤ 5 on M-Files by following the fplot formula ('function', 'value-limit x '), then click Run and a plot display will appear in the Figure window.

5. ezplot command Type the ezplot command to describe the function y = x3 + 11 and y = cos f〖(x)〗 / (x ^ 3 + 2) by following the ezplot formula ('function') on M-File

then clicking Run and the plot will be displayed in Figure window.

6. Drawing Multiple Charts in the Same Plot a. Plot command Make a graph of the function y = 2x4 + 5x2-3 and graph the first and second derivatives on the same plot in the interval -2≤x≤2 by typing the command in M-File with the formula command plot (p, q, '- b', r, s, '- y', t, u, '-. C') then clicking Run and A plot display will appear in the Figure window.

b. Hold on, hold off Membuat plot grafik fungsi y=2x4+5x2-3 dan grafik turunan pertama dan keduanya pada plot yang sama, dalam interval -2≤x≤2 dengan perintah hold on dan hold off lalu mengetikkan di M-File dan mengklik Run sehingga plot akan ditampilkan pada figure window.

c. Perintah line (line command) Make a graph of the function y = 2x4 + 5x2-3 and the first derivative graph and both on the same plot in the interval -2≤x≤2 using the line command with the form: (x, y, 'line type', 'line color') . Type the line command on M-File then click Run so that the plot will be displayed in the figure window.

7. Plot with Koordinat Polar a. Make a plot of the mathematical function r = sin4 (5α), in the range 0≤α≤π by typing the command in the command window then pressing enter so that the plot of the function is displayed in the figure window.

b. Make a plot of the mathematical function r = sin4 (5α), in the range 0≤α≤2π by typing the command in the command window then pressing enter so that the plot of the function will be displayed in the figure window.

( CHAPTER 7 PLOT 3 DIMENSIONS ) A. Draw lines Example 1:Open the Matlab application, type commands in the command window that already exists in the matlab window as below

After typing the commands, then execute by pressing the enter key.Displays results as shown below.

Example 2:Open the Matlab application then Type commands in the command window that already exists in the matlab window as below

After

typing

mengeksekusikannya

the by

commands, pressing

key.Displays results as shownbelow.

the

then enter

B. Drawing Using Mesh or Surface Commands Example 1:Open the Matlab application then Type commands in the command window that already exists in the matlab window as below

After typing the commands, then execute by pressing the enter key. Displays results as shown below.

Example 2:Open the Matlab application then Type commands in the command window that already exists in the matlab window as below.

After typing the commands, then execute by pressing the enter key, Displays results as shown below.

C. Contour

plot,

Mesh-Contour,

Surface-

Contour, three-dimensional Contour Example 1: Open the Matlab application, Type commands in the command window that already exists in the matlab window as below.

After typing the commands, then execute by pressing the enter key.Displays results as shown below.

Example 2:Open the Matlab application, then Type commands in the command window that already exists in the matlab window as below

After typing the commands, then execute by pressing the enter key.Displays results as shown below.

Example 3:Open the Matlab application, Type commands in the command window that already exists in the matlab window as below.

After typing the commands, then execute by pressing the enter key. Displays results as shown below.

Example 4:Open the Matlab application then Type commands in the command window that already exists in the matlab window as below

After typing the command, then execute by pressing the enter key, displaying the results as shown below.

D. Drawing with the shape of the surface of the waterfall and lightning Example 1: Open the Matlab application then Type commands in the command window that already exists in the matlab window as below

After typing the command, then execute by pressing the enter key. Showing results as shown below.

Example 2: Open the Matlab application thenType commands in the command window that already exists in the matlab window as below

E. Drawing Advanced 3-Dimensional Charts Example 1 (Drawing a bar diagram): Open the Matlab application then Type commands in the command window that already exists in the matlab window as below

After typing the command, then execute it by pressing the enter key and displaying the results as shown below.

Contoh 2 (Menggambar Bola) 

Open the Matlab application



Type commands in the command window that already exists in the matlab window as below.



After typing the command, then execute it by pressing the enter key.



Displays results as shown below.

Contoh 3 (Menggambar Silinder Sempurna) 

Open the Matlab application



Type commands in the command window that already exists in the matlab window as below.



After typing the command, then execute it by pressing the enter key.



Displays results as shown below.

Contoh 4 (Menggambar Kubah Masjid) 

Open the Matlab application



Type commands in the command window that already exists in the matlab window as below



After typing the command, then execute it by pressing the enter key.



Displays results as shown below.

Contoh 5 (Menggambar Pai 3-D) 

Open the Matlab application



Type commands in the command window that already exists in the matlab window as below



Setelah mengetik perintah perintahnya, kemudian mengeksekusikannya dengan menekan tombol enter.



Menampilkan hasil seperti gambar di bawah ini.

Contoh 6 (Menggambar 3-D Scatter Plot) 

Open the Matlab application



Type commands in the command window that already exists in the matlab window as below



Setelah mengetik perintah perintahnya, kemudian mengeksekusikannya dengan menekan tombol enter.



Menampilkan hasil seperti gambar di bawah ini.

Contoh 7 (Menggambar Stem 3-D) 

Open the Matlab application



Type commands in the command window that already exists in the matlab window as below



Setelah mengetik perintah perintahnya, kemudian mengeksekusikannya dengan menekan tombol enter.



Menampilkan hasil seperti gambar di bawah ini.

( BAB 8 Fungsi Pada Matlab ) 8.4 Pemecahan Masalah Menggunakan Fungsi Contoh 1 (Menentukan Luas, Keliling, Panjang Diagonal) 

Membuka aplikasi Matlab



Mengetikkan function pada M-File yang sudah ada pada jendela matlab seperti dibawah ini



Setelah mengetik functionnya, kemudian menyimpan dengan nama file persegi_pnjg



Mengetikkan perintah pada command window yang sudah ada pada jendela matlab seperti dibawah ini

Contoh 2 (Fungsi_1) 

Membuka aplikasi Matlab



Mengetikkan function pada M-File yang sudah ada pada jendela matlab seperti dibawah ini



Setelah mengetik functionnya, kemudian menyimpan dengan nama file persegi_pnjg



Mengetikkan perintah pada command window yang sudah ada pada jendela matlab seperti dibawah ini

Contoh 3 (Inline Function) 

Membuka aplikasi Matlab



Mengetikkan perintah pada command window yang sudah ada pada jendela matlab seperti dibawah ini



Setelah mengetik perintah perintahnya, kemudian mengeksekusikannya dengan menekan tombol enter.



Menampilkan hasil seperti gambar di atas.

8.5 Perintah Feval Contoh 1. Penggunaan perintah feval pada fungsi baku. 

Membuka aplikasi matlab



Mengetikkan perintah pada command window



Kemudian menekan enter



Hasil perintah diperoleh seperti pada gambar dibawah.

Contoh 2. Penggunaan perintah feval pada fungsi inline 

Membuka aplikasi matlab



Mengetikkan perintah pada command window



Kemudian menekan enter



Hasil perintah diperoleh seperti pada gambar dibawah.

Contoh 3. Penggunaan perintah feval pada fungsi yang menggunakan M-File 

Membuka aplikasi Matlab



Mengetikkan function pada M-File yang sudah ada pada jendela matlab seperti dibawah ini

( BAB 9 Polynomial ) 9.2 Menentukan Nilai Polinomial Contoh: Untuk mengevaluasi fungsi polinomial f(x)=x6+2x28x+12 pada x=2,x=5,dan x=10 Langkah pertama ialah mengetikan fungsi di matlab seperti dibawah ini.

Lalu run dan akan di tampilkan pada command window

9.3 Menentukan Akar Polinomial Contoh 1: Tentukan akar – akar dari fungsi p(x)=x2+3x-4=0 Langkah pertama ialah mengetikan fungsi di matlab seperti dibawah ini.

Lalu run dan akan di tampilkan pada command window

Contoh 2: Untuk menentukan akar – akar dari x4 -6x3 -40x214x+35=0 Langkah pertama ialah mengetikan fungsi di matlab seperti dibawah ini.

Lalu run dan akan di tampilkan pada command window

9.4 Penjumlahan Dan Pengurangan Fungsi Polinomial Contoh : Tentukan hasil operasi penjumlahan dan pengurangan dari f1(x)=3x4+7x3-6x2-12 dan f2(x)=12x3-4x+1

Langkah pertama ialah mengetikan fungsi di matlab seperti dibawah ini.

Lalu run dan akan di tampilkan pada command window

9.5 Perkalian Dan Pembagian Fungsi Polinomial Contoh 1: Menentukan hasil perkalian dua fungsi polinomial x4+7x3-6x2+12 dan x2+2 Langkah pertama ialah mengetikan fungsi di matlab seperti dibawah ini.

Lalu run dan akan di tampilkan pada command window

Contoh 2: Menentukan hasil pembagian dua fungsi polinomial x4+7x3-6x2+12 dan x2+2 Langkah pertama ialah mengetikan fungsi di matlab seperti dibawah ini.

Lalu run dan akan di tampilkan pada command

9.6 Turunan Fungsi Polinomial Contoh 1: Menentukan turunan fungsi f(x)=x4-2x3+4x+12 Langkah pertama ialah mengetikan fungsi di matlab seperti dibawah ini.

Lalu run dan akan di tampilkan pada command window

Contoh 2: Menentukan turunan pertama dari perkalian fungsi f1 dengan fungsi f2. f1 x f2 = (x4-2x3+4x+12) x (x2- 4) Langkah pertama ialah mengetikan fungsi di matlab seperti dibawah ini.

Lalu run dan akan di tampilkan pada command window

Contoh 3 : Determine the first derivative in the form of division of function

f1

with

function

f2.

The first step is to type the function in matlab as below.

Then run and it will be displayed in the command

9.7 Graph of The Polynomial Function Example : Draw a graph of the polynomial function of f(x)=x64x5+2x4-7x3+x2+5x-7 pada rentang -2≤x≤2 The first step is to type the function in matlab as below.

Then

run

and

it

will

be

displayed

as

below

IX. DAFTAR PUSTAKA

: Sahidin.2006.

1973.

Lattice

Theory,Third

Edition.

American Mathematical Society. Miryanto.1982. Representation of Pre A*-Algebra by Section of Sheaves. International Journal of computational Cognition, Vol.9, No. 2, June 2011 (40-44).

X. NAMA ASLAB

: 1. Aji Trisuandar NIM : 4163230003 2. Mutia Zahara Gunawan NIM: 4161230017

Diketahui, Dosen Pengampu

Medan, 29 Oktober 2018 Praktikan

Tiur Malasari Siregar, S.Pd, M.Si Nim : 19800228 2006 04 2003

Santi Esteria Nainggolan Nim : 4161111065

Related Documents

Laporan Matlab Baru.docx
December 2019 23
Matlab
July 2020 24
Matlab
May 2020 31
Matlab
April 2020 36
Matlab
May 2020 39
Matlab
August 2019 56

More Documents from "Beto Pachon Gomez"

Cjr Aljabar Linear.docx
December 2019 39
Mr Matkom.docx
December 2019 23
Cbr Kapita Selekta.docx
December 2019 35
Laporan Matlab Baru.docx
December 2019 23