Makalah Gerak

22
TUGAS 1 PEMODELAN DAN SIMULASI SIMULASI GERAK LURUS BERATURAN (GLB) DOSEN : RIANI LUBIS, S.T.,M.T KELOMPOK : Irfan Bustomi 10107188 Armandani. F 10107189 Guntur Sulaeman 10107197 Nisa Yunita 10107205 Yuli Yanti A 10107218 JURUSAN TEKNIK INFORMATIKA FAKULTAS TEKNIK DAN ILMU KOMPUTER UNIVERSITAS KOMPUTER INDONESIA

Transcript of Makalah Gerak

Page 1: Makalah Gerak

TUGAS 1

PEMODELAN DAN SIMULASI

SIMULASI GERAK LURUS BERATURAN (GLB)

DOSEN : RIANI LUBIS, S.T.,M.T

KELOMPOK :

Irfan Bustomi 10107188

Armandani. F 10107189

Guntur Sulaeman 10107197

Nisa Yunita 10107205

Yuli Yanti A 10107218

JURUSAN TEKNIK INFORMATIKA

FAKULTAS TEKNIK DAN ILMU KOMPUTER

UNIVERSITAS KOMPUTER INDONESIA

Page 2: Makalah Gerak

Daftar IsiPENDAHULUAN................................................................................................................................................... 1

RUMUS GERAK LURUS BERATURAN.................................................................................................................................2GRAFIK GERAK LURUS BERATURAN (GLB)........................................................................................................................2

SIMULASI............................................................................................................................................................ 4

LANGKAH – LANGKAH......................................................................................................................................... 5

SOURCE CODE GERAK.M..................................................................................................................................... 7

SCREEN SHOT GERAK.FIG (GUI)......................................................................................................................... 15

Page 3: Makalah Gerak

PendahuluanKonsep Fisika yang sering kita jumpai dalam kehidupan sehari-hari adalah gerak manusia

berjalan, planet berputar, pohon tumbang. Seluruh alam semesta bergerak.

Setiap gerak didefinisikan sebagai perubahan posisi relatif terhadap titik acuan tertentu. Namun

dalam kehidupan sehari-hari kita sering menggunakan bumi (tanah) sebagai titik acuan umum

Pengertian Jarak Dan Perpindahan

- Jarak didefinisikan sebagai panjang seluruh lintasan yang dialami benda

- Perpindahan adalah panjang lintasan lurus antara posisi awal dengan posisi akhir

- Jarak hanya memiliki nilai sedangkan perpindahan memiliki nilai dan arah gerak.

Untuk memperjelas perbedaan antara jarak dan perpindahan, diilustrasikan suatu benda

bergerak 70 meter ke timur kemudian berbalik ke barat sejauh 30 meter. Jarak (distance) yang

ditempuh benda di atas adalah 100 meter ditunjukkan oleh garis putus-putus, sedangkan

perpindahannya (displacement) 40 meter, ditunjukkan garis sambung, ke arah timur.

Untuk menyelidiki apakah sebuah benda melakukan GLB atau tidak dapat digunakan

sebuah alat yang disebut pewaktu ketik atau ticker timer dan hasil percobaannya

1

Page 4: Makalah Gerak

Rumus Gerak Lurus Beraturan

Seandainya gerak benda pada Gambar tersebut membutuhkan waktu 20 sekon, kelajuan

orang tersebut adalah 5 m/s, sedangkan besar kecepatannya 2 m/s. Bagaimanakah hal ini

diperoleh?

Jarak (distance) yang ditempuh benda di atas adalah 100 meter ditunjukkan oleh garis

putus-putus, jadi kelajuannya = jarak / waktu = 100 m / 20 = 5 m/s. sedangkan perpindahannya

(displacement) 40 meter, ditunjukkan garis sambung, ke arah timur, jadi kecepatannya =

perpindahan / waktu = 40 m / 20 s = 2 m/s.

Dari ilustrasi tersebut, kita dapat merumuskannya :

v = st atau s = v.t

Dimana :

v = Kecepatan(m/s)

s = Perpindahan(m)

t = Waktu(sekon)

Grafik Gerak Lurus Beraturan (GLB) 

Grafik Posisi terhadap Waktu

Seorang pemain baseball berlari pada lintasan lurus dengan hasil pengukuran waktu dan posisi

seperti tabel berikut :

