📄 ui_start.m
字号:
function fig = ui_start()
% 编写的界面程序,可以在界面上输入或选择一些仿真参数,点击界面上的 Start Simulation
%调用ui_start_sim(),开始仿真。
clear all;
close all;
clc;
%load ui_start
%'Colormap',mat0, ...
h0 = figure('Units','points', ...
'Color',[0.8 0.8 0.8], ...
'FileName','ui_start.m', ...
'MenuBar','none', ...
'Name','WLAN Simulator', ...
'NumberTitle','off', ...
'PaperPosition',[18 180 576 432], ...
'PaperUnits','points', ...
'Position',[120 250 430 225], ...
'Resize','off', ...
'Tag','UIFigure', ...
'ToolBar','none');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[20 180 100 20], ...
'String','Packet Length (Bytes)', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Callback','ui_check_params', ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[120 180 50 20], ...
'String','100', ...
'Style','edit', ...
'Tag','PktLen');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'FontSize',9, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[20 135 100 20], ...
'String','Convolutional code rate', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'ListboxTop',0, ...
'Position',[120 135 50 20], ...
'String',['R1/2';'R2/3';'R3/4'], ...
'Style','popupmenu', ...
'Tag','ConvCodeRate', ...
'Value',1);
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'Callback','ui_check_params', ...
'ListboxTop',0, ...
'Position',[20 115 150 18.75], ...
'String','Interleave Bits', ...
'Style','checkbox', ...
'Tag','InterleaveBits', ...
'Value',1);
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'FontSize',9, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[20 90 100 20], ...
'String','Modulation', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'ListboxTop',0, ...
'Position',[120 90 50 20], ...
'String',['BPSK ';'QPSK ';'16QAM';'64QAM'], ...
'Style','popupmenu', ...
'Tag','Modulation', ...
'Value',1);
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'Callback','ui_check_params', ...
'ListboxTop',0, ...
'Position',[20 60 150 18.75], ...
'String','Transmitter diversity', ...
'Style','checkbox', ...
'Tag','UseTxDiversity');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'Callback','ui_check_params', ...
'ListboxTop',0, ...
'Position',[20 40 150 18.75], ...
'String','Receiver diversity', ...
'Style','checkbox', ...
'Tag','UseRxDiversity');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Callback','ui_check_params', ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[180 160 110 20], ...
'String','0', ...
'Style','edit', ...
'Tag','FreqError');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[180 180 110 20], ...
'String','Frequency Error', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[180 140 110 15], ...
'String','Channel Model', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'Callback','ui_check_params', ...
'ListboxTop',0, ...
'Position',[180 120 110 18.75], ...
'String','AWGN', ...
'Style','radiobutton', ...
'Tag','AWGN', ...
'Enable','inactive', ...
'Value',1);
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'Callback','ui_check_params', ...
'Enable','on', ...
'ListboxTop',0, ...
'Position',[180 100 110 18.75], ...
'String','Exponential decay', ...
'Style','radiobutton', ...
'Tag','ExponentialDecay');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'FontSize',9, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[180 80 60 18.75], ...
'String','T rms (ns)', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Callback','ui_check_params', ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[240 80 50 18.75], ...
'String','50', ...
'Style','edit', ...
'Tag','ExpDecayTrms');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[180 60 110 18.75], ...
'String','Signal to Noise Ratio (dB)', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Callback','ui_check_params', ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[180 40 110 18.75], ...
'String','0:4:40', ...
'Style','edit', ...
'Tag','SNR');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'FontSize',9, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[300 180 120 20], ...
'String','Synchronization algorithms', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'ListboxTop',0, ...
'Position',[300 160 100 18.75], ...
'String','Packet Detection', ...
'Style','checkbox', ...
'Tag','PacketDetection');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'ListboxTop',0, ...
'Position',[300 140 100 18.75], ...
'String','Fine Time Sync', ...
'Style','checkbox', ...
'Tag','FineTimeSync');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'ListboxTop',0, ...
'Position',[300 120 100 18.75], ...
'String','Frequency Sync', ...
'Style','checkbox', ...
'Tag','FreqSync');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'ListboxTop',0, ...
'Position',[300 100 100 18.75], ...
'String','Pilot Phase Tracking', ...
'Style','checkbox', ...
'Tag','PilotPhaseTrack');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'ListboxTop',0, ...
'Position',[300 80 100 18.75], ...
'String','Channel Estimation', ...
'Style','checkbox', ...
'Tag','ChannelEst');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'FontSize',9, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[300 55 80 18.75], ...
'String','Rx timing offset', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Callback','ui_check_params', ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[380 55 30 18.75], ...
'String','-3', ...
'Style','edit', ...
'Tag','RxTimingOffset');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[300 35 80 18.75], ...
'String','Packets to simulate', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Callback','ui_check_params', ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[380 35 30 18.75], ...
'String','100', ...
'Style','edit', ...
'Tag','PktsToSimulate');
%%%%%%%%%%%%%%%%%%%%%'Callback','ui_start_sim', ...&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.75 0.75 0.75], ...
'BusyAction','cancel', ...
'Callback','ui_start_sim', ...
'Interruptible','off', ...
'ListboxTop',0, ...
'Position',[300 10 90 20], ...
'String','Start Simulation', ...
'Tag','Pushbutton1');
if nargout > 0
fig = h0;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -