Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

TUGAS 5

PRAKTIKUM PENGOLAHAN SINYAL DIGITAL

NAMA : NAUFAL ALIF FAUZAN

NIM : 1167070058

KELAS : TE-6B2

HARI, TANGGAL : Kamis, 9 April 2019

WAKTU : 12.40-14.00

TEKNIK ELEKTRO

FAKULTAS SAINS DAN TEKNOLOGI

UIN SUNAN GUNUNG DJATI BANDUNG

2019
TUGAS 5

PRAKTIKUM PENGOLAHAN SINYAL DIGITAL


NAUFAL ALIF FAUZAN/1167070058/TE-6B/ Kamis, 9 April 2019
Email : e.naufal.naf@gmail.com
Percobaan 1
% Last Modified by GUIDE v2.5 09-May-
Buatlah tampilan GUI pembangkitan sinyal 2019 14:18:19
suara untuk frekuensi 262, 294, 330, 349, 392, % Begin initialization code - DO NOT
440, 494 dan 523 hz EDIT
gui_Singleton = 1;
Jawaban gui_State = struct('gui_Name',
mfilename, ...
'gui_Singleton',
function varargout = gui_Singleton, ...
RizalM_Modul31(varargin) 'gui_OpeningFcn',
% RIZALM_MODUL31 MATLAB code for @RizalM_Modul31_OpeningFcn, ...
RizalM_Modul31.fig 'gui_OutputFcn',
% RIZALM_MODUL31, by itself, @RizalM_Modul31_OutputFcn, ...
creates a new RIZALM_MODUL31 or raises 'gui_LayoutFcn', []
the existing , ...
% singleton*. 'gui_Callback',
% []);
% H = RIZALM_MODUL31 returns the if nargin && ischar(varargin{1})
handle to a new RIZALM_MODUL31 or the gui_State.gui_Callback =
handle to str2func(varargin{1});
% the existing singleton*. end
%
%
RIZALM_MODUL31('CALLBACK',hObject,event if nargout
Data,handles,...) calls the local [varargout{1:nargout}] =
% function named CALLBACK in gui_mainfcn(gui_State, varargin{:});
RIZALM_MODUL31.M with the given input else
arguments. gui_mainfcn(gui_State,
% varargin{:});
% end
RIZALM_MODUL31('Property','Value',...) % End initialization code - DO NOT EDIT
creates a new RIZALM_MODUL31 or raises
the
% existing singleton*. Starting % --- Executes just before
from the left, property value pairs are RizalM_Modul31 is made visible.
% applied to the GUI before function
RizalM_Modul31_OpeningFcn gets called. RizalM_Modul31_OpeningFcn(hObject,
An eventdata, handles, varargin)
% unrecognized property name or % This function has no output args, see
invalid value makes property OutputFcn.
application % hObject handle to figure
% stop. All inputs are passed to % eventdata reserved - to be defined
RizalM_Modul31_OpeningFcn via varargin. in a future version of MATLAB
% % handles structure with handles and
% *See GUI Options on GUIDE's user data (see GUIDATA)
Tools menu. Choose "GUI allows only % varargin command line arguments to
one RizalM_Modul31 (see VARARGIN)
% instance to run (singleton)".
% % Choose default command line output
% See also: GUIDE, GUIDATA, GUIHANDLES for RizalM_Modul31
handles.output = hObject;
% Edit the above text to modify the
response to help RizalM_Modul31 % Update handles structure
guidata(hObject, handles); % eventdata reserved - to be defined
in a future version of MATLAB
% UIWAIT makes RizalM_Modul31 wait for % handles empty - handles not
user response (see UIRESUME) created until after all CreateFcns
% uiwait(handles.figure1); called

% Hint: edit controls usually have a


% --- Outputs from this function are white background on Windows.
returned to the command line. % See ISPC and COMPUTER.
function varargout = if ispc &&
RizalM_Modul31_OutputFcn(hObject, isequal(get(hObject,'BackgroundColor'),
eventdata, handles) get(0,'defaultUicontrolBackgroundColor'
% varargout cell array for returning ))
output args (see VARARGOUT);
% hObject handle to figure set(hObject,'BackgroundColor','white');
% eventdata reserved - to be defined end
in a future version of MATLAB
% handles structure with handles and
user data (see GUIDATA) Gambar
1. 262 Hz
% Get default command line output from
handles structure
varargout{1} = handles.output;

% --- Executes on button press in play.


function play_Callback(hObject,
eventdata, handles)
fs=8000;
f=get(handles.frek,'string');
frek=str2num(f);
t=0:1/fs:0.25;
sinyal=sin(2*pi*frek*t);
sound(sinyal,fs);
plot(sinyal);
% hObject handle to play (see GCBO)
% eventdata reserved - to be defined
in a future version of MATLAB
% handles structure with handles and 2. 294 Hz
user data (see GUIDATA)

function frek_Callback(hObject,
eventdata, handles)
% hObject handle to frek (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 frek as text
%
str2double(get(hObject,'String'))
returns contents of frek as a double

% --- Executes during object creation,


after setting all properties.
function frek_CreateFcn(hObject,
eventdata, handles)
% hObject handle to frek (see GCBO)
3. 330 Hz

6. 440 hz

4. 349 Hz

7. 494 Hz

5. 392 Hz

8. 523 Hz
Percobaan 2 'gui_OpeningFcn',
@RizalM_Modul32_OpeningFcn, ...
'gui_OutputFcn',
Buatlah tampilan GUI pembangkitan sinyal @RizalM_Modul32_OutputFcn, ...
suara untuk frekuensi c=262, d=294, e=330, 'gui_LayoutFcn', []
f=349, g=392, a=440, b=494 dan c1=523 hz , ...
'gui_Callback',
[]);
Jawaban if nargin && ischar(varargin{1})
function varargout = gui_State.gui_Callback =
RizalM_Modul32(varargin) str2func(varargin{1});
% RIZALM_MODUL32 MATLAB code for end
RizalM_Modul32.fig
% RIZALM_MODUL32, by itself,
creates a new RIZALM_MODUL32 or raises if nargout
the existing [varargout{1:nargout}] =
% singleton*. gui_mainfcn(gui_State, varargin{:});
% else
% H = RIZALM_MODUL32 returns the gui_mainfcn(gui_State,
handle to a new RIZALM_MODUL32 or the varargin{:});
handle to end
% the existing singleton*. % End initialization code - DO NOT EDIT
%
%
RIZALM_MODUL32('CALLBACK',hObject,event % --- Executes just before
Data,handles,...) calls the local RizalM_Modul32 is made visible.
% function named CALLBACK in function
RIZALM_MODUL32.M with the given input RizalM_Modul32_OpeningFcn(hObject,
arguments. eventdata, handles, varargin)
% % This function has no output args, see
% OutputFcn.
RIZALM_MODUL32('Property','Value',...) % hObject handle to figure
creates a new RIZALM_MODUL32 or raises % eventdata reserved - to be defined
the in a future version of MATLAB
% existing singleton*. Starting % handles structure with handles and
from the left, property value pairs are user data (see GUIDATA)
% applied to the GUI before % varargin command line arguments to
RizalM_Modul32_OpeningFcn gets called. RizalM_Modul32 (see VARARGIN)
An
% unrecognized property name or % Choose default command line output
invalid value makes property for RizalM_Modul32
application handles.output = hObject;
% stop. All inputs are passed to
RizalM_Modul32_OpeningFcn via varargin. % Update handles structure
% guidata(hObject, handles);
% *See GUI Options on GUIDE's
Tools menu. Choose "GUI allows only
one % UIWAIT makes RizalM_Modul32 wait for
% instance to run (singleton)". user response (see UIRESUME)
% % uiwait(handles.figure1);
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the % --- Outputs from this function are
response to help RizalM_Modul32 returned to the command line.
function varargout =
% Last Modified by GUIDE v2.5 09-May- RizalM_Modul32_OutputFcn(hObject,
2019 14:29:33 eventdata, handles)
% varargout cell array for returning
output args (see VARARGOUT);
% Begin initialization code - DO NOT % hObject handle to figure
EDIT % eventdata reserved - to be defined
gui_Singleton = 1; in a future version of MATLAB
gui_State = struct('gui_Name', % handles structure with handles and
mfilename, ... user data (see GUIDATA)
'gui_Singleton',
gui_Singleton, ...
% Get default command line output from % eventdata reserved - to be defined
handles structure in a future version of MATLAB
varargout{1} = handles.output; % handles structure with handles and
user data (see GUIDATA)

% --- Executes on button press in c.


function c_Callback(hObject, eventdata, % --- Executes on button press in a.
handles) function a_Callback(hObject, eventdata,
fs=8000; handles)
f= 262; fs=8000;
t=0:1/fs:0.25; f= 440;
sinyal =sin (2*pi*f*t); t=0:1/fs:0.25;
sound(sinyal,fs); sinyal =sin (2*pi*f*t);
plot(sinyal); sound(sinyal,fs);
% hObject handle to c (see GCBO) plot(sinyal);
% eventdata reserved - to be defined % hObject handle to a (see GCBO)
in a future version of MATLAB % eventdata reserved - to be defined
% handles structure with handles and in a future version of MATLAB
user data (see GUIDATA) % handles structure with handles and
user data (see GUIDATA)

% --- Executes on button press in f.


function f_Callback(hObject, eventdata, % --- Executes on button press in b.
handles) function b_Callback(hObject, eventdata,
fs=8000; handles)
f= 349; fs=8000;
t=0:1/fs:0.25; f= 494;
sinyal =sin (2*pi*f*t); t=0:1/fs:0.25;
sound(sinyal,fs); sinyal =sin (2*pi*f*t);
plot(sinyal); sound(sinyal,fs);
% hObject handle to f (see GCBO) plot(sinyal);
% eventdata reserved - to be defined % hObject handle to b (see GCBO)
in a future version of MATLAB % eventdata reserved - to be defined
% handles structure with handles and in a future version of MATLAB
user data (see GUIDATA) % handles structure with handles and
user data (see GUIDATA)

% --- Executes on button press in d.


function d_Callback(hObject, eventdata, % --- Executes on button press in g.
handles) function g_Callback(hObject, eventdata,
fs=8000; handles)
f= 294; fs=8000;
t=0:1/fs:0.25; f= 392;
sinyal =sin (2*pi*f*t); t=0:1/fs:0.25;
sound(sinyal,fs); sinyal =sin (2*pi*f*t);
plot(sinyal); sound(sinyal,fs);
% hObject handle to d (see GCBO) plot(sinyal);
% eventdata reserved - to be defined % hObject handle to g (see GCBO)
in a future version of MATLAB % eventdata reserved - to be defined
% handles structure with handles and in a future version of MATLAB
user data (see GUIDATA) % handles structure with handles and
user data (see GUIDATA)

% --- Executes on button press in e.


function e_Callback(hObject, eventdata, % --- Executes on button press in c1.
handles) function c1_Callback(hObject,
fs=8000; eventdata, handles)
f= 330; fs=8000;
t=0:1/fs:0.25; f= 523;
sinyal =sin (2*pi*f*t); t=0:1/fs:0.25;
sound(sinyal,fs); sinyal =sin (2*pi*f*t);
plot(sinyal); sound(sinyal,fs);
% hObject handle to e (see GCBO) plot(sinyal);
% hObject handle to c1 (see GCBO) 4. f
% eventdata reserved - to be defined
in a future version of MATLAB
% handles structure with handles and
user data (see GUIDATA)

Gambar
1. c

5. g

2. d

6. a

3. e

7. b
8. c1

You might also like