




已阅读5页,还剩11页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
一、 课程设计的目的和任务“数字信号处理”课程是信息和通信工程专业必修的专业技术基础课程。课程以信号与系统作为研究对象,研究对信号进行各种处理和利用的技术。通过该课程的学习,学生应牢固掌握确定性信号和系统的分析方法、相关算法、系统实现等的相关知识的,借助于数字滤波器的设计及实现,学生可掌握数字系统的分析以及设计方法。 数字信号处理是理论性和工程性都很强的学科,本课程设计的目的就是使该课程的理论与工程应用的紧密结合, 使学生深入理解信号处理的内涵和实质。 本课程设计要求学生在理解信号处理的数学原理的基础上,应用计算机编程手段,实现一种信号分析或处理的设计,达到对所学内容融会贯通,综合各部分知识,按照题目要求独立设计完成。二、 课程设计的题目和要求1.课程设计题目:DTMF信号的产生与解码DTMF编解码广泛应用于数字电话拨号,简单通信协议等领域。目前所有的电话和传真机按键都是采用DTMF信号进行编码和传输的,该方案实际是利用模拟信号对数字符号进行编码。该编码方案共使用8个模拟频率对16个符号进行编码,这16个频率分为2个群:高音群和低音群。所以称为双音多频(Dual-Tone Multiple-Frequency)编码,其编码方案如图1。由图可知每个符号由一个高音频率和一个低音频率唯一确定。图1 DTMF信号编码方案对于该信号的产生,我们可以利用数字振荡器来完成。而对这些信号的检测,则可以利用DFT来完成。要注意的是,这里只需要计算16个频点的FFT输出,因此课本上介绍基2或基4算法并不是最优的,这时我们需要采用Goerzel算法完成所需的DFT。当然我们也可以用16个窄带带通滤波器完成,窄带带通滤波器的中心频率就是上述各频率。对窄带滤波器输出信号的输出做判决就可以得到解码的结果。2.设计要求编制程序生成并显示各符号的时域信号和对应的幅频曲线。编程模拟电话拨号过程:输入电话号码,生成各号码的时域信号,给时域信号加噪声,编程对含噪声的电话拨号信号进行解码。编制程序测试编解码程序的正确性。要列出表格,统计拨出的符号的解码成功率。独立完成设计,选择自己熟悉的编程语言编写程序,最好能给出图形界面。3、 设计过程与结果1.在MATLAB中建立一个GUI图形界面,将本课程设计所要实现的功能的一些工具拖进GUI界面,并根据需要修改各个工具的属性,建立的初始界面如图2所示。 图2 GUI图形设计的初始界面2. 打开jink.fig界面所对应的源程序编辑窗口,其中MATLAB会自动生成界面的初始化程序代码以及1D、“解码检测”和“退出”共18个按钮各按钮的函数名和参数功能解释。在这里,我们需要对每个按钮要实现的具体功能编写程序,由于按钮函数较多,且1D数字按钮的功能相似,故可以编写函数供每个这样的函数调用,从而避免程序的繁杂冗余。例如对于点击数字键“1”时要实现的功能的函数可以为如下代码:set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,1);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,1);% Update handles structureguidata(hObject, handles);set(handles.CodeText,string,handles.TelNumber);当运行程序后点击数字键“1”时,pushbutton1_Callback函数会调用PressKeyDown函数,从而完成发出相应的声音、在text1文本框中显示出点击的数字、在axes1和axes2画出对应的图形等功能。点击几个数字或字母键后,在界面中运行的结果如图3所示。 图3 拨号时界面的显示结果3. 在拨号后,要对所接收的拨号信号进行解码检测,检测两个正弦波的频率分别是多少,以判断所对应的十进制数字或字母符号。检测方法有两种,一是用一组滤波器提取所关心的频率,根据两个滤波器的输出信号判断相应的数字或符号,另一是用DFT(FFT)对双音多频信号进行频谱分析,由信号幅度谱判断信号的两个频率,最后确定相应的数字或符号。本设计所编写的相应的解码部分程序代码如下:function pushbutton17_Callback(hObject, eventdata, handles)% hObject handle to pushbutton17 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)handles.DecodeTelNumber=; %清空解码字符串变量,开始新一轮解码。keys = 1,2,3,A;4,5,6,B;7,8,9,C;*,0,#,D;for i=1 : length(handles.TelNumber) Signal = dtmf(handles.TelNumber(i); RowNumber = FindLowerFreq(Signal); ColumnNumber = FindHigherFreq(Signal); ResultKey = keys(RowNumber,ColumnNumber); handles.DecodeTelNumber=strcat(handles.DecodeTelNumber,ResultKey); set(handles.DecodeText,string,handles.DecodeTelNumber);endhandles.TelNumber=; %解码完成后,拨号变量清空,方便下一次拨号。点击“解码检测”按钮,进行解码的运行结果如图4所示。 图4 解码后的结果由图4可以看出,在解码的文本框中显示出正确的拨号,表示解码正确。点“退出”键后界面关闭退出。4、 课程设计总结 经过几天的努力,我终于完成了基于MATLAB的DTMF信号的产生与解码课程设计,由于刚上完数字信号处理这门课程,对相关的知识还是比较熟悉,但是对于数字信号处理的实质的理解还是不够深刻,因此刚开始不知如何下手,觉得困难比较多,不过最后经过多次修改和整理,还是完成了。受到自己知识水平的限制,此次课程设计还有很多不足的地方。通过这次课程设计,我发现自己以前关于数字信号处理这门课的看法太片面,课程设计不仅仅是对所学知识的一种检验,更是对自己能力的一种提高,这次课程设计使我明白前面所学的那点知识是非常欠缺的,要学的东西还很多。比如在使用MATLAB制作图形界面上,以前上过这个课程,但没有学其中GUI界面设计部分,这就要求我们去自学。在这次课程设计中,我遇到过很多问题,发现我所学的知识实在有限,好在同学之间可以相互讨论,还可以充分利用网络去查阅相关资料。在整理与修改的过程中,我学到了很多新的知识,也培养了独立思考和设计的能力,树立了对知识应用的信心,相信会对以后的学习工作都有很大的帮助,并且提高了自己的动手实践能力。在这次课程设计的过程中,我得到了许多人的帮助,感谢指导老师耐心的讲解,也感谢在一起讨论的同学,从中我得到了很多好的建议和方法。总之,本次课程设计的过程虽然曲折,但是收获还是蛮大的,这不是对知识的终结,而是我学习更多知识的一个平台。5、 参考文献1. 程耕国,信号与系统,北京:机械工业出版社,2009.42. 高西全、丁玉美,数字信号处理(第三版),西安:西安电子科技大学出版社,2008.83. 李正周,MATLAB数字信号处理与应用,北京:清华大学出版社,20084. 徐明远、刘增力,MATLAB仿真在信号处理中的应用,西安:电子科技大学出版社,20075. 李显宏,MTALAB7.x界面设计与编译技巧,北京:电子工业出版社,20066、 附录源程序代码:function varargout = jink(varargin)% JINK MATLAB code for jink.fig% JINK, by itself, creates a new JINK or raises the existing% singleton*.% H = JINK returns the handle to a new JINK or the handle to% the existing singleton*.% JINK(CALLBACK,hObject,eventData,handles,.) calls the local% function named CALLBACK in JINK.M with the given input arguments.% JINK(Property,Value,.) creates a new JINK or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before jink_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to jink_OpeningFcn via varargin.% *See GUI Options on GUIDEs 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 jink % Last Modified by GUIDE v2.5 01-Jan-2012 13:20:27 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, jink_OpeningFcn, . gui_OutputFcn, jink_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT % - Executes just before jink is made visible.function jink_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 jink (see VARARGIN) % Choose default command line output for jinkhandles.output = hObject;handles.DTMFSignal = ; handles.TelNumber=;handles.DecodeTelNumber=;%保存解码字符串 变量 set(gcf,CurrentAxes,handles.axes1);xlabel(单位:(s)); set(gcf,CurrentAxes,handles.axes2);xlabel(单位:(Hz)); % Update handles structureguidata(hObject, handles); % UIWAIT makes jink wait for user response (see UIRESUME)% uiwait(handles.figure1); % - Outputs from this function are returned to the command line.function varargout = jink_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 structurevarargout1 = 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)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,1);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,1);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - 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 future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,2);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,2);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton3.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)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,3);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,3);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton4.function pushbutton4_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)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,4);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,4);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton5.function pushbutton5_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)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,5);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,5);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton6.function pushbutton6_Callback(hObject, eventdata, handles)% hObject handle to pushbutton6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,6);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,6);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton7.function pushbutton7_Callback(hObject, eventdata, handles)% hObject handle to pushbutton7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,7);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,7);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton8.function pushbutton8_Callback(hObject, eventdata, handles)% hObject handle to pushbutton8 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,8);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,8);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton9.function pushbutton9_Callback(hObject, eventdata, handles)% hObject handle to pushbutton9 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,9);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,9);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton10.function pushbutton10_Callback(hObject, eventdata, handles)% hObject handle to pushbutton10 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,*);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,*);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton11.function pushbutton11_Callback(hObject, eventdata, handles)% hObject handle to pushbutton11 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,0);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,0);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton12.function pushbutton12_Callback(hObject, eventdata, handles)% hObject handle to pushbutton12 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,#);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,#);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton13.function pushbutton13_Callback(hObject, eventdata, handles)% hObject handle to pushbutton13 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,A);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,A);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton14.function pushbutton14_Callback(hObject, eventdata, handles)% hObject handle to pushbutton14 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,B);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,B);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton15.function pushbutton15_Callback(hObject, eventdata, handles)% hObject handle to pushbutton15 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,C);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,C);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton16.function pushbutton16_Callback(hObject, eventdata, handles)% hObject handle to pushbutton16 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.DecodeText,string,); %清空解码显示文本框 Signal = PressKeyDown(handles,D);handles.DTMFSignal = Signal;handles.TelNumber=strcat(handles.TelNumber,D);% Update handles structureguidata(hObject, handles); set(handles.CodeText,string,handles.TelNumber); % - Executes on button press in pushbutton17.function pushbutton17_Callback(hObject, eventdata, handles)% hObject handle to pushbutton17 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)handles.DecodeTelNumber=; %清空解码字符串变量,开始新一轮解码。keys = 1,2,3,A;4,5,6,B;7,8,9,C;*,0,#,D;for i=1 : length(handles.TelNumber) Signal = dtmf(handles.TelNumber(i); RowNumber = FindLowerFreq(Signal); ColumnNumber = FindHigherFreq(Signal); ResultKey = keys(RowNumber,ColumnNumber); handles.DecodeTelNumber=strcat(handles.DecodeTelNumber,ResultKey); set(handles.DecodeText,string,handles.DecodeTelNumber);endhandles.TelNumber=; %解码完成后,拨号变量清空,方便下一次拨号。 % Update handles structureguidata(hObject, handles);% RowNumber = FindLowerFreq(handles.DTMFSignal);% ColumnNumber = FindHigherFreq(handles.DTMFSignal);% ResultKey = keys(RowNumber,ColumnNumber);% set(handles.DecodeText,string,char(ResultKey); % PressKeyDown.mfunction Signal = PressKeyDown(handles,key)Signal = dtmf(key);sound(Signal,8000); % 利用声卡播放拨号音set(gcf,CurrentAxes,handles.axes1);NSignal=length(Signal);t=1/8000:1/8000:NSignal/8000;plot(t,Signal);grid; % 画信号的时域波形xlabel(单位:(s)); Spectrum = fft(Signal);Spectrum = fftshift(Spectrum); % 计算信号的频谱N = length(Spectrum); nStep = (2*pi)/(N-1);w = -pi:nStep:pi;set(gcf,CurrentAxes,handles.axes2);plot(w/(2*pi)*8000,abs(Spectrum);grid; %画信号的频谱图axis(-2000,2000,0,200); xlabel(单位:(Hz)); %dtmf.mfunction x = dtmf(key); fs = 8000; N = 0.1 * fs; %信号时间为100ms,N=Tpmin * Fs ; Tpmin根据频率分辨率得到,DTMF信号的最小频率间隔为73HZ,故至少需要110点R = 1; fl = 0; fh = 0; n=0:100;switch key case 1,2,3,A fl = 697; case 4,5,6,B fl = 770; case 7,8,9,C fl = 852;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年新材料研发企业工程师聘用合同范本
- 2025版户外运动设施铁板租赁合同示范文本
- 店面雇佣合同协议书范本
- 基础建设合同转让协议书
- 境外船舶买卖合同协议书
- 大型机械租赁服务合同4篇
- 购买小麦种子的合同4篇
- 家政雇佣合同协议书模板
- 小区地坪漆采购合同范本
- 定制卫浴合同协议书范本
- 2025-2030电动船舶电池系统安全标准构建与产业链配套能力报告
- 数字时代群体冲突演变-洞察及研究
- 2025秋新部编版一年级上册语文教学计划+教学进度表
- 2025年公安辅警招聘知识考试题(附答案)
- (标准)便利店转让合同协议书带烟证
- 廉洁文化知识试题(含答案)
- 2025《地方资产管理公司监督管理暂行办法》解读课件
- 2025年中国PC工业计算机(工控机)数据监测研究报告
- 儿童学针灸启蒙课件
- 中学生健康生活方式指南
- 2025年青岛版(2024)小学科学三年级上册(全册)教学设计(附目录P150)
评论
0/150
提交评论