Beruflich Dokumente
Kultur Dokumente
Oleh :
I Gusti Ngurah Agung Dwi Jaya Putra (1304405054)
TUGAS 2.1
MENGHITUNG LUAS & KELILING LINGKARAN
Source Code
function varargout = lingkaran(varargin)
% LINGKARAN MATLAB code for lingkaran.fig
%
LINGKARAN, by itself, creates a new LINGKARAN or raises the existing
%
singleton*.
%
%
H = LINGKARAN returns the handle to a new LINGKARAN or the handle to
%
the existing singleton*.
%
%
LINGKARAN('CALLBACK',hObject,eventData,handles,...) calls the local
%
function named CALLBACK in LINGKARAN.M with the given input
arguments.
%
%
LINGKARAN('Property','Value',...) creates a new LINGKARAN or raises
the
%
existing singleton*. Starting from the left, property value pairs
are
%
applied to the GUI before lingkaran_OpeningFcn gets called. An
%
unrecognized property name or invalid value makes property
application
%
stop. All inputs are passed to lingkaran_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 lingkaran
% Last Modified by GUIDE v2.5 13-Oct-2016 23:21:16
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',
mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @lingkaran_OpeningFcn, ...
'gui_OutputFcn', @lingkaran_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
%
%
%
%
%
% --- Outputs from this function are returned to the command line.
function varargout = lingkaran_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 structure
varargout{1} = handles.output;
TUGAS 2.2
TRIGONOMETRI
Source Code
function varargout = trigonometri(varargin)
% TRIGONOMETRI MATLAB code for trigonometri.fig
%
TRIGONOMETRI, by itself, creates a new TRIGONOMETRI or raises the
existing
%
singleton*.
%
%
H = TRIGONOMETRI returns the handle to a new TRIGONOMETRI or the
handle to
%
the existing singleton*.
%
%
TRIGONOMETRI('CALLBACK',hObject,eventData,handles,...) calls the
local
%
function named CALLBACK in TRIGONOMETRI.M with the given input
arguments.
%
%
TRIGONOMETRI('Property','Value',...) creates a new TRIGONOMETRI or
raises the
%
existing singleton*. Starting from the left, property value pairs
are
%
applied to the GUI before trigonometri_OpeningFcn gets called. An
%
unrecognized property name or invalid value makes property
application
%
stop. All inputs are passed to trigonometri_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 trigonometri
% Last Modified by GUIDE v2.5 14-Oct-2016 00:08:07
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',
mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @trigonometri_OpeningFcn, ...
'gui_OutputFcn', @trigonometri_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
% --- Outputs from this function are returned to the command line.
function varargout = trigonometri_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 structure
varargout{1} = handles.output;
1
2
3
4
A=str2num(get(handles.edit1, 'string'));
r=str2num(get(handles.edit2, 'string'));
x=-10:0.1:10;
pilih=handles.pilih
radio button
switch handles.pilih
case 1
y=A*sin(T*x+r);
case 2
y=A*cos(T*x+r);
end
axes(handles.axes1);
a=0;
dan sumbu y
%jika
%maka
%jika
%maka
axes(handles.axes1);
a=0;
%membuat garis, seperti sumbu x
dan sumbu y
plot(x,y,'r', a,x,'b', x,a,'b');
grid on
% 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)