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

📄 receivertest.asv

📁 一个仿真测试4FSK信号的matlab环境GUI程序。可以查看基带IQ波形、眼图、星座图。并可以仿真高斯白噪声、瑞利衰减对信号的影响。
💻 ASV
📖 第 1 页 / 共 3 页
字号:
function varargout = ReceiverTest(varargin)
% RECEIVERTEST M-file for ReceiverTest.fig
% Begin initialization code
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @ReceiverTest_OpeningFcn, ...
                   'gui_OutputFcn',  @ReceiverTest_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 ReceiverTest is made visible.
function ReceiverTest_OpeningFcn(hObject, eventdata, handles, varargin)
% wati bar.
mainfig = findobj(allchild(0),'tag','ReceiverTest');
if strcmp(get(mainfig,'visible'),'off'),
    h=waitbar(0,'ReceiverTest','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

handles.output = hObject;
% -----------------
handles.param.src.BitNum = 9600;
handles.param.src.InitSeed = 12345;

handles.param.mod.Fd = 4800;
%handles.param.mod.FrqDev = 1296;
handles.param.mod.nSamp = 8;
handles.param.mod.Index = 0.27;

handles.param.rrc.Order = 64;
handles.param.rrc.OverSamp = 16;
handles.param.rrc.Delay = 2;
handles.param.rrc.RollOf = 0.2;

handles.param.awgn.EbNo = 10;

handles.param.fading.Td = 1/(4800*handles.param.mod.nSamp*handles.param.rrc.OverSamp);
handles.param.fading.frqShift = 40;
handles.param.fading.DelayVec = [0 2e-6];
handles.param.fading.GainVec = [0 -3];
% -----------------
handles.CurrentPath = pwd;
addpath(handles.CurrentPath);
% Update handles structure
guidata(hObject, handles);

set(handles.txt_Date,'string',['Current Date: ',date]);
set(handles.txt_Status,'string','Status: Ready');
axes(handles.axes_Src);
title('Source Signal');xlabel('Number');ylabel('Amplitude');
axes(handles.axes_RRC);
title('Square Root Raised Cosine Filter-Impluse Response');
xlabel('Sample');ylabel('Amplitude');

set(hObject, 'CloseRequestFcn', 'my_closereq');

% UIWAIT makes ReceiverTest wait for user response (see UIRESUME)
% uiwait(handles.ReceiverTest);


% --- Outputs from this function are returned to the command line.
function varargout = ReceiverTest_OutputFcn(hObject, eventdata, handles) 
% Get default command line output from handles structure
varargout{1} = handles.output;

% =================================================================
function edt_Src_BitNum_Callback(hObject, eventdata, handles)
value = str2num(get(handles.edt_Src_BitNum,'string'));
if isempty(value)
    msgbox('Get a invalid number in the ''BitNum'' Edit field. Check again!','ERROR','ERROR');
    return
else
    if fix(value/100) ~= value/100
        msgbox('BitNum must be mutiple of 100.', 'ERROR', 'ERROR');
        return
    end
end
set(handles.btn_Apply, 'enable', 'on');

% --- Executes during object creation, after setting all properties.
function edt_Src_BitNum_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% ==================================================================
function edt_Src_InitSeed_Callback(hObject, eventdata, handles)
value = str2num(get(handles.edt_Src_InitSeed,'string'));
if isempty(value)
    msgbox('Get a invalid number in the ''InitSeed'' Edit field. Check again!','ERROR','ERROR');
    return
end
set(handles.btn_Apply, 'enable', 'on');

% --- Executes during object creation, after setting all properties.
function edt_Src_InitSeed_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('Get a invalid number in the ''Fd'' Edit field. Check again!','ERROR','ERROR');
    return
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

% =================================================================
% --- Executes on selection change in pop_Mod_Method.
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_Index_Callback(hObject, eventdata, handles)
value = str2num(get(handles.edt_Mod_Index,'string'));
if isempty(value)
    msgbox('Get a invalid number in the ''Index'' Edit field. Check again!','ERROR','ERROR');
    return
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('Get a invalid number in the ''nSamp'' Edit field. Check again!','ERROR','ERROR');
    return
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.
function pop_RRC_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function pop_RRC_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('Get a invalid number in the ''OverSamp'' Edit field. Check again!','ERROR','ERROR');
    return
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('Get a invalid number in the ''Delay'' Edit field. Check again!','ERROR','ERROR');
    return
end
set(handles.btn_Apply, 'enable', 'on');

% --- Executes during object creation, after setting all properties.
function edt_RRC_RollOff_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('Get a invalid number in the ''Order'' Edit field. Check again!','ERROR','ERROR');
    return
else
    if value<1
        msgbox('Filter order must great than one.','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_AWGN_EbNo_Callback(hObject, eventdata, handles)
value = str2num(get(handles.edt_AWGN_EbNo,'string'));
if isempty(value)
    msgbox('Get a invalid number in the ''EbNo'' Edit field. Check again!','ERROR','ERROR');
    return
end
set(handles.btn_Apply, 'enable', 'on');

% --- Executes during object creation, after setting all properties.
function edt_AWGN_EbNo_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% ================================================================
function edt_Fading_FrqShift_Callback(hObject, eventdata, handles)
value = str2num(get(handles.edt_Fading_FrqShift,'string'));
if isempty(value)
    msgbox('Get a invalid number in the ''Freq Shift'' Edit field. Check again!','ERROR','ERROR');
    return
end
set(handles.btn_Apply, 'enable', 'on');

% --- Executes during object creation, after setting all properties.
function edt_Fading_FrqShift_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% ================================================================
function edt_Fading_DelayVec_Callback(hObject, eventdata, handles)
value = str2num(get(handles.edt_Fading_DelayVec,'string'));
if isempty(value)
    msgbox('Get a invalid number in the ''Delay Vec'' Edit field. Check again!','ERROR','ERROR');
    return
end
set(handles.btn_Apply, 'enable', 'on');

⌨️ 快捷键说明

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