Waktu Posisi1 102 123 144 165 186 207 22

Jika dijadikan diagram adalah sebagai berikut :

2

Page 5: Makalah Gerak

 

3

Page 6: Makalah Gerak

SimulasiSimulasi ini dibuat dengan software Matlab yang diproduksi oleh Mathworks Corp. kami

berusaha membuatnya dengan tools-tools yang ada pada matlab, kami menggunakan GUIDE

(GUI Builder).

Dalam modul ini terdapat beberapa komponen yaitu:

1. Komponen Text

2. Komponen Edit yang jumlahnya 12, diantaranya adalah:

a. 2 edit untuk input data, dan

b. 10 edit untuk hasil

3. 1 Komponen Panel

4. 2 Komponen Tombol

a. Tombol “Hitung”

b. Tombol “Grafik”

5. 2 Komponen Axes

a. Axes untuk Grafik 2 dimensi

b. Axes untuk Grafik 3 dimensi

4

Page 7: Makalah Gerak

Langkah – LangkahDalam kasus ini kita membuat suatu simulasi dengan bantuan MATLAB terdapat 3 file yaitu:

1. gerak.m

Berisi tentang source code yang digunakan dalam pembuatan simulasi

2. gerak.fig

menampilkan interface / GUI (Graphical User Interface) seperti hasil perhitungan dan

grafik.

3. gerak.asv

Nah, untuk menjalankan simulasi ini ada hal yang harus dilakukan terlebih dahulu yaitu:

1. Buka Matlab Simulink terlebih dahulu

2. Setelah itu, dibagian pojok kiri bawah terdapat tombol Start versi Matlab

3. Lalu pilih “MATLAB”

4. Lalu akan muncul dialog seperti berikut

5

Page 8: Makalah Gerak

5. Bila file belum ada dalam daftar klik tombol “Browse” dan pilih file yang akan dibuka

dengan extension file .fig

Program ini disertakan ke dalam CD bila ingin membukanya double klik file ‘gerak.fig’

maka akan muncul window Matlab, disebelah kiri terdapat panel ‘Current Directory’

Lalu pilih file ‘gerak.fig’ maka akan muncul Program Simulasi Gerak Lurus Beraturan

6

Page 9: Makalah Gerak

Source Code gerak.mAwal Code

function varargout = gerak(varargin)% GERAK M-file for gerak.fig% GERAK, by itself, creates a new GERAK or raises the existing% singleton*.%% H = GERAK returns the handle to a new GERAK or the handle to% the existing singleton*.%% GERAK('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in GERAK.M with the given input arguments.%% GERAK('Property','Value',...) creates a new GERAK or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before gerak_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to gerak_OpeningFcn via varargin.%% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help gerak % Last Modified by GUIDE v2.5 27-Oct-2009 09:01:19 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @gerak_OpeningFcn, ... 'gui_OutputFcn', @gerak_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []);if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1});end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});else gui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT % --- Executes just before gerak is made visible.function gerak_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure

7

Page 10: Makalah Gerak

% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to gerak (see VARARGIN) % Choose default command line output for gerakhandles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes gerak wait for user response (see UIRESUME)% uiwait(handles.figure1); % --- Outputs from this function are returned to the command line.function varargout = gerak_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structurevarargout{1} = handles.output; function edit1_Callback(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit1 as text% str2double(get(hObject,'String')) returns contents of edit1 as a double % --- Executes during object creation, after setting all properties.function edit1_CreateFcn(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end function edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit2 as text

8

Page 11: Makalah Gerak

% str2double(get(hObject,'String')) returns contents of edit2 as a double % --- Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end function edit3_Callback(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit3 as text% str2double(get(hObject,'String')) returns contents of edit3 as a double % --- Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end function edit4_Callback(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit4 as text% str2double(get(hObject,'String')) returns contents of edit4 as a double % --- Executes during object creation, after setting all properties.function edit4_CreateFcn(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)

9

Page 12: Makalah Gerak

% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end function edit5_Callback(hObject, eventdata, handles)% hObject handle to edit5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit5 as text% str2double(get(hObject,'String')) returns contents of edit5 as a double % --- Executes during object creation, after setting all properties.function edit5_CreateFcn(hObject, eventdata, handles)% hObject handle to edit5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end function edit6_Callback(hObject, eventdata, handles)% hObject handle to edit6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit6 as text% str2double(get(hObject,'String')) returns contents of edit6 as a double % --- Executes during object creation, after setting all properties.function edit6_CreateFcn(hObject, eventdata, handles)% hObject handle to edit6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

10

Page 13: Makalah Gerak

set(hObject,'BackgroundColor','white');end function EA1_Callback(hObject, eventdata, handles)% hObject handle to EA1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of EA1 as text% str2double(get(hObject,'String')) returns contents of EA1 as a double % --- Executes during object creation, after setting all properties.function EA1_CreateFcn(hObject, eventdata, handles)% hObject handle to EA1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end function edit8_Callback(hObject, eventdata, handles)% hObject handle to edit8 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit8 as text% str2double(get(hObject,'String')) returns contents of edit8 as a double % --- Executes during object creation, after setting all properties.function edit8_CreateFcn(hObject, eventdata, handles)% hObject handle to edit8 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end function edit9_Callback(hObject, eventdata, handles)% hObject handle to edit9 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB

11

Page 14: Makalah Gerak

% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit9 as text% str2double(get(hObject,'String')) returns contents of edit9 as a double % --- Executes during object creation, after setting all properties.function edit9_CreateFcn(hObject, eventdata, handles)% hObject handle to edit9 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end function edit10_Callback(hObject, eventdata, handles)% hObject handle to edit10 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit10 as text% str2double(get(hObject,'String')) returns contents of edit10 as a double % --- Executes during object creation, after setting all properties.function edit10_CreateFcn(hObject, eventdata, handles)% hObject handle to edit10 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end function edit12_Callback(hObject, eventdata, handles)% hObject handle to edit12 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit12 as text% str2double(get(hObject,'String')) returns contents of edit12 as a double

12

Page 15: Makalah Gerak

% --- Executes during object creation, after setting all properties.function edit12_CreateFcn(hObject, eventdata, handles)% hObject handle to edit12 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end % --- Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)myform = guidata(gcbo);mobila=str2double(get(myform.edit1,'string'));mobilb=str2double(get(myform.edit2,'string'));menita=mobila*0.2;menitb=mobila*0.4;menitc=mobila*0.6;menitd=mobila*0.8;menite=mobila;menitf=mobilb*0.2;menitg=mobilb*0.4;menith=mobilb*0.6;meniti=mobilb*0.8;menitj=mobilb;set(myform.edit3,'string',num2str(menita));set(myform.edit4,'string',num2str(menitb));set(myform.edit5,'string',num2str(menitc));set(myform.edit6,'string',num2str(menitd));set(myform.EA1,'string',num2str(menite));set(myform.edit8,'string',num2str(menitf));set(myform.edit9,'string',num2str(menitg));set(myform.edit10,'string',num2str(menith));set(myform.edit11,'string',num2str(meniti));set(myform.edit12,'string',num2str(menitj));% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % --- Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)myform = guidata(gcbo);mobila=str2double(get(myform.edit1,'string'));mobilb=str2double(get(myform.edit2,'string'));menita=mobila*0.2;menitb=mobila*0.4;menitc=mobila*0.6;menitd=mobila*0.8;menite=mobila;menitf=mobilb*0.2;menitg=mobilb*0.4;menith=mobilb*0.6;

13

Page 16: Makalah Gerak

meniti=mobilb*0.8;menitj=mobilb;interval=menitb-menita;interval2=menitg-menitf;x=menita:interval:menite;y=menitf:interval2:menitj;grafikmobila=[(menita) (menitb) (menitc) (menitd) (menite);(menitf) (menitg) (menith) (meniti) (menitj)];grafikmobilb=[(menitf) (menitg) (menith) (meniti) (menitj)];axes(handles.grafik);bar(grafikmobila,'group')axes(handles.grafik2);bar3(grafikmobila,'group') % hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)

Akhir Dari Code

14

Page 17: Makalah Gerak

Screen Shot gerak.fig (GUI)1. Tampilan dari simulasi

2. Input Data

15

Input harus angka

Page 18: Makalah Gerak

3. Lalu klik tombol “Hitung”

4. Maka akan muncul hasilnya

5. Bila ingin melihat grafiknya maka klik tombol “Grafik”

6. Hasil dari grafik berupa grafik batang

16

Page 19: Makalah Gerak

7. Hasil keseluruhan

17