PROGRAM SIMULASI SINYAL CHIRP RADAR TUGAS AKHIR Diajukan untuk memenuhi salah satu syarat memperoleh gelar Sarjana Teknik pada Program Studi Teknik Elektro Fakultas Teknik Universitas Sanata Dharma Oleh : Nama : Tarsisius Agusta Dwi Handaru NIM : 025114013 PROGRAM STUDI TEKNIK ELEKTRO JURUSAN TEKNIK ELEKTRO FAKULTAS TEKNIK UNIVERSITAS SANATA DHARMA YOGYAKARTA 2007
100
Embed
PROGRAM SIMULASI SINYAL CHIRP RADARrepository.usd.ac.id/28386/2/025114013_Full.pdf · PROGRAM SIMULASI SINYAL CHIRP RADAR TUGAS AKHIR Diajukan untuk memenuhi salah satu syarat memperoleh
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
PROGRAM SIMULASI SINYAL CHIRP RADAR
TUGAS AKHIR
Diajukan untuk memenuhi salah satu syarat
memperoleh gelar Sarjana Teknik pada
Program Studi Teknik Elektro
Fakultas Teknik Universitas Sanata Dharma
Oleh :
Nama : Tarsisius Agusta Dwi Handaru
NIM : 025114013
PROGRAM STUDI TEKNIK ELEKTRO
JURUSAN TEKNIK ELEKTRO
FAKULTAS TEKNIK
UNIVERSITAS SANATA DHARMA
YOGYAKARTA
2007
i
PROGRAM SIMULASI SINYAL CHIRP RADAR
TUGAS AKHIR
Diajukan untuk memenuhi salah satu syarat
memperoleh gelar Sarjana Teknik pada
Program Studi Teknik Elektro
Fakultas Teknik Universitas Sanata Dharma
Oleh :
Nama : Tarsisius Agusta Dwi Handaru
NIM : 025114013
PROGRAM STUDI TEKNIK ELEKTRO
JURUSAN TEKNIK ELEKTRO
FAKULTAS TEKNIK
UNIVERSITAS SANATA DHARMA
YOGYAKARTA
2007
ii
SIMULATION OF RADAR CHIRP SIGNAL
FINAL PROJECT
In partial fulfillment of the requirements for the degree of
Sarjana Teknik
Electrical Engineering Study Program
Engineering Faculty Sanata Dharma University
By :
Name : Tarsisius Agusta Dwi Handaru
Student Number : 025114013
ELECTRICAL ENGINEERING STUDY PROGRAM
ELECTRICAL ENGINEERING DEPARTMENT
ENGINEERING FACULTY
SANATA DHARMA UNIVERSITY
YOGYAKARTA
2007
HALAMAN MOTO DAN PERSEMBAHAN
“... Dan ketahuilah, Aku menyertai kamu senantiasa sampai kepada akhir zaman.”
(Matius 28:20)
“ ☺ Hadapi dengan senyuman, semua yang terjadi biar terjadi.
Hadapi dengan tenang jiwa, semua akan baik-baik saja. ☺ ”
Tugas Akhir ini kupersembahkan kepada : Bapa, Putera, dan Roh Kudus
Ibu Alfonsa Maria Yul Wulandari di surga Bapak Matheus Gumulya Semua saudari-saudaraku
Lenta Maniez-ku
vi
MAN WITH
FOR OTHERS
INTISARI
Radar (Radio Detection and Ranging) merupakan suatu sistem yang menggunakan gelombang elektromagnetik untuk mendeteksi jarak dan kecepatan suatu target baik di udara maupun di darat. Sistem radar menggunakan sinyal chirp untuk mengetahui jarak suatu target. Chirp merupakan sebuah sinyal dengan kenaikan frekuensi atau penurunan frekuensi terhadap waktu, sehingga termasuk di dalam aplikasi frequency modulation. Program simulasi sinyal chirp ini bertujuan untuk membangkitkan sinyal chirp. Sinyal chirp tersebut akan disimulasikan juga untuk menentukan jarak suatu target diam pada radar.
Program akan membangkitkan sinyal chirp dengan parameter-parameter Time Bandwidth Product, oversampling factor, dan sampling frequency. Sinyal chirp terbentuk dalam domain waktu diskret. Sinyal echo merupakan pergeseran dari pulsa sinyal chirp yang terpengaruh oleh noise. Kemudian matched filter akan menghilangkan noise dengan proses konvolusi antara sinyal chirp dan echo dengan impulse matched filter. Radar melakukan korelasi pada kedua sinyal keluaran matched filter, sehingga dapat mengetahui waktu tunda dan jarak suatu target.
Program simulasi telah berhasil dalam menentukan jarak target. Kinerja radar menunjukkan bahwa Time Bandwidth Product dan oversampling factor merupakan nilai yang dominan untuk menentukan pembentukan sinyal chirp, sedangkan sampling frequency dan nilai pergeseran sinyal merupakan nilai yang dominan untuk menentukan jarak suatu target. Semakin besar nilai Time Bandwidth Product dan oversampling factor, lebar pulsa sinyal chirp semakin lebar. Semakin besar nilai sampling frequency, jarak semakin kecil dan nilai pergeseran sama dengan nilai waktu tunda antara sinyal chirp dan echo. Radar memiliki kemampuan mendeteksi jarak terjauh suatu target saat nilai pergeseran maksimal.
Kata kunci : chirp, radar, echo, Time Bandwidth Product, oversampling factor, sampling frequency.
vii
ABSTRACT
Radar (Radio Detection and Ranging) is a system that uses electromagnetic waves to detect the range and speed of objects in the land and in the air. Radar system use chirp signal to know range an object. A chirp is a signal which the frequency increases or decreases with time, so include in frequency modulation. The purpose simulation of chirp signal is to generate chirp signal. That chirp signal will simulate to find the range an unmoved object in radar.
The simulation program will generate chirp signal with Time Bandwidth Product, oversampling factor, dan sampling frequency parameters. The chirp signal has to be represented in discrete time signal. Echo signal is the shifted of chirp signal and have noise effect. Then, matched filter will eliminate this noise with convolution between chirp and echo signal use impulse matched filter. Both of signal as output matched filter will be correlation to know about time delay and range an object.
The simulation program succeeded to find object’s range. Radar performance’s indicated that Time Bandwidth Product and oversampling factor are dominant to build chirp signal, sampling frequency and amount of the shifted pulse are dominant to find range an object. High value Time Bandwidth Product and oversampling factor increase the length of chirp signal. High sampling frequency decrease an object range and amount of the shifted pulse is the same as time delay between chirp and echo signal. Radar has ability to detect maximum range an object when the amount of the shifted pulse is maximal. Keyword : chirp, radar, echo, Time Bandwidth Product, oversampling factor,
sampling frequency.
viii
KATA PENGANTAR
Puji dan syukur kepada Tuhan Yang Maha Esa yang telah memberikan
berkat dan rahmat-Nya sehingga penulisan Tugas Akhir ini dapat diselesaikan
dengan baik. Tugas akhir ini berjudul “Program Simulasi Sinyal Chirp Radar”.
Penulis mengangkat topik tersebut karena sinyal chirp merupakan salah satu
bagian yang terpenting dalam sistem radar, terutama untuk menentukan jarak
suatu target. Selain itu, pengetahuan, pembahasan serta penggunaan sinyal chirp
selama ini masih belum maksimal, terlebih dalam sistem radar.
Penulis menyadari bahwa begitu banyak pihak yang telah memberikan
perhatian, doa dan bantuan selama proses penulisan tugas akhir dari awal hingga
akhir. Oleh karena itu penulis ingin mengucapkan terima kasih antara lain kepada:
Wuri dan yang lain-lainya. Terima kasih semuanya atas persahabatan, hiruk-
pikuk, tawa-canda, ejek-ejekan, dan kerjasamanya selama ± 5 tahun kuliah
di TE. Semoga menjadi sebuah kisah klasik untuk masa depan.
10. Teman-teman angkatan 1999-2001 dan 2003 atas tukar ide-solusi,
informasi, kerjasamanya.
11. Teman-teman Alumni De Britto yang setiap kali berjumpa selalu
menanyakan, “Sudah lulus belum ?”.
x
12. Teman-teman Kotabaru terutama komunitas Perpustakaan dan KBT-Kobar.
13. Karyawan-karyawati di kampus mulai dari Sekretariat, Laboran, CS,
Satpam hingga Petugas Parkir.
14. Dan seluruh pihak yang telah ambil bagian dalam proses penulisan tugas
akhir ini yang terlalu banyak jika disebutkan satu-persatu.
Dengan rendah hati penulis menyadari bahwa tugas akhir ini masih jauh dari
sempurna, oleh karena itu berbagai kritik dan saran yang membangun untuk
perbaikan tugas akhir ini sangat diharapkan. Akhir kata, semoga tugas akhir ini
dapat bermanfaat bagi semua pihak.
Yogyakarta, 15 Agustus 2007
Penulis
xi
DAFTAR ISI HALAMAN JUDUL ................................................................................ i
LEMBAR PERSETUJUAN .................................................................. iii
HALAMAN PENGESAHAN .............................................................. iv
HALAMAN PERNYATAAN KEASLIAN KARYA ................... v
HALAMAN MOTO DAN PERSEMBAHAN ................................ vi
INTISARI .................................................................................................... vii
ABSTRACT ................................................................................................ viii
KATA PENGANTAR.............................................................................. ix
DAFTAR ISI ............................................................................................... xii
DAFTAR GAMBAR ................................................................................ xiv
DAFTAR TABEL ..................................................................................... xvi BAB I PENDAHULUAN 1.1 Latar belakang masalah...................................................... 1
1.6 Sistematika penulisan......................................................... 4 BAB II DASAR TEORI 2.1 Korelasi ............................................................................. 5
2.3.3 Parameter-parameter yang diukur oleh radar .................... 12
2.3.4 Sinyal dalam sistem radar ................................................. 13
2.3.5 Sinyal chirp ........................................................................ 15
BAB III PERANCANGAN PROGRAM SIMULASI SINYAL
CHIRP RADAR 3.1 Proses keseluruhan program .............................................. 20
3.2 Tahap-tahap pemrograman simulasi sinyal chirp .............. 20
3.2.1 Proses pemeriksaan masukan ............................................ 20
3.2.2 Proses pembentukan sinyal chirp....................................... 22
3.2.3 Proses perancangan sinyal echo ......................................... 23
3.2.4 Proses perancangan keluaran matched filter ...................... 25
3.2.5 Proses menghitung jarak suatu target................................. 26
3.3 Tampilan program.............................................................. 27 BAB IV HASIL DAN PEMBAHASAN 4.1 Tampilan program.............................................................. 30
4.2 Pembahasan hasil program................................................. 36
4.3 Hubungan antara Time Bandwidth Product dan
Sampling Frequency sinyal chirp dengan
Range suatu target .............................................................. 42
4.4 Hubungan antara Oversampling Factor dan
Amount of the shifted pulse dengan
Range suatu target ............................................................. 47
4.5 Pembahasan Maximum Range pada sistem radar.............. 52 BAB V KESIMPULAN DAN SARAN 5.1 Kesimpulan ........................................................................ 53
5.2 Saran................................................................................... 54 DAFTAR PUSTAKA ............................................................................. 55
%Fungsi untuk program pembuka function varargout = cover(varargin) % COVER M-file for cover.fig % COVER, by itself, creates a new COVER or raises the existing % singleton*. % % H = COVER returns the handle to a new COVER or the handle to % the existing singleton*. % % COVER('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in COVER.M with the given input arguments. % % COVER('Property','Value',...) creates a new COVER or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before cover_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to cover_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 cover % Last Modified by GUIDE v2.5 15-Jun-2007 03:40:55 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @cover_OpeningFcn, ... 'gui_OutputFcn', @cover_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 cover is made visible. function cover_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 cover (see VARARGIN)
Listing Program 2
% Choose default command line output for cover handles.output = hObject; axes(handles.logo); imshow ('USD.JPG'); % Update handles structure guidata(hObject, handles); % UIWAIT makes cover wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = cover_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 push_start. function push_start_Callback(hObject, eventdata, handles) % hObject handle to push_start (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) delete(handles.figure1); range_detection; % --- Executes on button press in push_exit. function push_exit_Callback(hObject, eventdata, handles) % hObject handle to push_exit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) pilih = questdlg(['Do you want to quit ?'],... ['Quit ...'],... 'Yes','No','Yes'); if strcmp(pilih,'No') return; end delete(handles.figure1);
Listing Program 3
%Fungsi untuk program utama function varargout = range_detection(varargin) % RANGE_DETECTION M-file for range_detection.fig % RANGE_DETECTION, by itself, creates a new RANGE_DETECTION or raises % the existing singleton*. % % H = RANGE_DETECTION returns the handle to a new RANGE_DETECTION or % the handle to the existing singleton*. % % RANGE_DETECTION('CALLBACK',hObject,eventData,handles,...) calls the % local function named CALLBACK in RANGE_DETECTION.M with the given % input arguments. % % RANGE_DETECTION('Property','Value',...) creates a new % RANGE_DETECTION or raises the existing singleton*. Starting from % the left, property value pairs are applied to the GUI before % range_detection_OpeningFunction gets called. An unrecognized % property name or invalid value makes property application stop. All % inputs are passed to range_detection_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 range_detection % Last Modified by GUIDE v2.5 26-Jun-2007 21:38:52 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @range_detection_OpeningFcn, ... 'gui_OutputFcn', @range_detection_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 range_detection is made visible. function range_detection_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
Listing Program 4
% command line arguments to range_detection (see VARARGIN) % Choose default command line output for range_detection handles.output = hObject; set(handles.menu_save,'enable','off'); set(handles.menu_print,'enable','off'); set(handles.push_legend,'enable','off'); set(handles.push_zoomin,'enable','off'); set(handles.push_zoomout,'enable','off'); set(handles.pushshift,'enable','off'); set(handles.push_point,'enable','off'); set(handles.push_grid,'enable','off'); set(handles.text14,'enable','off'); set(handles.text16,'enable','off'); set(handles.text17,'enable','off'); set(handles.max_shift,'enable','off'); set(handles.max_range,'enable','off'); axes(handles.axes_signal); xlabel('Time Bandwidth Product * Oversampling Factor'); ylabel('Amplitude Signal'); axes(handles.axes_match); xlabel('Time Bandwidth Product * Oversampling Factor'); ylabel('Amplitude Signal'); axes(handles.axes_peak); xlabel('Peak'); ylabel('Location of Peak'); % Update handles structure guidata(hObject, handles); % UIWAIT makes range_detection wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = range_detection_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 selection change in popupmenu_fs. function popupmenu_fs_Callback(hObject, eventdata, handles) % hObject handle to popupmenu_fs (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 popupmenu_fs contents as % cell array
Listing Program 5
% contents{get(hObject,'Value')} returns selected item from % popupmenu_fs % --- Executes during object creation, after setting all properties. function popupmenu_fs_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu_fs (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 function input_tw_Callback(hObject, eventdata, handles) % hObject handle to input_tw (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 input_tw as text % str2double(get(hObject,'String')) returns contents of input_tw as % a double TW=str2double(get(handles.input_tw,'String')); % --- Executes during object creation, after setting all properties. function input_tw_CreateFcn(hObject, eventdata, handles) % hObject handle to input_tw (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 input_os_Callback(hObject, eventdata, handles) % hObject handle to input_os (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 input_os as text % str2double(get(hObject,'String')) returns contents of input_os as % a double os=str2double(get(handles.input_os,'String'));
Listing Program 6
% --- Executes during object creation, after setting all properties. function input_os_CreateFcn(hObject, eventdata, handles) % hObject handle to input_os (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 input_fs_Callback(hObject, eventdata, handles) % hObject handle to input_fs (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 input_fs as text % str2double(get(hObject,'String')) returns contents of input_fs as % a double fs=str2double(get(handles.input_fs,'String')); % --- Executes during object creation, after setting all properties. function input_fs_CreateFcn(hObject, eventdata, handles) % hObject handle to input_fs (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 input_ipp_Callback(hObject, eventdata, handles) % hObject handle to input_ipp (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 input_ipp as text % str2double(get(hObject,'String')) returns contents of input_ipp as % a double IPP=str2double(get(handles.input_ipp,'String')); % --- Executes during object creation, after setting all properties. function input_ipp_CreateFcn(hObject, eventdata, handles)
Listing Program 7
% hObject handle to input_ipp (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 input_l_Callback(hObject, eventdata, handles) % hObject handle to input_l (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 input_l as text % str2double(get(hObject,'String')) returns contents of input_l as a % double L=str2double(get(handles.input_l,'String')); % --- Executes during object creation, after setting all properties. function input_l_CreateFcn(hObject, eventdata, handles) % hObject handle to input_l (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 input_shift_Callback(hObject, eventdata, handles) % hObject handle to input_shift (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 input_shift as text % str2double(get(hObject,'String')) returns contents of input_shift % as a double Tg=str2double(get(handles.input_shift,'String')); % --- Executes during object creation, after setting all properties. function input_shift_CreateFcn(hObject, eventdata, handles) % hObject handle to input_shift (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles empty - handles not % created until after all CreateFcns called
Listing Program 8
% 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 input_noise_Callback(hObject, eventdata, handles) % hObject handle to input_noise (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 input_noise as text % str2double(get(hObject,'String')) returns contents of input_noise % as a double fn=str2double(get(handles.input_noise,'String')); % --- Executes during object creation, after setting all properties. function input_noise_CreateFcn(hObject, eventdata, handles) % hObject handle to input_noise (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 push_run. function push_run_Callback(hObject, eventdata, handles) % hObject handle to push_run (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) %mengambil dan memeriksa nilai data TWin=str2double(get(handles.input_tw,'string')); osin=str2double(get(handles.input_os,'string')); fsin=str2double(get(handles.input_fs,'string')); IPPin=str2double(get(handles.input_ipp,'string')); Lin=str2double(get(handles.input_l,'string')); Tgin=str2double(get(handles.input_shift,'string')); fnin=str2double(get(handles.input_noise,'string')); satuan=(get(handles.popupmenu_fs,'value')); if isnan(TWin) | TWin<=0 errordlg(... 'You must insert a positive number value in input Time Bandwidth Product !',...
Listing Program 9
'Bad Input','modal'); elseif isnan(osin) | osin<=0 errordlg(... 'You must insert a positive number value in input Oversampling Factor !',... 'Bad Input','modal'); elseif isnan(fsin) | fsin<=0 errordlg(... 'You must insert a positive number value in input Sampling Frequency !',... 'Bad Input','modal'); elseif isnan(IPPin) | IPPin<=0 errordlg(... 'You must insert a positive number value in input Interpulse Period !',... 'Bad Input','modal'); elseif isnan(Lin) | Lin<=0 errordlg(... 'You must insert a positive number value in input Number of Pulse !',... 'Bad Input','modal'); elseif isnan(Tgin) | Tgin<=0 errordlg(... 'You must insert a positive number value in input Amount of the shifted pulse !',... 'Bad Input','modal'); elseif isnan(fnin) | fnin<=0 errordlg(... 'You must insert a positive number value in input Noise Factor !',... 'Bad Input','modal'); end %mengatur frek sampling if fsin > 0 fsg=ganti(fsin,satuan); [nilai,s]=value(fsg); set(handles.input_fs,'string',nilai); set(handles.popupmenu_fs,'value',s); end %memeriksa masukan TW=TWin; os=osin; fn=fnin; [TW,os,fsg,IPP,L,Tg,fn]= cek(TWin,osin,fsg,IPPin,Lin,Tgin,fnin); %menentukan lebar pulsa sinyal chirp N=round(TW*os); %memeriksa banyaknya pergeseran maxTg = (IPP*L) - (IPP - N); if Tg > maxTg uiwait(errordlg(... 'A value in input amount of the shifted pulse > maksimum amount of the shifted pulse!',... 'Input error!!','modal')); prompt = {'Amount of the shifted pulse : '}; title = 'Input error!!'; num_lines = 1;
Listing Program 10
d=num2str(maxTg); default = {d}; options.Resize='on'; jawab = inputdlg(prompt,title,num_lines,default,options); if isempty(jawab) Tg=maxTg; else Tg=str2double(jawab); end end %membentuk sinyal chirp Ts=1/fsg; T=TW*os*Ts; W=TW/T; N=round(TW*os); n = [0:N-1]'; s = exp(j*pi* (W/T) *(n*Ts - T/2).^2 ); %persamaan sinyal chirp %membentuk deretan sinyal chirp TL=IPP*L ; matr=zeros(TL-(N-1),1); for i=1:L, matr(1+(i-1)*IPP)=1; end strans=conv(matr,s); %deretan sinyal chirp %menampilkan deretan sinyal chirp axes(handles.axes_signal); plot(real(strans)); hold on; xlabel('Time Bandwidth Product * Oversampling Factor'); ylabel('Amplitude Signal'); %membentuk sinyal echo for a = 1:length(strans), b = a - Tg; if b <= 0, geserecho(a) = 0; else geserecho(a) = strans(a - Tg); end end nois = awgn(geserecho,fn,'measured','db'); noise= nois + geserecho; %menampilkan sinyal echo axes(handles.axes_signal); plot(real(noise),'r'); hold off; legend('chirp signal','echo signal');
Listing Program 11
%matched filter h = exp(-j*pi* (W/T) *(n*Ts - T/2).^2 ); %tanggapan matched filter y = conv(s,h); %output matched filter recematch=conv(noise,h); %keluaran sinyal echo dari matched filter transmatch=conv(strans,h); %keluaran sinyal chirp dari matched filter %menampilkan sinyal keluaran matched filter axes(handles.axes_match); plot(real(transmatch)); hold on; xlabel('Time Bandwidth Product * Oversampling Factor'); ylabel('Amplitude Signal'); plot(real(recematch),'r'); hold off; legend('chirp signal','echo signal'); %mendeteksi puncak-puncak sinyal untuk puncak sinyal chirp [peaksorigsigmatch, origsigmatchlocs] = puncak(real(transmatch),L,0); %menampilkan lokasi puncak sinyal chirp axes(handles.axes_peak); stem(real(origsigmatchlocs)); hold on; xlabel('Peak'); ylabel('Location of Peak'); %untuk puncak sinyal echo peak=peaksorigsigmatch(1,1); [peaksrsigmatch, rsigmatchlocs] = puncak(real(recematch),L,peak); %menampilkan lokasi puncak sinyal echo axes(handles.axes_peak); stem(real(rsigmatchlocs),'r'); hold off; legend('chirp signal','echo signal'); %menentukan time delay timedelay = rsigmatchlocs(1,1) - origsigmatchlocs(1,1) ; %menentukan range range = (1/2)*(3*(10^8))*(timedelay)*(Ts); %menentukan maximum range maxrange = (1/2)*(3*(10^8))*(maxTg)*(1/(fsg)); set(handles.text14,'enable','on'); set(handles.text16,'enable','on'); set(handles.text17,'enable','on'); set(handles.max_shift,'enable','on'); set(handles.max_range,'enable','on'); set(handles.max_shift,'String',maxTg);
Listing Program 12
set(handles.max_range,'String',maxrange); set(handles.output_range,'String',range); set(handles.menu_save,'enable','on'); set(handles.menu_print,'enable','on'); set(handles.push_legend,'enable','on'); set(handles.push_zoomin,'enable','on'); set(handles.push_zoomout,'enable','on'); set(handles.pushshift,'enable','on'); set(handles.push_point,'enable','on'); set(handles.push_grid,'enable','on'); % --- Executes on button press in push_exit. function push_exit_Callback(hObject, eventdata, handles) % hObject handle to push_exit (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) pilih = questdlg(['Do you want to quit ',get(handles.figure1,'Name') ' ?'],... ['Quit ',get(handles.figure1,'Name') '...'],... 'Yes','No','Yes'); if strcmp(pilih,'No') return; end delete(handles.figure1); % --- Executes on selection change in popupmenu_range. function popupmenu_range_Callback(hObject, eventdata, handles) % hObject handle to popupmenu_range (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 popupmenu_range contents % as cell array % contents{get(hObject,'Value')} returns selected item from % popupmenu_range % --- Executes during object creation, after setting all properties. function popupmenu_range_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu_range (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 function output_range_Callback(hObject, eventdata, handles)
Listing Program 13
% hObject handle to output_range (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 output_range as text % str2double(get(hObject,'String')) returns contents of output_range % as a double % --- Executes during object creation, after setting all properties. function output_range_CreateFcn(hObject, eventdata, handles) % hObject handle to output_range (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 menu_program_Callback(hObject, eventdata, handles) % hObject handle to menu_program (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) % -------------------------------------------------------------------- function menu_new_Callback(hObject, eventdata, handles) % hObject handle to menu_new (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) %membuat figure baru atau membersihkan tampilan figure set(handles.input_tw,'string',''); set(handles.input_os,'string',''); set(handles.input_fs,'string',''); set(handles.input_ipp,'string',''); set(handles.input_l,'string',''); set(handles.input_shift,'string',''); set(handles.input_noise,'string',''); set(handles.output_range,'string',''); set(handles.max_shift,'string',''); set(handles.max_range,'string',''); set(handles.popupmenu_fs,'value',1); axes(handles.axes_signal); strans=0; noise=0; plot(real(strans));
Listing Program 14
plot(real(noise)); xlabel('Time Bandwidth Product * Oversampling Factor'); ylabel('Amplitude Signal'); set(gca,'XTickLabel',{''}); set(gca,'YTickLabel',{''}); axes(handles.axes_match); transmatch=0; recematch=0; plot(real(transmatch)); plot(real(recematch)); xlabel('Time Bandwidth Product * Oversampling Factor'); ylabel('Amplitude Signal'); set(gca,'XTickLabel',{''}); set(gca,'YTickLabel',{''}); axes(handles.axes_peak); origsigmatchlocs=0; rsigmatchlocs=0; plot(real(origsigmatchlocs)); plot(real(rsigmatchlocs)); xlabel('Peak'); ylabel('Location of Peak'); set(gca,'XTickLabel',{''}); set(gca,'YTickLabel',{''}); set(handles.menu_save,'enable','off'); set(handles.menu_print,'enable','off'); set(handles.push_legend,'enable','off'); set(handles.push_zoomin,'enable','off'); set(handles.push_zoomout,'enable','off'); set(handles.pushshift,'enable','off'); set(handles.push_point,'enable','off'); set(handles.push_grid,'enable','off'); set(handles.text14,'enable','off'); set(handles.text16,'enable','off'); set(handles.text17,'enable','off'); set(handles.max_shift,'enable','off'); set(handles.max_range,'enable','off'); % -------------------------------------------------------------------- function menu_open_Callback(hObject, eventdata, handles) % hObject handle to menu_open (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) sinyalchirp=guidata(gcbo); uiload; % -------------------------------------------------------------------- function menu_save_Callback(hObject, eventdata, handles) % hObject handle to menu_save (see GCBO) eventdata reserved - to be
Listing Program 15
% defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) uisave; % -------------------------------------------------------------------- function menu_print_Callback(hObject, eventdata, handles) % hObject handle to menu_print (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) printdlg(handles.figure1) % -------------------------------------------------------------------- function menu_exit_Callback(hObject, eventdata, handles) % hObject handle to menu_exit (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) pilih = questdlg(['Do you want to quit ',get(handles.figure1,'Name') ' ?'],... ['Quit ',get(handles.figure1,'Name') '...'],... 'Yes','No','Yes'); if strcmp(pilih,'No') return; end delete(handles.figure1); % -------------------------------------------------------------------- function menu_help_Callback(hObject, eventdata, handles) % hObject handle to menu_help (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) % -------------------------------------------------------------------- function menu_aboutprogram_Callback(hObject, eventdata, handles) % hObject handle to menu_aboutprogram (see GCBO) eventdata reserved - % to be defined in a future version of MATLAB handles structure with % handles and user data (see GUIDATA) programhelp; % -------------------------------------------------------------------- function menu_chirp_Callback(hObject, eventdata, handles) % hObject handle to menu_chirp (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) chirphelp; % -------------------------------------------------------------------- function menu_author_Callback(hObject, eventdata, handles) % hObject handle to menu_author (see GCBO) eventdata reserved - to be
Listing Program 16
% defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) author; % --- Executes on button press in push_legend. function push_legend_Callback(hObject, eventdata, handles) % hObject handle to push_legend (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) legend toggle; % --- Executes on button press in push_zoomin. function push_zoomin_Callback(hObject, eventdata, handles) % hObject handle to push_zoomin (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) zoom; % --- Executes on button press in push_zoomout. function push_zoomout_Callback(hObject, eventdata, handles) % hObject handle to push_zoomout (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) zoom out; pan off; % --- Executes on button press in pushshift. function pushshift_Callback(hObject, eventdata, handles) % hObject handle to pushshift (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) pan; % --- Executes on button press in push_point. function push_point_Callback(hObject, eventdata, handles) % hObject handle to push_point (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) datacursormode; % --- Executes on button press in push_grid. function push_grid_Callback(hObject, eventdata, handles) % hObject handle to push_grid (see GCBO) eventdata reserved - to be % defined in a future version of MATLAB handles structure with handles % and user data (see GUIDATA) grid minor;
Listing Program 17
%Fungsi ganti berfungsi untuk merubah nilai pada tampilan frekuensi %sampling function satu = ganti(n,x) if x == 1 satu = n*10^6; elseif x == 2 satu = n*10^9; end %Fungsi ganti berfungsi untuk merubah nilai satuan frekuensi sampling function [nilai,satuan]=value(input) if input > 999999 & input < 1000000000 nilai = input/1000000; satuan = 1; else nilai = input/1000000000; satuan = 2; end %Fungsi cek berfungsi untuk memeriksa masukan-masukan program supaya %program dapat berjalan function [tw,os,fs,ipp,l,tg,fn]=cek(twc,osc,fsc,ippc,lc,tgc,fnc) tw=twc; os=osc; fs=fsc; fn=fnc; if ippc > 0 & lc > 0 & tgc > 0 & fnc > 0; ippa=(ippc-ceil(ippc)); if ippa == 0 ipp=ippc; else ippa < 0 uiwait(errordlg(... 'You must insert a positive number value in input Interpulse Period !',... 'Input error!!','modal')); prompt = {'Interpulse Period: '}; title = 'Input error!!'; num_lines = 1; a=num2str(ceil(ippc)-1); default = {a}; options.Resize='on'; jawabipp = inputdlg(prompt,title,num_lines,default,options); if isempty(jawabipp) ipp=(ceil(ippc)-1); else ipp=str2double(jawabipp); end end
Listing Program 18
if ippc < (twc*osc) uiwait(errordlg(... 'Minimum value for Interpulse Period is Time Bandwidth Product * Oversampling factor !',... 'Input error!!','modal')); prompt = {'Interpulse Period: '}; title = 'Input error!!'; num_lines = 1; b=num2str(twc*osc); default = {b}; options.Resize='on'; jawabipp = inputdlg(prompt,title,num_lines,default,options); if isempty(jawabipp) ipp=(twc*osc); else ipp=str2double(jawabipp); end end la=lc-ceil(lc); if la ==0 l=lc; else la < 0 uiwait(errordlg('You must insert a positive number value in Number of Pulse!',... 'Input error!!','modal')); prompt = {'Number of Pulse : '}; title = 'Input error!!'; num_lines = 1; c=num2str(ceil(lc)-1); default = {c}; options.Resize='on'; jawabl = inputdlg(prompt,title,num_lines,default,options); if isempty(jawabl) l=(ceil(lc)-1); else l=str2double(jawabl); end end if lc < 2 uiwait(errordlg('Minimum value for number of pulse is 2 !','Input error!!','modal')); prompt = {'Interpulse Period: '}; title = 'Input error!!'; num_lines = 1; default = {'2'}; options.Resize='on'; jawabl = inputdlg(prompt,title,num_lines,default,options); if isempty(jawabl) l=2; else l=str2double(jawabl); end end tga=tgc-ceil(tgc);
Listing Program 19
if tga == 0 tg=tgc; else tga < 0 uiwait(errordlg(... 'You must insert a positive number value in Amount of the shifted pulse!',... 'Input error!!','modal')); prompt = {'Amount of the shifted pulse'}; title = 'Input error!!'; num_lines = 1; e=num2str(ceil(tgc)-1); default = {e}; options.Resize='on'; jawabtg = inputdlg(prompt,title,num_lines,default,options); if isempty(jawabtg) tg=(ceil(tg)-1); else tg=str2double(jawabtg); end end end %Fungsi puncak berfungsi untuk mendeteksi puncak sinyal function [peaks,locs] = puncak(x,number,thresh) sortem = 0; [M,N] = size(x); if M==1 x = x(:); %-- make it a single column [M,N] = size(x); end for kk = 1:N mask = diff( sign( diff( [x(1,N)-1; x(:,N); x(M,N)-1] ) ) ); jkl = find( mask < 0 & x >= thresh); if (number>0 & length(jkl)>number) [tt,ii] = sort(-x(jkl)); jkl = jkl(ii(1:number)); jkl = sort(jkl); end if sortem [tt,ii] = sort(-x(jkl)) jkl = jkl(ii) end L = length(jkl); peaks(1:L,kk) = x(jkl); locs(1:L,kk) = jkl; end
LAMPIRAN B
TABEL-TABEL
HASIL PENGAMATAN PROGRAM
Tabel-Tabel Hasil Pengamatan Program
1
Saat nilai masukan : os = 4; IPP = 500; L = 4; Tg = 250; fn = 0,2 dB;