Matlab电话面板.docx
《Matlab电话面板.docx》由会员分享,可在线阅读,更多相关《Matlab电话面板.docx(16页珍藏版)》请在冰豆网上搜索。
![Matlab电话面板.docx](https://file1.bdocx.com/fileroot1/2023-1/24/350ed5f8-2704-4d4d-9164-f7de5495a19f/350ed5f8-2704-4d4d-9164-f7de5495a19f1.gif)
Matlab电话面板
WKM-fileforwk.fig
%WK,byitself,createsanewWKorraisestheexisting
%singleton*.
%
%H=WKreturnsthehandletoanewWKorthehandleto
%theexistingsingleton*.
%
%WK('Property','Value',...)createsanewWKusingthe
%givenpropertyvaluepairs.Unrecognizedpropertiesarepassedvia
%varargintowk_OpeningFcn.Thiscallingsyntaxproducesa
%warningwhenthereisanexistingsingleton*.
%
%WK('CALLBACK')andWK('CALLBACK',hObject,...)callthe
%localfunctionnamedCALLBACKinWK.Mwiththegiveninput
%arguments.
%
%*SeeGUIOptionsonGUIDE'sToolsmenu.Choose"GUIallowsonlyone
%instancetorun(singleton)".
%
%Seealso:
GUIDE,GUIDATA,GUIHANDLES
%Edittheabovetexttomodifytheresponsetohelpwk
%LastModifiedbyGUIDEv2.521-Jan-201119:
47:
23
%Begininitializationcode-DONOTEDIT
gui_Singleton=1;
gui_State=struct('gui_Name',mfilename,...
'gui_Singleton',gui_Singleton,...
'gui_OpeningFcn',@wk_OpeningFcn,...
'gui_OutputFcn',@wk_OutputFcn,...
'gui_LayoutFcn',[],...
'gui_Callback',[]);
ifnargin&&ischar(varargin{1})
gui_State.gui_Callback=str2func(varargin{1});
end
ifnargout
[varargout{1:
nargout}]=gui_mainfcn(gui_State,varargin{:
});
else
gui_mainfcn(gui_State,varargin{:
});
end
%Endinitializationcode-DONOTEDIT
%---Executesjustbeforewkismadevisible.
functionwk_OpeningFcn(hObject,eventdata,handles,varargin)
%Thisfunctionhasnooutputargs,seeOutputFcn.
%hObjecthandletofigure
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%vararginunrecognizedPropertyName/PropertyValuepairsfromthe
%commandline(seeVARARGIN)
%Choosedefaultcommandlineoutputforwk
handles.output=hObject;
%Updatehandlesstructure
guidata(hObject,handles);
%UIWAITmakeswkwaitforuserresponse(seeUIRESUME)
%uiwait(handles.figure1);
%---Outputsfromthisfunctionarereturnedtothecommandline.
functionvarargout=wk_OutputFcn(hObject,eventdata,handles)
%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);
%hObjecthandletofigure
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%Getdefaultcommandlineoutputfromhandlesstructure
varargout{1}=handles.output;
%---Executesonbuttonpressinpushbutton80.
functionpushbutton80_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton80(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
globalNUM
wavplay(NUM,8192);
L=length(NUM);
n=L/1100;
number='';
fori=1:
n
j=(i-1)*1100+1;
d=NUM(j:
j+999);%截取出每个数字对应的1000个采样点
f=fft(d,2048);%以N=2048作FFT变换
a=abs(f);
p=a.*a;%计算功率谱
num
(1)=find(p(1:
250)==max(p(1:
250)));%找行频
num
(2)=300+find(p(300:
380)==max(p(300:
380)));%找列频
if(num
(1)<180)row=1;%确定行数
elseif(num
(1)<200)row=2;
elseif(num
(1)<220)row=3;
elserow=4;
end
if(num
(2)<320)column=1;%确定列数
elseif(num
(2)<340)column=2;
elsecolumn=3;
end
z=[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;
end
c=strcat(number,int2str(tel));
number=c;
i=i+1;
end
set(handles.edit8,'string',number);
%---Executesonbuttonpressinpushbutton81.
functionpushbutton81_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton81(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
n=[1:
1000];
num=get(handles.edit7,'string');
len=length(num);
n11='';%去掉末尾号码在面板上的显示
d11=sin(0.7217*n)+sin(0.9273*n);
set(handles.edit7,'string',n11);
globalNUM
L=length(NUM);
NUM=NUM(1:
L-1100);%删除末尾号码在拨号音信号中的存储
wavplay(d11,8192);
functionedit7_Callback(hObject,eventdata,handles)
%hObjecthandletoedit7(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%Hints:
get(hObject,'String')returnscontentsofedit7astext
%str2double(get(hObject,'String'))returnscontentsofedit7asadouble
%---Executesduringobjectcreation,aftersettingallproperties.
functionedit7_CreateFcn(hObject,eventdata,handles)
%hObjecthandletoedit7(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled
%Hint:
editcontrolsusuallyhaveawhitebackgroundonWindows.
%SeeISPCandCOMPUTER.
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
%---Executesonbuttonpressinpushbutton82.
functionpushbutton82_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton82(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%---Executesonbuttonpressinpushbutton84.
functionpushbutton84_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton84(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
functionedit8_Callback(hObject,eventdata,handles)
%hObjecthandletoedit8(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%Hints:
get(hObject,'String')returnscontentsofedit8astext
%str2double(get(hObject,'String'))returnscontentsofedit8asadouble
%---Executesduringobjectcreation,aftersettingallproperties.
functionedit8_CreateFcn(hObject,eventdata,handles)
%hObjecthandletoedit8(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled
%Hint:
editcontrolsusuallyhaveawhitebackgroundonWindows.
%SeeISPCandCOMPUTER.
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
functionedit9_Callback(hObject,eventdata,handles)
%hObjecthandletoedit9(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%Hints:
get(hObject,'String')returnscontentsofedit9astext
%str2double(get(hObject,'String'))returnscontentsofedit9asadouble
%---Executesduringobjectcreation,aftersettingallproperties.
functionedit9_CreateFcn(hObject,eventdata,handles)
%hObjecthandletoedit9(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled
%Hint:
editcontrolsusuallyhaveawhitebackgroundonWindows.
%SeeISPCandCOMPUTER.
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
%---Executesonbuttonpressinpushbutton57.
functionpushbutton57_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton57(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
n=[1:
1000];%每个数字1000个采样点表示
d0=sin(0.5346*n)+sin(0.9894*n);%对应行频列频叠加
n0=strcat(get(handles.edit7,'string'),'1');%获取数字号码
set(handles.edit7,'string',n0);%显示号码
space=zeros(1,100);%100个0模拟静音信号
globalNUM
phone=[NUM,d0];
NUM=[phone,space];%存储连续的拨号音信号
wavplay(d0,8192);%产生拨号音
%---Executesonbuttonpressinpushbutton69.
functionpushbutton69_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton69(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
n=[1:
1000];%每个数字1000个采样点表示
d0=sin(0.5346*n)+sin(1.0247*n);%对应行频列频叠加
n0=strcat(get(handles.edit7,'string'),'2');%获取数字号码
set(handles.edit7,'string',n0);%显示号码
space=zeros(1,100);%100个0模拟静音信号
globalNUM
phone=[NUM,d0];
NUM=[phone,space];%存储连续的拨号音信号
wavplay(d0,8192);%产生拨号音
%---Executesonbuttonpressinpushbutton70.
functionvarargout=pushbutton0_Callback(h,eventdata,handles,varargin)
n=[1:
1000];%每个数字1000个采样点表示
d0=sin(0.7217*n)+sin(1.0247*n);%对应行频列频叠加
n0=strcat(get(handles.edit1,'string'),'0');%获取数字号码
set(handles.edit1,'string',n0);%显示号码
space=zeros(1,100);%100个0模拟静音信号
globalNUM
phone=[NUM,d0];
NUM=[phone,space];%存储连续的拨号音信号
wavplay(d0,8192);%产生拨号音
%hObjecthandletopushbutton70(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%---Executesonbuttonpressinpushbutton71.
functionpushbutton71_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton71(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
n=[1:
1000];
num=get(handles.edit7,'string');
len=length(num);
n11=strrep(num,num,num(1:
len-1));%去掉末尾号码在面板上的显示
d11=sin(0.7217*n)+sin(0.9273*n);
set(handles.edit7,'string',n11);
globalNUM
L=length(NUM);
NUM=NUM(1:
L-1100);%删除末尾号码在拨号音信号中的存储
wavplay(d11,8192);
%---Executesonbutton