?? setparam.asv
字號:
function varargout = SetParam(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @SetParam_OpeningFcn, ...
'gui_OutputFcn', @SetParam_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 SetParam is made visible.
function SetParam_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
hDSimSoft = findobj(allchild(0), 'tag', 'DSimSoft');
if isempty(hDSimSoft) || isempty(varargin)
msgbox(['This Program could not run all alone!', ...
' It was designed to be called from DSimSoft program.'], ...
'ERROR', 'ERROR');
delete(handles.output);
return
else
param.src = getappdata(hDSimSoft, 'src');
param.mod = getappdata(hDSimSoft, 'mod');
param.rrc = getappdata(hDSimSoft, 'rrc');
param.awgn = getappdata(hDSimSoft, 'awgn');
param.fade = getappdata(hDSimSoft, 'fade');
end
choice = varargin{1};
passparam(handles, param, choice);
% UIWAIT makes SetParam wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = SetParam_OutputFcn(hObject, eventdata, handles)
%varargout{1} = handles.output;
% --- Executes on slider movement.
function slider2_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function slider2_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on button press in btn_Default.
function btn_Default_Callback(hObject, eventdata, handles, varargin)
hDSimSoft = findobj(allchild(0), 'tag', 'DSimSoft');
param = getappdata(hDSimSoft, 'DefaultParam');
if isempty(varargin)
h = findobj(allchild(0), 'tag', 'list_ParamSet');
choice = get(h, 'value');
else
choice = varargin{1};
end
passparam(handles, param, choice);
% ----------------- sub funciton -----------------
function passparam(handles, param, choice)
switch choice,
case 1,
set(handles.uipanel1, 'Title', 'Source Signal');
set(handles.txt_str1, 'string', 'Number of bits:');
set(handles.edt_value1, 'string', num2str(param.src.BitNum));
set(handles.txt_str2, 'string', 'Initial Seed:');
set(handles.edt_value2, 'string', num2str(param.src.InitSeed));
set([handles.txt_str3, handles.txt_str4, handles.txt_str5, ...
handles.txt_str6], 'string', '<no used>');
set([handles.edt_value3, handles.edt_value4, handles.edt_value5, ...
handles.edt_value6], 'string', '<no used>', ...
'enable', 'off');
set([handles.edt_value1, handles.edt_value4], 'style', 'edit');
case 3,
set(handles.uipanel1, 'Title', 'Modulatin baseband');
set(handles.txt_str1, 'string', 'Method:');
set(handles.edt_value1, 'style', 'popupmenu', ...
'string', param.mod.method);
set(handles.txt_str2, 'string', 'Fd (sym/sec):');
set(handles.edt_value2, 'string', num2str(param.mod.Fd));
set(handles.txt_str3, 'string', 'Modulation Index:');
set(handles.edt_value3, 'enable', 'on', ...
'string', num2str(param.mod.Index));
set(handles.txt_str4, 'string', 'Samples per Symbol:');
set(handles.edt_value4, 'enable', 'on', ...
'string', num2str(param.mod.nSamp));
set(handles.edt_value4, 'style', 'edit');
case 5,
set(handles.uipanel1, 'Title', 'Pluse Shape');
set(handles.txt_str1, 'string', 'Type:');
set(handles.edt_value1, 'style', 'popupmenu', ...
'string', param.rrc.type, ...
'HorizontalAlignment', 'center');
set(handles.txt_str2, 'string', 'Samples per Symbol:');
set(handles.edt_value2, 'string', num2str(param.rrc.OverSamp));
set(handles.txt_str3, 'string', 'RollOff Factor:');
set(handles.edt_value3, 'enable', 'on', ...
'string', num2str(param.rrc.RollOff));
set(handles.txt_str4, 'string', 'Filter Order:');
set(handles.edt_value4, 'enable', 'on', ...
'string', num2str(param.rrc.Order));
set(handles.edt_value4, 'style', 'edit');
case 7,
set(handles.uipanel1, 'Title', 'AWGN');
set(handles.txt_str1, 'string', 'EbNo:');
set(handles.edt_value1, 'string', num2str(param.awgn.EbNo));
set(handles.txt_str2, 'string', 'Initial Seed:');
set(handles.edt_value2, 'string', num2str(param.awgn.InitSeed));
set(handles.txt_str3, 'string', 'Signal Power:');
if isstr(param.awgn.power)
set(handles.edt_value3, 'enable', 'on', ...
'string', param.awgn.power);
else
set(handles.edt_value3, 'enable', 'on', ...
'string', num2str(param.awgn.power));
end
set(handles.txt_str4, 'string', 'Signal Power Type:');
set(handles.edt_value4, 'enable', 'on', ...
'Style', 'popupmenu', ...
'string', {'db';'linear'}, ...
'value',param.awgn.powertype);
set(handles.edt_value1, 'style', 'edit');
case 8,
set(handles.uipanel1, 'Title', 'Rayleigh Fading');
set(handles.txt_str1, 'string', 'Frequency Shift (Hz):');
set(handles.edt_value1, 'string', num2str(param.fade.FrqShift));
set(handles.txt_str2, 'string', 'Delay Vector:');
set(handles.edt_value2, 'string', num2str(param.fade.DelayVec));
set(handles.txt_str3, 'string', 'Gain Vector:');
set(handles.edt_value3, 'enable', 'on', ...
'string', num2str(param.fade.GainVec));
set([handles.txt_str4, handles.txt_str5, ...
handles.txt_str6], 'string', '<no used>');
set([handles.edt_value4, handles.edt_value5, ...
handles.edt_value6], 'string', '<no used>', ...
'enable', 'off');
set([handles.edt_value1, handles.edt_value4], 'style', 'edit');
otherwise
return
end
% --- Executes on button press in btn_OK.
function btn_OK_Callback(hObject, eventdata, handles)
h = findobj(allchild(0), 'tag', 'list_ParamSet');
choice = get(h, 'value');
switch choice
case 1
param.src.BitNum = ...
str2num(get(handles.edt_value1, 'string'));
param.src.InitSeed = ...
str2num(get(handles.edt_value2, 'string'));
hDSimSoft = findobj(allchild(0), 'tag', 'DSimSoft');
setappdata(hDSimSoft, 'src', param.src);
case 3,
param.mod.method = 'cp4fsk';
param.mod.Fd = ...
str2num(get(handles.edt_value2, 'string'));
param.mod.Index = ...
str2num(get(handles.edt_value3, 'string'));
param.mod.nSamp = ...
str2num(get(handles.edt_value4, 'string'));
hDSimSoft = findobj(allchild(0), 'tag', 'DSimSoft');
setappdata(hDSimSoft, 'mod', param.mod);
case 5
param.rrc.type = 'RRC';
param.rrc.OverSamp = ...
str2num(get(handles.edt_value2, 'string'));
param.rrc.RollOff = ...
str2num(get(handles.edt_value3, 'string'));
param.rrc.Order = ...
str2num(get(handles.edt_value4, 'string'));
param.rrc.Delay = param.rrc.Order/(2*param.rrc.OverSamp);
hDSimSoft = findobj(allchild(0), 'tag', 'DSimSoft');
setappdata(hDSimSoft, 'rrc', param.rrc);
case 7
param.awgn.EbNo = ...
str2num(get(handles.edt_value1, 'string'));
param.awgn.InitSeed = ...
str2num(get(handles.edt_value2, 'string'));
param.awgn.power = ...
get(handles.edt_value3, 'string');
param.awgn.powertype = ...
get(handles.edt_value4, 'value');
hDSimSoft = findobj(allchild(0), 'tag', 'DSimSoft');
setappdata(hDSimSoft, 'awgn', param.awgn);
case 8,
hDSimSoft = findobj(allchild(0), '')
param.mod = getappdata(handles.output, 'mod');
param.rrc = getappdata(handles.output, 'rrc');
param.fade.Td = 1/(4800*param.mod.nSamp*param.rrc.OverSamp);
param.fade.FrqShift = ...
str2num(get(handles.edt_value1, 'string'));
param.fade.DelayVec = ...
str2num(get(handles.edt_value2, 'string'));
param.fade.GainVec = ...
str2num(get(handles.edt_value3, 'string'));
hDSimSoft = findobj(allchild(0), 'tag', 'DSimSoft');
setappdata(hDSimSoft, 'fade', param.fade);
otherwise
return
end
close;
function edt_value1_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function edt_value1_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edt_value2_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function edt_value2_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edt_value3_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function edt_value3_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edt_value4_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function edt_value4_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edt_value5_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function edt_value5_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edt_value6_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function edt_value6_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), ...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -