⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 phone.m

📁 双音多频编解码系统
💻 M
字号:
function varargout = phone(varargin)
% PHONE M-file for phone.fig

gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @phone_OpeningFcn, ...
                   'gui_OutputFcn',  @phone_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

function drew(hObject, eventdata, handles)
plot(handles.axes1,handles.hn);
axis tight;
[hw w]=freqz(handles.hn);
plot(handles.axes2,w,20*log(abs(hw)));
axis tight;
soundsc(handles.hn);

% --- Executes just before phone is made visible.
function phone_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
handles.num='';
handles.a=0.85;
handles.b=1;
handles.method=0;
guidata(hObject, handles);

% --- Outputs from this function are returned to the command line.
function varargout = phone_OutputFcn(hObject, eventdata, handles) 
varargout{1} = handles.output;

% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
handles.hn=DTMF('1',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
handles.hn=DTMF('2',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
handles.hn=DTMF('4',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
handles.hn=DTMF('5',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
handles.hn=DTMF('7',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
handles.hn=DTMF('8',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
handles.hn=DTMF('*',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
handles.hn=DTMF('0',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
handles.hn=DTMF('3',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
handles.hn=DTMF('A',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, eventdata, handles)
handles.hn=DTMF('6',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton12.
function pushbutton12_Callback(hObject, eventdata, handles)
handles.hn=DTMF('B',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton13.
function pushbutton13_Callback(hObject, eventdata, handles)
handles.hn=DTMF('9',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton14.
function pushbutton14_Callback(hObject, eventdata, handles)
handles.hn=DTMF('C',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
handles.hn=DTMF('#',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes on button press in pushbutton16.
function pushbutton16_Callback(hObject, eventdata, handles)
handles.hn=DTMF('D',handles.a,handles.b);
handles.num=[handles.num Receiv(handles.hn,handles.method)];
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
drew(hObject, eventdata, handles);

% --- Executes during object creation, after setting all properties.
function text1_CreateFcn(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function axes2_CreateFcn(hObject, eventdata, handles)

% --- Executes on button press in pushbutton18.
function pushbutton18_Callback(hObject, eventdata, handles)
handles.num='';
set(handles.text1,'String',handles.num);
guidata(hObject,handles);
hn=zeros(1,8000);
plot(handles.axes1,hn);
axis tight;
[hw w]=freqz(hn);
hw=ones(1,length(hw));
plot(handles.axes2,w,20*log(abs(hw)));
axis tight;


% --- Executes on button press in pushbutton19.
function pushbutton19_Callback(hObject, eventdata, handles)
len=length(handles.num);
if len>0
    handles.num=handles.num(1,1:len-1);
    set(handles.text1,'String',handles.num);
    guidata(hObject,handles);
end
if len>1
    last=handles.num(1,len-1);
    handles.hn=DTMF(last,handles.a,handles.b);
    drew(hObject, eventdata, handles);
end


% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
handles.method=0;
guidata(hObject, handles);

% --- Executes on button press in radiobutton2.
function radiobutton2_Callback(hObject, eventdata, handles)
handles.method=1;
guidata(hObject, handles);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -