Professional Documents
Culture Documents
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 achmaddzulfikar is made visible. function achmaddzulfikar_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % 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 achmaddzulfikar (see VARARGIN) % Choose default command line output for achmaddzulfikar handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes achmaddzulfikar wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = achmaddzulfikar_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;
% --- Executes on button press in Pushbutton1. function Pushbutton1_Callback(hObject, eventdata, handles) % 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) % Hint: get(hObject,'Value') returns toggle state of Pushbutton1
% --- Executes on selection change in mode. function mode_Callback(hObject, eventdata, handles) % hObject handle to mode (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns mode contents as cell array % contents{get(hObject,'Value')} returns selected item from mode
% --- Executes during object creation, after setting all properties. function mode_CreateFcn(hObject, eventdata, handles) % hObject handle to mode (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu 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 texit. function texit_Callback(hObject, eventdata, handles) % hObject handle to texit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close % Hint: get(hObject,'Value') returns toggle state of texit
% --- Executes on button press in togglebutton4. function togglebutton4_Callback(hObject, eventdata, handles) % hObject handle to togglebutton4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) N = 8; bit_stream = round(rand(1,N)); f = 3; fs = 100; a1 = 0;
a2 = 1; t = 0: 1/fs : 1; time = []; ASK_signal = []; Digital_signal = []; for ii = 1: 1: length(bit_stream) ASK_signal = [ASK_signal (bit_stream(ii)==0)*... sin(2*pi*f*t*a1) + (bit_stream(ii)==1)*sin(2*pi*f*t*a2)]; Digital_signal = [Digital_signal (bit_stream(ii)==0)*... zeros(1,length(t)) + (bit_stream(ii)==1)*ones(1,length(t))]; time = [time t]; t = t + 1; end subplot(2,1,1); plot(time,ASK_signal,'g','LineWidth',2); xlabel('Time'); ylabel('Amplitude'); title('ASK (Amplitude Shift Keying)'); axis([0 time(end) -1.5 1.5]); grid on; subplot(2,1,2); plot(time,Digital_signal,'b','LineWidth',2); xlabel('Time'); ylabel('Amplitude'); title('Digital Signal'); axis([0 time(end) -0.5 1.5]); grid on; % Hint: get(hObject,'Value') returns toggle state of togglebutton4
% --- Executes on button press in togglebutton5. function togglebutton5_Callback(hObject, eventdata, handles) % hObject handle to togglebutton5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) N = 8; bit_stream = round(rand(1,N)); f = 3; fs = 100; t = 0: 1/fs : 1; time = []; FSK_signal = []; Digital_signal = [];
for ii = 1: 1: length(bit_stream) FSK_signal = [FSK_signal (bit_stream(ii)==0)*... sin(2*pi*f*t*0.5) + (bit_stream(ii)==1)*sin(2*pi*f*t*(3/2))]; Digital_signal = [Digital_signal (bit_stream(ii)==0)*... zeros(1,length(t)) + (bit_stream(ii)==1)*ones(1,length(t))]; time = [time t]; t = t + 1; end subplot(2,1,1); plot(time,FSK_signal,'y','LineWidth',2); xlabel('Time'); ylabel('Amplitude'); title('FSK (Frequency Shift Keying)'); axis([0 time(end) -1.5 1.5]); grid on; subplot(2,1,2); plot(time,Digital_signal,'b','LineWidth',2); xlabel('Time'); ylabel('Amplitude'); title('Digital Signal'); axis([0 time(end) -0.5 1.5]); grid on; % Hint: get(hObject,'Value') returns toggle state of togglebutton5
% --- Executes on button press in togglebutton6. function togglebutton6_Callback(hObject, eventdata, handles) % hObject handle to togglebutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) N = 8; bit_stream = round(rand(1,N)); p1 = 0; p2 = pi; f = 3; fs = 100; t = 0: 1/fs : 1; time = []; PSK_signal = []; Digital_signal = []; for ii = 1: 1: length(bit_stream) PSK_signal = [PSK_signal (bit_stream(ii)==0)*... sin(2*pi*f*t + p1)+(bit_stream(ii)==1)*sin(2*pi*f*t + p2)];
Digital_signal = [Digital_signal (bit_stream(ii)==0)*... zeros(1,length(t)) + (bit_stream(ii)==1)*ones(1,length(t))]; time = [time t]; t = t + 1; end subplot(2,1,1); plot(time,PSK_signal,'r','LineWidth',2); xlabel('Time'); ylabel('Amplitude'); title('PSK (Phase Shift Keying)'); axis([0 time(end) -1.5 1.5]); grid on; subplot(2,1,2); plot(time,Digital_signal,'b','LineWidth',2); xlabel('Time'); ylabel('Amplitude'); title('Digital Signal'); axis([0 time(end) -0.5 1.5]); grid on;
B. Hasil
Tampilan Utama
Tampilan ASK
Tampilan FSK
Tampilan PSK