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

📄 dcommanalysis.m

📁 一个仿真测试4FSK信号的matlab环境GUI程序。可以查看基带IQ波形、眼图、星座图。并可以仿真高斯白噪声、瑞利衰减对信号的影响。
💻 M
📖 第 1 页 / 共 2 页
字号:
    'BackgroundColor', Envi.bckgrdColor, ...
    'FontSize', Envi.fontSize);

left = -0.0022;
right = 1.003;
top = 0.31;
bottom = -0.005;
frmBorder = 0.000;
frmPos = [left-frmBorder bottom-frmBorder (right-left)+2*frmBorder ...
    (top-bottom)+2*frmBorder];
uipanel(...
    'Parent', hdl.bckPanel, ...
    'Units', 'normalized', ...
    'Position', frmPos, ...
    'BackgroundColor', Envi.bckgrdColor+0.05, ...
    'BorderType', 'etchedin', ...
    'HighlightColor', [0.8 0.8 0.8]);

% -----------------------------------
% parameter setting frame and buttom.
% -----------------------------------
left = 0.1;
right = 0.26;
top = 0.282;
bottom = 0.04;
frmBorder = 0.02;
frmPos = [left-frmBorder bottom-frmBorder (right-left)+2*frmBorder ...
    (top-bottom)+2*frmBorder];
uipanel(...
    'Parent', hdl.bckPanel, ...
    'Title', 'Parameter', ...
    'Units', 'normalized', ...
    'Position', frmPos, ...
    'BackgroundColor', Envi.bckgrdColor+0.05, ...
    'FontSize', Envi.fontSize, ...
    'ForegroundColor', [.558 .491 .082], ...
    'fontweight', 'bold');

btnWidth = right - left;
btnHeight = 0.06;
space = 0.01;
btnPos = [left top-btnHeight-frmBorder-space btnWidth btnHeight];
hdl.paraSettingbtn = uicontrol(...
    'Parent', hdl.bckPanel, ...
    'Style', 'pushbutton', ...
    'Units', 'normalized', ...
    'Position', btnPos, ...
    'String', 'Setting', ...
    'FontSize', Envi.fontSize, ...
    'callback', 'ParamSetting');
btnPos = [left top-2*btnHeight-frmBorder-2*space btnWidth btnHeight];
hdl.paraImportbtn = uicontrol(...
    'Parent', hdl.bckPanel, ...
    'Style', 'pushbutton', ...
    'Units', 'normalized', ...
    'Position', btnPos, ...
    'String', 'Import', ...
    'FontSize', Envi.fontSize);
btnPos = [left top-3*btnHeight-frmBorder-3*space btnWidth btnHeight];
hdl.paraExportbtn = uicontrol(...
    'Parent', hdl.bckPanel, ...
    'Style', 'pushbutton', ...
    'Units', 'normalized', ...
    'Position', btnPos, ...
    'String', 'Export', ...
    'FontSize', Envi.fontSize);

% -------------------------------------
%  Import .txt data stored in computer.
% -------------------------------------
left      = 0.33;
right     = 0.49;
top       = 0.26;
space     = 0.01;
bottom    = 0.045;
frmBorder = 0.02;
frmPos = [left-frmBorder bottom-frmBorder (right-left)+2*frmBorder ...
    (top-bottom)+2*frmBorder];
uicontrol(...
    'Parent', hdl.bckPanel, ...
    'Style', 'frame', ...
    'Units', 'normalized', ...
    'Position', frmPos, ...
    'foregroundColor', [0.655 0.655 0.655], ...
    'BackgroundColor', Envi.bckgrdColor-0.03);
txtWidth = right - left + 1.5*frmBorder;
txtHeight = 0.15;
textPos = [left-0.8*frmBorder top-txtHeight txtWidth txtHeight];
txtStr = 'Import IF data from the .txt file stored in your computer.';
uicontrol(...
    'Parent', hdl.bckPanel, ...
    'Style', 'text', ...
    'Units', 'normalized', ...
    'Position', textPos, ...
    'BackgroundColor', Envi.bckgrdColor-0.03, ...
    'min',0, 'max', 2, ...
    'String', txtStr, ...
    'fontsize', Envi.fontSize, ...
    'ForegroundColor', [0.555 0.455 0.455], ...
    'fontweight', 'bold');
btnWidth = right - left;
btnHeight = 0.06;
btnPos = [left bottom+space btnWidth btnHeight];
hdl.Importbtn = uicontrol(...
    'Parent', hdl.bckPanel, ...
    'Style', 'pushbutton', ...
    'Units', 'normalized', ...
    'Position', btnPos, ...
    'String', 'Import IF Data', ...
    'fontsize', Envi.fontSize, ...
    'callback', 'dCommAnalysis(''Importbtn_callback'')');


% --------------------------------------
% Apply and save
% --------------------------------------
left      = 0.56;
right     = 0.72;
top       = 0.26;
space     = 0.01;
bottom    = 0.19;
frmBorder = 0.02;
frmPos = [left-frmBorder bottom-frmBorder (right-left)+2*frmBorder ...
    (top-bottom)+2*frmBorder];
uicontrol(...
    'Parent', hdl.bckPanel, ...
    'Style', 'frame', ...
    'Units', 'normalized', ...
    'Position', frmPos, ...
    'foregroundColor', [0.455 0.455 0.455], ...
    'BackgroundColor', Envi.bckgrdColor-0.2);
btnPos = [left top-btnHeight btnWidth btnHeight];
hdl.Applybtn = uicontrol(...
    'parent', hdl.bckPanel, ...
    'Style', 'pushbutton', ...
    'Units', 'normalized', ...
    'Position', btnPos, ...
    'String', 'Apply', ...
    'fontsize', Envi.fontSize);
left      = 0.56;
right     = 0.72;
top       = 0.125;
space     = 0.01;
bottom    = 0.05;
frmBorder = 0.02;
frmPos = [left-frmBorder bottom-frmBorder (right-left)+2*frmBorder ...
    (top-bottom)+2*frmBorder];
uicontrol(...
    'Parent', hdl.bckPanel, ...
    'Style', 'frame', ...
    'Units', 'normalized', ...
    'Position', frmPos, ...
    'foregroundColor', [0.455 0.455 0.455], ...
    'BackgroundColor', Envi.bckgrdColor-0.2);
btnPos = [left top-1.1*btnHeight btnWidth btnHeight];
hdl.SaveDatabtn = uicontrol(...
    'parent', hdl.bckPanel, ...
    'Style', 'pushbutton', ...
    'Units', 'normalized', ...
    'Position', btnPos, ...
    'String', 'Save Data', ...
    'fontsize', Envi.fontSize);

% ------------------------------
%  Help / About / Exit 
% ------------------------------
left      = 0.79;
right     = 0.9;
top       = 0.26;
space     = 0.01;
bottom    = 0.05;
frmBorder = 0.02;
panelPos = [left-frmBorder bottom-frmBorder (right-left)+2*frmBorder ...
    (top-bottom)+2*frmBorder];
uicontrol(...
    'Parent', hdl.bckPanel, ...
    'style', 'frame', ...
    'Units', 'normalized', ...
    'Position', panelPos, ...
    'BackgroundColor', Envi.bckgrdColor-0.08, ...
    'foregroundColor', [0.555 0.555 0.555], ...
    'fontweight', 'bold', ...
    'FontSize', Envi.fontSize);
btnWidth = right - left;
btnHeight = 0.06;
space = 0.01;
btnPos = [left top-btnHeight btnWidth btnHeight];
hdl.Helpbtn = uicontrol(...
    'Parent', hdl.bckPanel, ...
    'Style', 'pushbutton', ...
    'Units', 'normalized', ...
    'Position', btnPos, ...
    'String', 'Help', ...
    'FontSize', Envi.fontSize);
btnPos = [left top-2*btnHeight-space btnWidth btnHeight];
hdl.Aboutbtn = uicontrol(...
    'Parent', hdl.bckPanel, ...
    'Style', 'pushbutton', ...
    'Units', 'normalized', ...
    'Position', btnPos, ...
    'String', 'About', ...
    'FontSize', Envi.fontSize);
btnPos = [left top-3*btnHeight-2*space btnWidth btnHeight];
hdl.Exitbtn = uicontrol(...
    'Parent', hdl.bckPanel, ...
    'Style', 'pushbutton', ...
    'Units', 'normalized', ...
    'Position', btnPos, ...
    'String', 'Exit', ...
    'FontSize', Envi.fontSize, ...
    'callback', 'dCommAnalysis(''Exitbtn_callback'')');


set(dCommAnalysisFig, 'UserData', hdl);


% ========================================================================
%              Call back routine function

function TxTest_callback()
hdl = get(gcf, 'UserData');
set(hdl.TxTestbtn, 'enable', 'off');
set([hdl.RxTestbtn hdl.FMTestbtn], 'enable', 'on');
set(hdl.TxTestbtn, 'Position', [0.02 0.9 0.13 0.07+0.01]);
set(hdl.RxTestbtn, 'Position', [0.1478 0.9 0.13 0.07]);
set(hdl.FMTestbtn, 'Position', [0.2756 0.9 0.13 0.07]);

function RxTest_callback()
hdl = get(gcf, 'UserData');
set(hdl.RxTestbtn, 'enable', 'off');
set([hdl.TxTestbtn hdl.FMTestbtn], 'enable', 'on');
set(hdl.TxTestbtn, 'Position', [0.02 0.9 0.13 0.07]);
set(hdl.RxTestbtn, 'Position', [0.1478 0.9 0.13 0.07+0.01]);
set(hdl.FMTestbtn, 'Position', [0.2756 0.9 0.13 0.07]);

function FMTest_callback()
hdl = get(gcf, 'UserData');
set(hdl.FMTestbtn, 'enable', 'off');
set([hdl.RxTestbtn hdl.TxTestbtn], 'enable', 'on');
set(hdl.TxTestbtn, 'Position', [0.02 0.9 0.13 0.07]);
set(hdl.RxTestbtn, 'Position', [0.1478 0.9 0.13 0.07]);
set(hdl.FMTestbtn, 'Position', [0.2756 0.9 0.13 0.07+0.01]);

function IFradiobtn_callback()
figure;

function ViewChngAxes(hdlbtnGroup, evenData, varargin)
hdl = get(gcf, 'UserData');
if (hdl.radiobtngrp == hdlbtnGroup)&&(evenData.NewValue == hdl.IFradiobtn)
    figure;
end

function AdjustXchkBox_callback()
hdl = get(gcf, 'UserData');
if get(hdl.AdjustXchkBox, 'value')==1
    set([hdl.XminEdit hdl.XmaxEdit],'enable','on');
    Xmin = str2num(get(hdl.XminEdit, 'string'));
    Xmax = str2num(get(hdl.XmaxEdit, 'string'));
    set(hdl.ViewAxes, 'XLim', [Xmin Xmax]);
else
    set([hdl.XminEdit hdl.XmaxEdit],'enable','off');
end 
    
function XAdjustEdit_callback()
hdl = get(gcf,'UserData');
Xmin = str2num(get(hdl.XminEdit, 'string'));
Xmax = str2num(get(hdl.XmaxEdit, 'string'));
if Xmin>=Xmax
    msgbox('ERROR: max must large than min!','ERROR','error');
else
    set(hdl.ViewAxes, 'XLim', [Xmin Xmax]);
end

function Importbtn_callback()
figure;

function Exitbtn_callback()
close

⌨️ 快捷键说明

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