數(shù)字調(diào)制GUI仿真平臺的設計_第1頁
數(shù)字調(diào)制GUI仿真平臺的設計_第2頁
數(shù)字調(diào)制GUI仿真平臺的設計_第3頁
數(shù)字調(diào)制GUI仿真平臺的設計_第4頁
數(shù)字調(diào)制GUI仿真平臺的設計_第5頁
已閱讀5頁,還剩18頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

1、湖南工程學院課 程 設 計 任 務 書課程名稱 通信原理 題 目數(shù)字調(diào)制GUI仿真平臺的設計 專業(yè)班級: 電 信1202 學生姓名: 王 杰 學號: 201201030232 指導老師: 曾 志 剛 審 批: 任務書下達日期 2014年 月 日設 計 完成日期 年 月 日 設計內(nèi)容與設計要求一、設計內(nèi)容:利用MATLAB的GUI圖形界面設計工具設計數(shù)字調(diào)制的仿真平臺。1、熟悉GUI圖形界面的設計方法;2、利用MATLAB的GUI工具設計仿真實驗平臺。二、設計要求1、給出系統(tǒng)框圖以及仿真界面;2、給出各模塊的后臺程序設計;主要設計條件MATLAB軟件;說明書格式1. 課程設計封面;2. 任務書;

2、3. 說明書目錄;4. 設計基本原理與系統(tǒng)框圖。5. 各單元電路設計;6. 系統(tǒng)進行調(diào)試結果;7. 總結與體會;8. 附錄;9. 參考文獻。進度安排D1:下達設計任務書,介紹課題內(nèi)容與要求; D2:查找資料;D3D5:設計系統(tǒng)框圖、完成仿真界面的設計;D6D9:設置調(diào)試仿真參數(shù),設計后臺程序;D10D14:編寫并打印設計報告;D15:答辯。參考文獻1、樊昌信主編,通信原理,國防工業(yè)出版社。2、南利平主編,通信原理簡明教程,清華大學出版社。 3、浣喜明,通信原理實驗指導書,湖南工程學院。4、施曉紅,周佳精通GUI圖形界面編程,北京大學出版社。 目 錄一.緒論41 前言42 設計框圖5二.單元電路

3、51 二進制振幅鍵控(2ASK)52 二進制頻移鍵控(2FSK)63 二進制相移鍵控(2PSK)64 二進制差分相移鍵控(2DPSK)7三.GUI仿真71新建GUI72 2ASK 仿真83 2FSK仿真94 2PSK仿真115 2DPSK 仿真126 退出14四總結與體會15五.附錄16參考文獻23一.緒論1 前言目前數(shù)字信號在生活中越來越普遍,越來越受歡迎。低頻基帶信號只能適合短距離傳輸,要進行遠距離的傳輸需要調(diào)制到高頻,所以數(shù)字調(diào)制的設計越來越有必要性。本設計主要設計了我們生活中常見的調(diào)制方式,有2ASK、2FSK、2PSK、2DPSK。具體的設計會在單元電路中體現(xiàn),本設計的仿真是在MAT

4、LAB下GUI設計的。2 設計框圖載波信號乘 法 器2ASK判決2FSK判決2PSK2DPSKA(t)二.單元電路1 二進制振幅鍵控(2ASK)二進制振幅鍵控信號碼元表達式如下: 式中為載波的角頻率;A(t)是隨基帶調(diào)制信號變化的時振幅,即:A 當發(fā)送“1”時0 當發(fā)送“0”時本設計采用相乘電路,用基帶信號A(t)與載波相乘就得到已調(diào)信號。2 二進制頻移鍵控(2FSK)二進制頻移鍵控信號碼元的“1”和“0”分別用兩個不同頻率余弦波形來傳送。而其振幅和初相位不變。故其表達式如下: 當發(fā)送“1”時 當發(fā)送“0”時A為一常數(shù),表明碼元的包絡是矩形脈沖,本設計采用根據(jù)基帶信號判斷輸出不同頻率的余弦波。

5、3 二進制相移鍵控(2PSK)2PSK信號碼元的“0”和“1”分別用兩個不同的初相位來表示,而其振幅和頻率保持不變。故2PSK信號表達式如下: );式中,當發(fā)“0”時,。當發(fā)“1”時,。具體表達式如下: 當發(fā)送“0”時 當發(fā)送“1”時本設計采用選擇法,根據(jù)基帶信號來判斷選擇輸出不同初相位的余弦波。4 二進制差分相移鍵控(2DPSK)2DPSK是利用相鄰碼元載波相位的相對值表示基帶信號“0”和“1”的。現(xiàn)在用表示載波的初相位。用表示當前碼元與前一碼元的相位之差: 當發(fā)送“0”時 當發(fā)送“1”時則信號碼元可以表示為: 三.GUI仿真1新建GUI在MATLAB中打開GUI,進入后調(diào)用需要的圖標,然后

6、運行,得到m文件,然后再到m文件中修改每一個按鈕所指定的功能。新建的GUI如下圖:2 2ASK 仿真首先用get語句得到文字框中輸入的基帶信號,再計算基帶信號的的長度,再使用for語句進行循環(huán),并讓每個碼元與載波相乘得到調(diào)制信號并畫出其圖形,再畫出基帶信號的圖形與之作比較對照。源代碼如下:function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future versio

7、n of MATLAB% handles structure with handles and user data (see GUIDATA)input=get(handles.edit2,'String');n=size(input);for a=1:n(2) t=a-1:0.005:a;y=cos(2*pi*t-pi/2)*(input(a)-48);plot(t,y)hold ony1=input(a)-48;plot(t,y1,'r')legend('調(diào)制信號','基帶信號')xlabel('bit');y

8、label('幅值');title('2ASK')hold onylim(-1.4 1.8);endhold offgrid on% - Executes on button press in pushbutton2.仿真圖如下:3 2FSK仿真2FSK通過if語句來判斷輸出不同頻率的余弦波。源代碼如下:function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be de

9、fined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)?%?handles?structure?with?handles?and?user?data?(see?GUIDATA)?input=get(handles.edit1,'String');?input=get(handles.edit2,'String');n=size(input);for a=1:n(2) t=a-1:0.005:a; if input(a)-48=0

10、 y=cos(2*pi*t-pi/2); else y=cos(4*pi*t-pi/2); end plot(t,y) hold on y1=input(a)-48; plot(t,y1,'r')legend('調(diào)制信號','基帶信號')xlabel('bit');ylabel('幅值');title('2FSK')hold onylim(-1.4 1.8);endhold offgrid on仿真圖如下:4 2PSK仿真2PSK采用判決法產(chǎn)生當基帶信號為“0”時,初相位為0,當為“1”時,初相位為

11、180。源代碼如下:function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)input=get(handles.edit2,'String');n=size(input);for a=1:

12、n(2) t=a-1:0.005:a; if input(a)-48=0 y=cos(2*pi*t+pi/2); else y=cos(2*pi*t-pi/2); end plot(t,y) hold on y1=input(a)-48; plot(t,y1,'r')legend('調(diào)制信號','基帶信號')xlabel('bit');ylabel('幅值');title('2PSK')hold onylim(-1.4 1.8);endhold offgrid on仿真圖如下:5 2DPSK 仿真2

13、DPSK是通過前后碼元的相位差值來編碼輸出的,是把2PSK變?yōu)橄鄬Υa元。源代碼如下:function pushbutton4_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)input=get(handles.edit2,'Str

14、ing');n=size(input);dp=0;for a=1:n(2) t=a-1:0.005:a; dp=dp+pi*(input(a)-48); y=cos(2*pi*t+dp+pi/2); plot(t,y,'b') hold on y1=input(a)-48; plot(t,y1,'r')legend('調(diào)制信號','基帶信號')xlabel('bit');ylabel('幅值');title('2DPSK')hold onylim(-1.4 1.8);endh

15、old offgrid on仿真圖如下:6 退出退出GUI的代碼如下:function pushbutton5_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)exit;四總結與體會 在本次課程設計中,我學會了一種新技能就是使用MATLA

16、B中的GUI,之前只學會了MATLAB中如何編制M文件,現(xiàn)在能夠自己設計一個圖形化的界面,感覺十分有成就感。非常高興能有這樣的機會鍛煉自己的學習能力,一方面在鍛煉自己的學習能力的同時,也表現(xiàn)出了自己有能力學好一門新技能。學習的技能不只是看書,還有上網(wǎng)查資料,圖書館借資料,對資料的分類,整理與分析。通過此次課設,我感覺我的學習能力得到了大大的提升。五.附錄全過程源代碼如下:function varargout = untitled2(varargin)% UNTITLED2 M-file for untitled2.fig% UNTITLED2, by itself, creates a new

17、 UNTITLED2 or raises the existing% singleton*.% H = UNTITLED2 returns the handle to a new UNTITLED2 or the handle to% the existing singleton*.% UNTITLED2('CALLBACK',hObject,eventData,handles,.) calls the local% function named CALLBACK in UNTITLED2.M with the given input arguments.% UNTITLED2

18、('Property','Value',.) creates a new UNTITLED2 or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before untitled2_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All

19、inputs are passed to untitled2_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% Copyright 2002-2003 The MathWorks, Inc.% Edit the above text to modify the response to help

20、 untitled2% Last Modified by GUIDE v2.5 21-Dec-2014 15:55:06% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, . 'gui_Singleton', gui_Singleton, . 'gui_OpeningFcn', untitled2_OpeningFcn, . 'gui_OutputFcn', untitled2_Ou

21、tputFcn, . 'gui_LayoutFcn', , . 'gui_Callback', );if nargin && ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);endif nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT

22、% - Executes just before untitled2 is made visible.function untitled2_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 us

23、er data (see GUIDATA)% varargin command line arguments to untitled2 (see VARARGIN)% Choose default command line output for untitled2handles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes untitled2 wait for user response (see UIRESUME)% uiwait(handles.figure1);% -

24、 Outputs from this function are returned to the command line.function varargout = untitled2_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 st

25、ructure with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout1 = handles.output;% - Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - t

26、o be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)input=get(handles.edit2,'String');n=size(input);for a=1:n(2) t=a-1:0.005:a;y=cos(2*pi*t-pi/2)*(input(a)-48);plot(t,y)hold ony1=input(a)-48;plot(t,y1,'r')legend('調(diào)制信號','基帶

27、信號')xlabel('bit');ylabel('幅值');title('2ASK')hold onylim(-1.4 1.8);endhold offgrid on% - Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a fu

28、ture version of MATLAB% handles structure with handles and user data (see GUIDATA)?%?handles?structure?with?handles?and?user?data?(see?GUIDATA)?input=get(handles.edit1,'String');?input=get(handles.edit2,'String');n=size(input);for a=1:n(2) t=a-1:0.005:a; if input(a)-48=0 y=cos(2*pi*t

29、-pi/2); else y=cos(4*pi*t-pi/2); end plot(t,y) hold on y1=input(a)-48; plot(t,y1,'r')legend('調(diào)制信號','基帶信號')xlabel('bit');ylabel('幅值');title('2FSK')hold onylim(-1.4 1.8);endhold offgrid on% - Executes on button press in pushbutton3.function pushbutton3_C

30、allback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)input=get(handles.edit2,'String');n=size(input);for a=1:n(2) t=a-1:0.005:a; if input(a)-

31、48=0 y=cos(2*pi*t+pi/2); else y=cos(2*pi*t-pi/2); end plot(t,y) hold on y1=input(a)-48; plot(t,y1,'r')legend('調(diào)制信號','基帶信號')xlabel('bit');ylabel('幅值');title('2PSK')hold onylim(-1.4 1.8);endhold offgrid on% - Executes on button press in pushbutton5.funct

32、ion pushbutton4_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)input=get(handles.edit2,'String');n=size(input);dp=0;for a=1:n(2) t=a-1

33、:0.005:a; dp=dp+pi*(input(a)-48); y=cos(2*pi*t+dp+pi/2); plot(t,y,'b') hold on y1=input(a)-48; plot(t,y1,'r')legend('調(diào)制信號','基帶信號')xlabel('bit');ylabel('幅值');title('2DPSK')hold onylim(-1.4 1.8);endhold offgrid on% - Executes on button press in p

34、ushbutton4.function pushbutton5_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)exit;function edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handl

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論