📄 txtester.asv
字号:
function varargout = TxTester(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @TxTester_OpeningFcn, ...
'gui_OutputFcn', @TxTester_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
% End initialization code - DO NOT EDIT
% --- Executes just before TxTester is made visible.
function TxTester_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
handles.CurrentPath = pwd;
addpath(handles.CurrentPath);
handles.AxesTitle_Plot_ISigImported = 'In-Phase Signal(Imported)';
handles.AxesTitle_Plot_QSigImported = 'Quadrature-Phase Signal(Imported)';
handles.AxesTitle_Plot_IQPhaseImported = 'I/Q Phase Plot(Imported)';
handles.AxesTitle_Plot_ISigFilter = 'In-Phase Signal(after filter)';
handles.AxesTitle_Plot_QSigFilter = 'Quadrature-Phase Signal(after filter)';
handles.AxesTitle_Plot_IQPhaseFilter = 'I/Q Phase Plot(after filter)';
handles.AxesTitle_Plot_DemodSig = 'Demodulated Signal';
handles.AxesTitle_Plot_RRCcoef = 'Impluse Response(RRC)';
handles.AxesTitle_Plot3_IQPhaseImported = 'I/Q 3D figure(Imported)';
handles.AxesTitle_Plot3_IQPhaseFilter = 'I/Q 3D figure(after filter)';
handles.AxesTitle_Polar_IQPhaseImported = 'I/Q Polar Coordinate Plot(Imported)';
handles.AxesTitle_Polar_IQPhaseFilter = 'I/Q Polar Coordinate Plot(after filter)';
handles.str = {' Transmitter basebande Test v1.0'; ...
' for DMR CP4FSK modulation.'; ...
' written by zhengliangde, hyt, CO., LTD.'; ...
' Contact: harlemon@126.com'};
handles.str = [handles.str; {'->> Starting TxTester Program...'}];
set(handles.edt_Process, 'string', handles.str);
mainfig = findobj(allchild(0),'tag','TxTester');
if strcmp(get(mainfig,'visible'),'off'),
h=waitbar(0,'TxTester','Name','Starting Program...');
pause(0.1);
for i=1:100
waitbar(i/100,h,['Percentage:',num2str(i),'% '],h);
end
close(h);
pause(0.1)
else
figure(mainfig);
return
end
axes(handles.axes_main);
title('Received signal');
ylabel('Amplitude');
xlabel('Time (s)');
set(handles.txt_CurrentDate,'string',['Current Date: ',date]);
handles.str = [handles.str; {'->> Starting TxTester Program... Done!'}; ...
{'->> Ready.'}];
set(handles.edt_Process, 'string', handles.str);
% Update handles structure
guidata(hObject, handles);
clc;
[m,n] = size(handles.str);
for i = 1:m
disp(handles.str{i});
end
% UIWAIT makes TxTester wait for user response (see UIRESUME)
% uiwait(handles.TxTester);
% --- Outputs from this function are returned to the command line.
function varargout = TxTester_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 structure
varargout{1} = handles.output;
function edt_Process_Callback(hObject, eventdata, handles)
% hObject handle to edt_Process (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edt_Process as text
% str2double(get(hObject,'String')) returns contents of edt_Process as a double
% --- Executes during object creation, after setting all properties.
function edt_Process_CreateFcn(hObject, eventdata, handles)
% hObject handle to edt_Process (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in List_Signal.
function List_Signal_Callback(hObject, eventdata, handles)
% hObject handle to List_Signal (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns List_Signal contents as cell array
% contents{get(hObject,'Value')} returns selected item from List_Signal
% --- Executes during object creation, after setting all properties.
function List_Signal_CreateFcn(hObject, eventdata, handles)
% hObject handle to List_Signal (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% ====================================================================
function pop_Mod_Method_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function pop_Mod_Method_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% =======================================================================
function edt_Mod_Fd_Callback(hObject, eventdata, handles)
value = str2num(get(handles.edt_Mod_Fd,'string'));
if isempty(value)
msgbox('Invalid value in the ''Fd'' Edit field. Check again!', ...
'ERROR','ERROR');
return
else
if value<0 || value/100 ~= fix(value/100)
msgbox('Invalid Fd. See your Transmitter setting.', ...
'ERROR', 'ERROR');
return
end
end
set(handles.btn_Apply, 'enable', 'on');
% --- Executes during object creation, after setting all properties.
function edt_Mod_Fd_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% =======================================================================
function edt_Mod_Index_Callback(hObject, eventdata, handles)
value = str2num(get(handles.edt_Mod_Index,'string'));
if isempty(value)
msgbox('Invalid value in the ''Index'' Edit field. Check again!',...
'ERROR','ERROR');
return
else
if value<0 || value>1
msgbox('Invalid Index. See you Transmitter setting.', ...
'ERROR', 'ERROR');
return
end
end
set(handles.btn_Apply, 'enable', 'on');
% --- Executes during object creation, after setting all properties.
function edt_Mod_Index_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% ======================================================================
function edt_Mod_nSamp_Callback(hObject, eventdata, handles)
value = str2num(get(handles.edt_Mod_nSamp,'string'));
if isempty(value)
msgbox('Invalid number in the ''nSamp'' Edit field. Check again!', ...
'ERROR','ERROR');
return
else
if value<0 || value~=fix(value)
msgbox('Invalid nSamp, see your Transmitter settings.', ...
'ERROR', 'ERROR');
return
end
end
set(handles.btn_Apply, 'enable', 'on');
% --- Executes during object creation, after setting all properties.
function edt_Mod_nSamp_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% ==================================================================
% --- Executes on selection change in pop_RRC_Type.
function pop_RRC_Type_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function pop_RRC_Type_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% ==================================================================
function edt_RRC_Order_Callback(hObject, eventdata, handles)
value = str2num(get(handles.edt_RRC_Order,'string'));
if isempty(value)
msgbox('Invalid value in the ''Order'' Edit field. Check again!', ...
'ERROR', 'ERROR');
return
else
if value<1 || value ~= fix(value)
msgbox('Invalid filter order. Must be a integer','ERROR','ERROR');
return
end
end
set(handles.btn_Apply, 'enable', 'on');
% --- Executes during object creation, after setting all properties.
function edt_RRC_Order_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% ==================================================================
function edt_RRC_OverSamp_Callback(hObject, eventdata, handles)
value = str2num(get(handles.edt_RRC_OverSamp,'string'));
if isempty(value)
msgbox('Invalid value in the ''OverSamp'' Edit field. Check again!', ...
'ERROR','ERROR');
return
else
if value<0 || value~=fix(value)
msgbox('Invalid OverSamp, see your Transmitter settings.', ...
'ERROR', 'ERROR');
return
end
end
set(handles.btn_Apply, 'enable', 'on');
% --- Executes during object creation, after setting all properties.
function edt_RRC_OverSamp_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% =====================================================================
function edt_RRC_RollOff_Callback(hObject, eventdata, handles)
value = str2num(get(handles.edt_RRC_RollOff,'string'));
if isempty(value) || value>1 || value<0
msgbox('Invalid value in the ''RollOff'' Edit field. Check again!', ...
'ERROR', 'ERROR');
return
else
if value<0 || value>1
msgbox('Invalid filter RollOff factor!', 'ERROR', 'ERROR');
return
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -