0% found this document useful (0 votes)
19 views11 pages

Tugasppt6 Ade.m

Uploaded by

spynsyh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views11 pages

Tugasppt6 Ade.m

Uploaded by

spynsyh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 11

function varargout = TugasPPT6_ADE(varargin)

% TUGASPPT6_IKKY MATLAB code for TugasPPT6_ADE.fig


% TUGASPPT6_ADE, by itself, creates a2 new TUGASPPT6_IKKY or raises the
existing
% singleton*.
%
% H = TUGASPPT6_IKKY returns the handle to a2 new TUGASPPT6_IKKY or the handle
to
% the existing singleton*.
%
% TUGASPPT6_IKKY('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TUGASPPT6_IKKY.M with the given input arguments.
%
% TUGASPPT6_IKKY('Property','Value',...) creates a2 new TUGASPPT6_IKKY or
raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before TugasPPT6_ikky_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to TugasPPT6_ikky_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 TugasPPT6_ikky

% Last Modified by GUIDE v2.5 20-Oct-2023 20:50:18

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @TugasPPT6_ikky_OpeningFcn, ...
'gui_OutputFcn', @TugasPPT6_ikky_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 TugasPPT6_ikky is made visible.


function TugasPPT6_ikky_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to TugasPPT6_ikky (see VARARGIN)

% Choose default command line output for TugasPPT6_ikky


handles.output = hObject;
% Update handles structure
guidata(hObject, handles);

% UIWAIT makes TugasPPT6_ikky wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = TugasPPT6_ikky_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure


varargout{1} = handles.output;

function edit8_Callback(hObject, eventdata, handles)


% hObject handle to edit8 (see GCBO)
% eventdata reserved - to be defined in a2 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 a2 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 a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 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 a2 future version of MATLAB
% 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 a2 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 a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a2 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 a2 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 a2 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 a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 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 jawab3.


function jawab3_Callback(hObject, eventdata, handles)
% hObject handle to jawab3 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Voa = str2double(get(handles.edit8, 'String'));
Uta = str2double(get(handles.edit9, 'String'));
ga = str2double(get(handles.edit10, 'String'));

hta = (Voa^2 - Uta^2) / (2 * ga);


ta = (Voa - Uta) / ga;

a = get(handles.a3, 'Value');
b = get(handles.b3, 'Value');

if a == 1
set(handles.edit13, 'String', sprintf('hta = %d m', hta));
set(handles.rumus3, 'String', 'hta = (Voa^2 - Uta^2) / (2 * ga)');
elseif b == 1
set(handles.edit13, 'String', sprintf('ta = %d s', ta));
set(handles.rumus3, 'String', 'ta = (Voa - Uta) / ga');
end

function edit13_Callback(hObject, eventdata, handles)


% hObject handle to edit13 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit13 as text


% str2double(get(hObject,'String')) returns contents of edit13 as a2 double

% --- Executes during object creation, after setting all properties.


function edit13_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 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 a2 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 a2 double

% --- Executes during object creation, after setting all properties.


function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 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 a2 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 a2 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 a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a2 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 a2 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 a2 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 a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit7_Callback(hObject, eventdata, handles)


% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit7 as text


% str2double(get(hObject,'String')) returns contents of edit7 as a2 double

% --- Executes during object creation, after setting all properties.


function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 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 jawab2.


function jawab2_Callback(hObject, eventdata, handles)
% hObject handle to jawab2 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Vob = str2double(get(handles.edit4, 'String'));
tb = str2double(get(handles.edit5, 'String'));
gb = str2double(get(handles.edit6, 'String'));
ho = str2double(get(handles.edit7, 'String'));

htb = 0.5 * gb * tb^2;


Vtb = gb * tb;

a = get(handles.a2, 'Value');
b = get(handles.b2, 'Value');

if a == 1
set(handles.edit12, 'String', sprintf('htb = %d m', htb));
set(handles.rumus2, 'String', 'htb = 1/2 * g * t^2');
elseif b == 1
set(handles.edit12, 'String', sprintf('Vtb = %d m/s', Vtb));
set(handles.rumus2, 'String', 'Vtb = g * tb');
end

function edit12_Callback(hObject, eventdata, handles)


% hObject handle to edit12 (see GCBO)
% eventdata reserved - to be defined in a2 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 a2 double

% --- 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 a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit1_Callback(hObject, eventdata, handles)


% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a2 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 a2 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 a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 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 a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text


% str2double(get(hObject,'String')) returns contents of edit2 as a2 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 a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 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 a2 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 a2 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 a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 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 jawab1.
function jawab1_Callback(hObject, eventdata, handles)
% hObject handle to jawab1 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Vo = str2double(get(handles.edit1, 'String'));
t = str2double(get(handles.edit2, 'String'));
g = str2double(get(handles.edit3, 'String'));

ht = (Vo * t) + (0.5 * g * t^2);

a = get(handles.a, 'Value');
b = get(handles.b, 'Value');

if a == 1
set(handles.edit11, 'String', sprintf('ht = %d m', ht));
set(handles.rumus1, 'String', 'ht = Vo*t + 1/2*g*t^2');
elseif b == 1
Ut = Vo + (g * t);
set(handles.edit11, 'String', sprintf('Ut = %d m/s', Ut));
set(handles.rumus1, 'String', 'Ut = Vo + g*t');
end

function edit11_Callback(hObject, eventdata, handles)


% hObject handle to edit11 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit11 as text


% str2double(get(hObject,'String')) returns contents of edit11 as a2 double

% --- Executes during object creation, after setting all properties.


function edit11_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 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 a2.


function a2_Callback(hObject, eventdata, handles)
% hObject handle to a2 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of a2

% --- Executes on button press in b2.


function b2_Callback(hObject, eventdata, handles)
% hObject handle to b2 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of b2

% --- Executes on button press in b2.


function radiobutton6_Callback(hObject, eventdata, handles)
% hObject handle to b2 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of b2

% --- Executes on button press in a2.


function radiobutton5_Callback(hObject, eventdata, handles)
% hObject handle to a2 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of a2

% --- Executes on button press in a3.


function a3_Callback(hObject, eventdata, handles)
% hObject handle to a3 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of a3

% --- Executes on button press in b3.


function b3_Callback(hObject, eventdata, handles)
% hObject handle to b3 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of b3

function rumus3_Callback(hObject, eventdata, handles)


% hObject handle to rumus3 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of rumus3 as text


% str2double(get(hObject,'String')) returns contents of rumus3 as a2 double

% --- Executes during object creation, after setting all properties.


function rumus3_CreateFcn(hObject, eventdata, handles)
% hObject handle to rumus3 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a2 white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function rumus2_Callback(hObject, eventdata, handles)


% hObject handle to rumus2 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of rumus2 as text


% str2double(get(hObject,'String')) returns contents of rumus2 as a2 double

% --- Executes during object creation, after setting all properties.


function rumus2_CreateFcn(hObject, eventdata, handles)
% hObject handle to rumus2 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function rumus1_Callback(hObject, eventdata, handles)


% hObject handle to rumus1 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of rumus1 as text


% str2double(get(hObject,'String')) returns contents of rumus1 as a2 double

% --- Executes during object creation, after setting all properties.


function rumus1_CreateFcn(hObject, eventdata, handles)
% hObject handle to rumus1 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a2 white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes during object creation, after setting all properties.


function jawab1_CreateFcn(hObject, eventdata, handles)
% hObject handle to jawab1 (see GCBO)
% eventdata reserved - to be defined in a2 future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% --- Executes on button press in pushbutton4.


function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close;

% --- Executes on button press in pushbutton5.


function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.edit1, 'String', '');
set(handles.edit2, 'String', '');
set(handles.edit3, 'String', '');
set(handles.edit11, 'String', '');
set(handles.rumus1, 'String', '');
set(handles.edit4, 'String', '');
set(handles.edit5, 'String', '');
set(handles.edit6, 'String', '');
set(handles.edit7, 'String', '');
set(handles.a, 'Value', 0);
set(handles.b, 'Value', 0);
set(handles.a2, 'Value', 0);
set(handles.b2, 'Value', 0);
set(handles.a3, 'Value', 0);
set(handles.b3, 'Value', 0);
set(handles.edit13, 'String', '');
set(handles.rumus3, 'String', '');
set(handles.edit12, 'String', '');
set(handles.rumus2, 'String', '');
set(handles.edit8, 'String', '');
set(handles.edit9, 'String', '');
set(handles.edit10, 'String', '');
set(handles.h, 'String', '');
set(handles.edit13, 'String', '');
set(handles.rumus3, 'String', '');
set(handles.edit8, 'String', '');
set(handles.edit9, 'String', '');
set(handles.edit10, 'String', '');
set(handles.a3, 'String', '');
set(handles.b3, 'String', '');

You might also like