📄 dcommanalysis.m
字号:
function dCommAnalysis(action, varargin)
%
%
%
%
if nargin<1
action = 'Initialize';
end
feval(action, varargin{:});
return
% =================================================================
% sub function: Initialize
function Initialize()
% If dCommAnalysis is already running, bring it to the foreground.
h = findobj(allchild(0), 'tag', 'Digital Communication Analysis');
if ~isempty(h)
figure(h(1))
return
end
screenD = get(0, 'ScreenDepth');
if screenD>8
grayres=256;
else
grayres=128;
end
%Envi.bckgrdColor = [.925 .914 .847];
Envi.bckgrdColor = [.8 .8 .8];
Envi.frgrdColor = [0.05 0.05 0.05];
Envi.fontSize = 10;
hdl.Envi = Envi;
dCommAnalysisFig = figure( ...
'Name','Digital Communication Analysis', ...
'NumberTitle','off', 'HandleVisibility', 'on', ...
'tag', 'Digital Communication Analysis', ...
'Visible','on', 'Resize', 'off',...
'BusyAction','Queue','Interruptible','off', ...
'Color', Envi.bckgrdColor, ...
'IntegerHandle', 'off', 'Units', 'normalized', ...
'DoubleBuffer', 'on', 'Position', [.18 .17 .7 .62], ...
'Colormap', gray(grayres));
hdl.TxTestbtn = uicontrol(...
'Parent', dCommAnalysisFig, ...
'Style', 'pushbutton', ...
'Units', 'normalized', 'enable', 'off', ...
'Position', [0.02 0.9 0.13 0.07+0.01], ...
'String', 'Tx.TEST', 'ForegroundColor', [0.25 0.25 0.25], ...
'FontSize', 10, 'FontWeight', 'bold', ...
'Callback', 'dCommAnalysis(''TxTest_callback'')');
hdl.RxTestbtn = uicontrol(...
'Parent', dCommAnalysisFig, ...
'Style', 'pushbutton', ...
'Units', 'normalized', ...
'Position', [0.1478 0.9 0.13 0.07], ...
'String', 'Rx.TEST', 'ForegroundColor', [0.25 0.25 0.25], ...
'FontSize', 10, 'FontWeight', 'bold', ...
'Callback', 'dCommAnalysis(''RxTest_callback'')');
hdl.FMTestbtn = uicontrol(...
'Parent', dCommAnalysisFig, ...
'Style', 'pushbutton', ...
'Units', 'normalized', ...
'Position', [0.2756 0.9 0.13 0.07], ...
'String', 'FM.TEST', 'ForegroundColor', [0.25 0.25 0.25], ...
'FontSize', 10, 'FontWeight', 'bold', ...
'Callback', 'dCommAnalysis(''FMTest_callback'')');
%load BtnCDataGSCH
%set()
hdl.bckPanel = uipanel(...
'Parent', dCommAnalysisFig, ...
'Units', 'normalized', ...
'Position', [0.02 0.1 0.96 0.8], ...
'BorderType', 'beveledout', ...
'BackgroundColor', Envi.bckgrdColor+0.05);
hdl.ViewAxes = axes(...
'Parent', hdl.bckPanel, ...
'Units', 'normalized', ...
'Position', [0.08 0.42 0.5 0.5], ...
'Box', 'on', 'xGrid', 'on', 'yGrid', 'on');
t = [-3:0.001:3];
x = sin(2*pi*8*t);
y = awgn(x,10,'measured',12345,'db');
plot(hdl.ViewAxes,t,y,'m');grid on;
title('Receive IF Signal');xlabel('time (s)');ylabel('Magnitude');
hold on;
% -------------------------------------
% checkbox
% -------------------------------------
left = 0.6;
bottom = 0.87;
space = 0.02;
chkBoxHeight = 0.05;
chkBoxWidth = 0.15;
chkBoxPos = [left,bottom,chkBoxWidth,chkBoxHeight];
hdl.NewfigchkBox = uicontrol(...
'Parent', hdl.bckPanel, ...
'Style', 'checkbox', ...
'Units', 'normalized', ...
'Position', chkBoxPos, ...
'BackgroundColor', Envi.bckgrdColor+0.05, ...
'FontSize', Envi.fontSize, ...
'String', 'New Figure', ...
'callback', 'figure');
chkBoxPos = [left,bottom - chkBoxHeight - space,chkBoxWidth,chkBoxHeight];
hdl.GridonchkBox = uicontrol(...
'Parent', hdl.bckPanel, ...
'Style', 'checkbox', ...
'Units', 'normalized', ...
'Position', chkBoxPos, ...
'BackgroundColor', Envi.bckgrdColor+0.05, ...
'FontSize', Envi.fontSize, ...
'String', 'Grid on', ...
'callback', 'figure');
chkBoxPos = [left,bottom - 2*chkBoxHeight - 2*space,chkBoxWidth,chkBoxHeight];
hdl.HoldonchkBox = uicontrol(...
'Parent', hdl.bckPanel, ...
'Style', 'checkbox', ...
'Units', 'normalized', ...
'Position', chkBoxPos, ...
'BackgroundColor', Envi.bckgrdColor+0.05, ...
'FontSize', Envi.fontSize, ...
'String', 'Hold on', ...
'callback', 'figure');
chkBoxPos = [left,bottom - 3*chkBoxHeight - 3*space,chkBoxWidth,chkBoxHeight];
hdl.AdjustXchkBox = uicontrol(...
'Parent', hdl.bckPanel, ...
'Style', 'checkbox', ...
'Units', 'normalized', ...
'Position', chkBoxPos, ...
'BackgroundColor', Envi.bckgrdColor+0.05, ...
'FontSize', Envi.fontSize, ...
'String', 'Adjust X-Axes', ...
'callback', 'dCommAnalysis(''AdjustXchkBox_callback'')');
labelPos = [left,bottom - 4*chkBoxHeight - 4*space,0.38*chkBoxWidth,chkBoxHeight];
uicontrol(...
'Parent', hdl.bckPanel, ...
'Style', 'text', ...
'Units', 'normalized', ...
'Position', labelPos, ...
'BackgroundColor', Envi.bckgrdColor+0.05, ...
'FontSize', Envi.fontSize, ...
'String', 'Min:', ...
'HorizontalAlignment', 'right');
minEditPos = [left+0.4*chkBoxWidth,bottom-4*chkBoxHeight-3.5*space, ...
0.5*chkBoxWidth, 0.8*chkBoxHeight];
hdl.XminEdit = uicontrol(...
'Parent', hdl.bckPanel, ...
'Style', 'edit', ...
'Units', 'normalized', ...
'Position', minEditPos, ...
'BackgroundColor', Envi.bckgrdColor+0.05, ...
'FontSize', Envi.fontSize, ...
'String', '0', ...
'enable', 'off', ...
'callback', 'dCommAnalysis(''XAdjustEdit_callback'')');
labelPos = [left,bottom - 5*chkBoxHeight - 5*space,0.38*chkBoxWidth,chkBoxHeight];
uicontrol(...
'Parent', hdl.bckPanel, ...
'Style', 'text', ...
'Units', 'normalized', ...
'Position', labelPos, ...
'BackgroundColor', Envi.bckgrdColor+0.05, ...
'FontSize', Envi.fontSize, ...
'String', 'Max:', ...
'HorizontalAlignment', 'right');
maxEditPos = [left+0.4*chkBoxWidth,bottom-5*chkBoxHeight-4.5*space, ...
0.5*chkBoxWidth, 0.8*chkBoxHeight];
hdl.XmaxEdit = uicontrol(...
'Parent', hdl.bckPanel, ...
'Style', 'edit', ...
'Units', 'normalized', ...
'Position', maxEditPos, ...
'BackgroundColor', Envi.bckgrdColor+0.05, ...
'FontSize', Envi.fontSize, ...
'String', '1', ...
'enable', 'off', ...
'callback', 'dCommAnalysis(''XAdjustEdit_callback'')');
left = 0.78;
right = 0.94;
top = 0.9;
bottom = 0.4;
frmBorder = 0.02;
space = 0.02;
radiobtnHeight = 0.05;
radiobtnWidth = 0.15;
frmPos=[left-frmBorder bottom-frmBorder (right-left)+2*frmBorder ...
(top-bottom)+2*frmBorder];
hdl.radiobtngrp = uibuttongroup(...
'Parent', hdl.bckPanel, ...
'Units', 'normalized', ...
'Position', frmPos, ...
'BackgroundColor', Envi.bckgrdColor, ...
'SelectionChangeFcn', {@ViewChngAxes});
sliderPos = [right bottom-frmBorder 1.2*frmBorder (top-bottom)+2*frmBorder];
uicontrol(...
'Parent', hdl.bckPanel, ...
'Style', 'slider', ...
'Units', 'normalized', ...
'Position',sliderPos, 'Enable', 'off');
left = 0.08;
right = 0.9;
top = 0.85;
space = 0.02;
radiobtnHeight = 0.1;
radiobtnWidth = 0.8;
radiobtnPos = [left top radiobtnWidth radiobtnHeight];
hdl.IFradiobtn = uicontrol(...
'Parent',hdl.radiobtngrp, ...
'Style', 'radiobutton', ...
'Units','normalized', ...
'Position',radiobtnPos, ...
'Value', 1, ...
'String', 'IF Signal', ...
'BackgroundColor', Envi.bckgrdColor, ...
'FontSize', Envi.fontSize);
radiobtnPos = [left top-radiobtnHeight-space radiobtnWidth radiobtnHeight];
hdl.IFSpectrumradiobtn = uicontrol(...
'Parent',hdl.radiobtngrp, ...
'Style', 'radiobutton', ...
'Units','normalized', ...
'Position',radiobtnPos, ...
'String', 'Spectrum(IF)', ...
'BackgroundColor', Envi.bckgrdColor, ...
'FontSize', Envi.fontSize);
radiobtnPos = [left top-2*radiobtnHeight-2*space radiobtnWidth radiobtnHeight];
hdl.Iplotradiobtn = uicontrol(...
'Parent',hdl.radiobtngrp, ...
'Style', 'radiobutton', ...
'Units','normalized', ...
'Position',radiobtnPos, ...
'String', 'I-Sig Plot', ...
'BackgroundColor', Envi.bckgrdColor, ...
'FontSize', Envi.fontSize);
radiobtnPos = [left top-3*radiobtnHeight-3*space radiobtnWidth radiobtnHeight];
hdl.Qplotradiobtn = uicontrol(...
'Parent',hdl.radiobtngrp, ...
'Style', 'radiobutton', ...
'Units','normalized', ...
'Position',radiobtnPos, ...
'String', 'Q-Sig Plot', ...
'BackgroundColor', Envi.bckgrdColor, ...
'FontSize', Envi.fontSize);
radiobtnPos = [left top-4*radiobtnHeight-4*space radiobtnWidth radiobtnHeight];
hdl.Phaseradiobtn = uicontrol(...
'Parent',hdl.radiobtngrp, ...
'Style', 'radiobutton', ...
'Units','normalized', ...
'Position',radiobtnPos, ...
'String', 'I/Q Phase', ...
'BackgroundColor', Envi.bckgrdColor, ...
'FontSize', Envi.fontSize);
radiobtnPos = [left top-5*radiobtnHeight-5*space radiobtnWidth radiobtnHeight];
hdl.Constellationradiobtn = uicontrol(...
'Parent',hdl.radiobtngrp, ...
'Style', 'radiobutton', ...
'Units','normalized', ...
'Position',radiobtnPos, ...
'String', 'Constellation', ...
'BackgroundColor', Envi.bckgrdColor, ...
'FontSize', Envi.fontSize);
radiobtnPos = [left top-6*radiobtnHeight-6*space radiobtnWidth radiobtnHeight];
hdl.Eyeradiobtn = uicontrol(...
'Parent',hdl.radiobtngrp, ...
'Style', 'radiobutton', ...
'Units','normalized', ...
'Position',radiobtnPos, ...
'String', 'Eye Diagram', ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -