大连理工大学实验报告学院(系):电子信息与电气工程专业:电子信息工程班级:姓名:学号:组:___实验时间:实验室:实验台:指导教师签字:成绩:实验二、电话拨号音的合成与识别一、实验题目和代码实现对电话通信系统中拨号音合成与识别的仿真实现。系统界面设计:源程序:functionvarargout=zuoye(varargin)functionzuoye_OpeningFcn(hObject,eventdata,handles,varargin)%Thisfunctionhasnooutputargs,seeOutputFcn.%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%varargincommandlineargumentstozuoye(seeVARARGIN)%Choosedefaultcommandlineoutputforzuoyehandles.output=hObject;handles.fs=8192;handles.DTMFsum=820;handles.DTMFnum=handles.DTMFsum/2;handles.NUM=[];handles.number=[];functionnum1_Callback(hObject,eventdata,handles)%hObjecthandletonum1(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)n0=strcat(get(handles.numshow,'string'),'1');%获取数字号码set(handles.numshow,'string',n0);%显示号码n=[1:handles.DTMFnum];%每个数字410个采样点表示d0=sin(2*pi*697/handles.fs*n)+sin(2*pi*1209/handles.fs*n);%对应行频列频叠加space=zeros(1,handles.DTMFnum);%400个0模拟静音信号phone=[handles.NUM,d0];handles.NUM=[phone,space];%存储连续的拨号音信号guidata(hObject,handles);wavplay(d0,8192);functionnum10_Callback(hObject,eventdata,handles)%hObjecthandletonum10(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)n=[1:1000];num=get(handles.numshow,'string');L=length(num);n11=strrep(num,num,num(1:L-1));d11=sin(0.7217*n)+sin(0.9273*n);set(handles.numshow,'string',n11);L=length(handles.NUM);handles.NUM=handles.NUM(1:L-820);guidata(hObject,handles);wavplay(d11,8192);functionnum11_Callback(hObject,eventdata,handles)%hObjecthandletonum11(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)L=length(handles.NUM);n=L/handles.DTMFsum;number='';fori=1:nj=(i-1)*handles.DTMFsum+1;d=handles.NUM(j:j+(handles.DTMFnum-1));%截取出每个数字f=fft(d,8192);%以N=2048作FFT变换a=abs(f);p=a.*a/handles.fs;%计算功率谱%p=a.*a/10000;%计算功率谱num(1)=find(p(1:1000)==max(p(1:1000)));%找行频num(2)=1000+find(p(1000:1700)==max(p(1000:1700)));%找列频if(num(1)730)row=1;%确定行数elseif(num(1)810)row=2;elseif(num(1)900)row=3;elserow=4;endif(num(2)1260)column=1;%确定列数elseif(num(2)1400)column=2;elsecolumn=3;endz=[row,column];%确定数字ifz==[4,2]tel=0;elseifz==[1,1]tel=1;elseifz==[1,2]tel=2;elseifz==[1,3]tel=3;elseifz==[2,1]tel=4;elseifz==[2,2]tel=5;elseifz==[2,3]tel=6;elseifz==[3,1]tel=7;elseifz==[3,2]tel=8;elseifz==[3,3]tel=9;endt(i)=tel;c=strcat(number,int2str(tel));number=c;i=i+1;endset(handles.numshow2,'string',number);实验结果:拨号:识别:二、总结、讨论和建议本次试验是第一次接触matlab中的gui功能,对其还不是特别熟悉,在老师的指导下完成了任务。在本次试验中,主要遇到的问题就是编代码时没有考虑清屏操作,导致前一次的显示结果也会保留在窗口上,加入set(handles.numshow2,'string',number);这段代码后程序功能才正常运行;运行程序的时候,没有完成语音信号的识别。其他部分没有太大的问题。同时通过本次实验进一步熟悉了MATLAB中GUI的操作。