📄 dsimsoft_export.m
字号:
function varargout = DSimSoft_export(varargin)
% DSIMSOFT_EXPORT M-file for DSimSoft_export.fig
% Begin initialization code - DO NOT EDIT
% written by zhengliangde
% contact: harlemon@hotmail.com
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @DSimSoft_export_OpeningFcn, ...
'gui_OutputFcn', @DSimSoft_export_OutputFcn, ...
'gui_LayoutFcn', @DSimSoft_export_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 DSimSoft_export is made visible.
function DSimSoft_export_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
handles.CurrentPath = pwd;
addpath(handles.CurrentPath);
% -----------------------Stored default -------------------------
DefaultParam.src.BitNum = 1200;
DefaultParam.src.InitSeed = 12345;
DefaultParam.mod.method = 'cp4fsk';
DefaultParam.mod.Fd = 4800;
DefaultParam.mod.Index = 0.27;
DefaultParam.mod.nSamp = 8;
DefaultParam.rrc.type = 'RRC';
DefaultParam.rrc.OverSamp = 16;
DefaultParam.rrc.RollOff = 0.2;
DefaultParam.rrc.Order = 64;
DefaultParam.rrc.Delay = ...
DefaultParam.rrc.Order/(2*DefaultParam.rrc.OverSamp);
DefaultParam.awgn.EbNo = 10;
DefaultParam.awgn.InitSeed = 54321;
DefaultParam.awgn.power = '<measured>';
DefaultParam.awgn.powertype = 1;
DefaultParam.fade.FrqShift = 40;
DefaultParam.fade.DelayVec = [0 2e-6];
DefaultParam.fade.GainVec = [0 -3];
DefaultParam.fade.Td = 1/(DefaultParam.mod.Fd*...
DefaultParam.mod.nSamp*DefaultParam.rrc.OverSamp);
setappdata(handles.output, 'DefaultParam', DefaultParam);
setappdata(handles.output, 'src', DefaultParam.src);
setappdata(handles.output, 'mod', DefaultParam.mod);
setappdata(handles.output, 'rrc', DefaultParam.rrc);
setappdata(handles.output, 'awgn', DefaultParam.awgn);
setappdata(handles.output, 'fade', DefaultParam.fade);
% -------------------------------------------------------------
% -- axes title
handles.AxesTitle_Plot_SourceSig = ...
'Source Signals';
handles.AxesTitle_Plot_ITxSigMod = ...
'In-Phase Signal (Mod baseband)';
handles.AxesTitle_Plot_QTxSigMod = ...
'Quadrature-Phase Signal (Mod baseband)';
handles.AxesTitle_Plot_IQTxPhaseMod = ...
'I/Q Phase Plot (Mod baseband)';
handles.AxesTitle_Plot_ITxSigFilter = ...
'In-Phase Tx Signal (after Tx filter)';
handles.AxesTitle_Plot_QTxSigFilter = ...
'Quadrature-Phase Signal (after Tx filter)';
handles.AxesTitle_Plot_IQTxPhaseFilter = ...
'I/Q Phase (after Tx filter)';
handles.AxesTitle_Plot_ITxSigNoise = ...
'In-Phase Tx Signal (AWGN)';
handles.AxesTitle_Plot_QTxSigNoise = ...
'Quadrature-Phase Tx Signal (AWGN)';
handles.AxesTitle_Plot_IQTxPhaseNoise = ...
'I/Q Phase (AWGN)';
handles.AxesTitle_Plot_ITxSigFade = ...
'In-Phase Tx Signal (Rayleigh Fade)';
handles.AxesTitle_Plot_QTxSigFade = ...
'Quadrature-Phase Tx Signal (Rayleigh Fade)';
handles.AxesTitle_Plot_IQTxPhaseFade = ...
'I/Q Phase (Rayleigh Fade)';
handles.AxesTitle_Plot_IRxSigFilter = ...
'In-Phase Signal(after Rx filter)';
handles.AxesTitle_Plot_QRxSigFilter = ...
'Quadrature-Phase Signal(after Rx filter)';
handles.AxesTitle_Plot_IQRxPhaseFilter = ...
'I/Q Phase Plot(after Rx filter)';
handles.AxesTitle_Plot_DemodSig = ...
'Demodulated Signal';
%handles.AxesTitle_Plot_RRCcoef = ...
% 'Impluse Response(RRC)';
handles.AxesTitle_Plot3_IQTxPhaseMod = ...
'I/Q 3D figure (Mod baseband)';
handles.AxesTitle_Plot3_IQTxPhaseFilter = ...
'I/Q 3D figure (after Tx filter)';
handles.AxesTitle_Plot3_IQTxPhaseNoise = ...
'I/Q 3D figure (AWGN)';
handles.AxesTitle_Plot3_IQTxPhaseFade = ...
'I/Q 3D figure (Rayleigh Fade)';
handles.AxesTitle_Plot3_IQRxPhaseFilter = ...
'I/Q 3D figure(after Rx filter)';
handles.AxesTitle_Polar_IQTxPhaseMod = ...
'I/Q Polar Coordinate Plot (Mod baseband)';
handles.AxesTitle_Polar_IQTxPhaseFilter = ...
'I/Q Polar Coordinate Plot (after Tx filter)';
handles.AxesTitle_Polar_IQTxPhaseNoise = ...
'I/Q Polar Coordinate Plot (AWGN)';
handles.AxesTitle_Polar_IQTxPhaseFade = ...
'I/Q Polar Coordinate Plot (Rayleigh Fade)';
handles.AxesTitle_Polar_IQRxPhaseFilter = ...
'I/Q Polar Coordinate Plot(after filter)';
handles.str = {' DSimSoft v1.0'; ...
' for DMR CP4FSK modulation.'; ...
' written by zhengliangde, hyt, CO., LTD.'; ...
' Contact: harlemon@hotmail.com'};
handles.str = [handles.str; {'->> Starting DSimSoft v1.0 Program...'}];
set(handles.edt_Process, 'string', handles.str);
mainfig = findobj(allchild(0),'tag','DSimSoft');
if strcmp(get(mainfig,'visible'),'off'),
h=waitbar(0,'DSimSoft','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('Title');
ylabel('y Axis');
xlabel('x Axis');
set(handles.txt_Date,'string',['Current Date: ',date]);
handles.str = [handles.str; {'->> Starting DSimSoft v1.0 Program... Done!'}; ...
{'->> Ready.'}];
set(handles.edt_Process, 'string', handles.str);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes DSimSoft_export wait for user response (see UIRESUME)
% uiwait(handles.DSimSoft_export);
% --- Outputs from this function are returned to the command line.
function varargout = DSimSoft_export_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
% ------------------------------------------------------------------
% --- Executes on button press in radiobtn_Sim.
function radiobtn_Sim_Callback(hObject, eventdata, handles)
set(handles.radiobtn_Test, 'value', 0);
set(handles.radiobtn_Sim, 'value', 1);
set([handles.chkb_Sim_Tx, handles.chkb_Sim_Rx], 'enable', 'on');
set([handles.chkb_Test_Tx, handles.chkb_Test_Rx], 'enable', 'off');
set([handles.chkb_Test_Tx, handles.chkb_Test_Rx], 'value', 0);
set([handles.chkb_Sim_Tx, handles.chkb_Sim_Rx], 'value', 1);
set(handles.txt_SoftInfo, 'string', ...
'For simulation, both Transmitter and receiver.');
set(handles.btn_APPLY, 'enable', 'on');
set([handles.btn_TxDataExport, handles.btn_TxDataSave, ...
handles.btn_RxDataImport, handles.btn_RxDataSave], ...
'enable', 'off');
% --------------------------------------------------------------------
% --- Executes on button press in radiobtn_Test.
function radiobtn_Test_Callback(hObject, eventdata, handles)
set(handles.radiobtn_Test, 'value', 1);
set(handles.radiobtn_Sim, 'value', 0);
set([handles.chkb_Sim_Tx, handles.chkb_Sim_Rx], 'enable', 'off');
set([handles.chkb_Sim_Tx, handles.chkb_Sim_Rx], 'value', 0);
set([handles.chkb_Test_Tx, handles.chkb_Test_Rx], 'enable', 'on');
set(handles.chkb_Test_Tx, 'value', 1);
set(handles.chkb_Test_Rx, 'value', 0);
set(handles.txt_SoftInfo, 'string', ...
'For test FPGA/DSP, only Transmitter.');
set(handles.btn_APPLY, 'enable', 'on');
set([handles.btn_TxDataExport, handles.btn_TxDataSave, ...
handles.btn_RxDataImport, handles.btn_RxDataSave], ...
'enable', 'off');
% ===================================================================
% --- Executes on button press in chkb_Sim_Tx.
% -------------------------------------------------------------------
function chkb_Sim_Tx_Callback(hObject, eventdata, handles)
if ~get(handles.chkb_Sim_Tx, 'Value') && ...
~get(handles.chkb_Sim_Rx, 'Value'),
msgbox('Transmiter and Receiver must choose at least one!', ...
'ERROR', 'ERROR', 'modal');
set(handles.chkb_Sim_Tx, 'value', 1);
return
end
if get(handles.chkb_Sim_Tx, 'value') && ...
~get(handles.chkb_Sim_Rx, 'value'),
set(handles.txt_SoftInfo, 'string', ...
'For simulation, only Transmitter.');
set(handles.btn_APPLY, 'enable', 'on');
set([handles.btn_TxDataExport, handles.btn_TxDataSave, ...
handles.btn_RxDataImport, handles.btn_RxDataSave], ...
'enable', 'off');
else
if ~get(handles.chkb_Sim_Tx, 'value') && ...
get(handles.chkb_Sim_Rx, 'value'),
set(handles.txt_SoftInfo, 'string', ...
'For simulation, only receiver.');
set([handles.btn_TxDataExport, handles.btn_TxDataSave, ...
handles.btn_APPLY, handles.btn_RxDataSave], ...
'enable', 'off');
set(handles.btn_RxDataImport, 'enable', 'on');
else
if get(handles.chkb_Sim_Tx, 'value') && ...
get(handles.chkb_Sim_Rx, 'value')
set(handles.txt_SoftInfo, 'string', ...
'For simulation, both Transmitter and receiver.');
set(handles.btn_APPLY, 'enable', 'on');
set([handles.btn_TxDataExport, handles.btn_TxDataSave, ...
handles.btn_RxDataImport, handles.btn_RxDataSave], ...
'enable', 'off');
end
end
end
% --------------------------------------------------------------------
% --- Executes on button press in chkb_Sim_Rx.
% --------------------------------------------------------------------
function chkb_Sim_Rx_Callback(hObject, eventdata, handles)
if ~get(handles.chkb_Sim_Tx, 'Value') && ...
~get(handles.chkb_Sim_Rx, 'Value'),
msgbox('Transmiter and Receiver must choose at least one!', ...
'ERROR', 'ERROR', 'modal');
set(handles.chkb_Sim_Rx, 'value', 1);
return
end
if get(handles.chkb_Sim_Tx, 'value') && ...
~get(handles.chkb_Sim_Rx, 'value'),
set(handles.txt_SoftInfo, 'string', ...
'For simulation, only Transmitter.');
set(handles.btn_APPLY, 'enable', 'on');
set([handles.btn_TxDataExport, handles.btn_TxDataSave, ...
handles.btn_RxDataImport, handles.btn_RxDataSave], ...
'enable', 'off');
else
if ~get(handles.chkb_Sim_Tx, 'value') && ...
get(handles.chkb_Sim_Rx, 'value'),
set(handles.txt_SoftInfo, 'string', ...
'For simulation, only receiver.');
set([handles.btn_TxDataExport, handles.btn_TxDataSave, ...
handles.btn_APPLY, handles.btn_RxDataSave], ...
'enable', 'off');
set(handles.btn_RxDataImport, 'enable', 'on');
else
if get(handles.chkb_Sim_Tx, 'value') && ...
get(handles.chkb_Sim_Rx, 'value')
set(handles.txt_SoftInfo, 'string', ...
'For simulation, both Transmitter and receiver.');
set(handles.btn_APPLY, 'enable', 'on');
set([handles.btn_TxDataExport, handles.btn_TxDataSave, ...
handles.btn_RxDataImport, handles.btn_RxDataSave], ...
'enable', 'off');
end
end
end
% -------------------------------------------------------------------
% --- Executes on button press in chkb_Test_Tx.
% -------------------------------------------------------------------
function chkb_Test_Tx_Callback(hObject, eventdata, handles)
set(handles.chkb_Test_Rx, 'value', 0);
set(handles.chkb_Test_Tx, 'value', 1);
set(handles.txt_SoftInfo, 'string', ...
'For Test FPGA/DSP, only Transmitter.');
set(handles.btn_APPLY, 'enable', 'on');
set([handles.btn_TxDataExport, handles.btn_TxDataSave, ...
handles.btn_RxDataImport, handles.btn_RxDataSave], ...
'enable', 'off');
% ==================================================================
% --- Executes on button press in chkb_Test_Rx.
% ------------------------------------------------------------------
function chkb_Test_Rx_Callback(hObject, eventdata, handles)
set(handles.chkb_Test_Rx, 'value', 1);
set(handles.chkb_Test_Tx, 'value', 0);
set(handles.txt_SoftInfo, 'string', ...
'For test FPGA/DSP, only receiver.');
set([handles.btn_TxDataExport, handles.btn_TxDataSave, ...
handles.btn_APPLY, handles.btn_RxDataSave], ...
'enable', 'off');
set(handles.btn_RxDataImport, 'enable', 'on');
% ===================================================================
% ----- list_ParamSet Callback function
% -------------------------------------------------------------------
function list_ParamSet_Callback(hObject, eventdata, handles)
if strcmp(get(handles.DSimSoft, 'SelectionType'), 'open'),
choice = get(handles.list_ParamSet, 'value');
if get(handles.radiobtn_Sim, 'value')
if get(handles.chkb_Sim_Rx, 'value') && ...
~get(handles.chkb_Sim_Tx, 'value')
if choice == 3 || choice == 5,
SetParam(choice);
return
else
if choice == 1 || choice == 7 || choice == 8
msgbox(['Receiver for Simulation.', ...
' No need to set this parameters'], ...
'No need to Set');
return
end
end
end
else
if get(handles.radiobtn_Test, 'value'),
if get(handles.chkb_Test_Rx, 'value') && ...
~get(handles.chkb_Test_Tx, 'value')
if choice == 3 || choice == 5
SetParam(choice);
return
else
if choice == 1 || choice == 7 || choice == 8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -