📄 ui_params.m
字号:
Nd=length(d0);
set(h_f0,'String',['[' num2str(f0.') ']']);
set(h_d0,'String',['[' num2str(d0.') ']']);
set(h_f0,'Enable','inactive');
set(h_d0,'Enable','inactive');
set(h_len,'String',['[' num2str([Nf Nd]) ']']);
end;
% Spike at the end of forward filter
case 6,
f0=zeros(Nf,1);
f0(Nf)=1;
d0=zeros(Nd,1);
set(h_f0,'String',['[' num2str(f0.') ']']);
set(h_d0,'String',['[' num2str(d0.') ']']);
set(h_f0,'Enable','inactive');
set(h_d0,'Enable','inactive');
% Previous results
case 7,
if isempty(fL)
f0=zeros(Nf,1);
set(h_f0,'String',['[' num2str(f0.') ']']);
d0=zeros(Nd,1);
set(h_d0,'String',['[' num2str(d0.') ']']);
warn('Previous final responses not available.',...
'Setting f(0)=0, d(0)=0.');
else
f0=fL;
d0=dL;
set(h_f0,'String',['[' num2str(f0.') ']']);
set(h_d0,'String',['[' num2str(d0.') ']']);
set(h_f0,'Enable','inactive');
set(h_d0,'Enable','inactive');
end;
% Custom
case 8,
if ~isempty(findstr('.mat',get(h_f0,'String')))
f0=zeros(Nf,1);
set(h_f0,'String',['[' num2str(f0.') ']']);
end;
set(h_f0,'Enable','on');
if ~isempty(findstr('.mat',get(h_d0,'String')))
d0=zeros(Nd,1);
set(h_d0,'String',['[' num2str(d0.') ']']);
end;
set(h_d0,'Enable','on');
read_var=1;
% Read from file
case 9,
fname = get(h_f0,'String');
if isempty(findstr('.mat',fname)),
warn('File name needs .mat extension.',...
'Set filename to default f0.mat');
fname='f0.mat';
set(h_f0,'String',fname);
set(h_f0,'Enable','on');
read_init=1;
end
dname = get(h_d0,'String');
if isempty(findstr('.mat',dname)),
warn('File name needs .mat extension.',...
'Set filename to default d0.mat');
dname='d0.mat';
set(h_d0,'String',dname);
set(h_d0,'Enable','on');
read_init=1;
end
end;
end;
% Read in initialization
if isempty(Nfd)
if read_init
err_string = ['Request ignored! File "',fname,'" not found.'];
eval(['load ',fname,' f0'], 'disp(err_string)');
err_string = ['Request ignored! File "',dname,'" not found.'];
eval(['load ',dname,' d0'], 'disp(err_string)');
elseif read_var
f0=evalin('base',get(h_f0,'String'));
d0=evalin('base',get(h_d0,'String'));
end;
if ((length(f0)~=Nf) | (length(d0)~=Nd))
f0=zeros(Nf,1);
set(h_f0,'String',num2str(f0));
d0=zeros(Nd,1);
set(h_d0,'String',num2str(d0));
warn('Adaptive equalizer lengths must match settings above.',...
'Setting initializations to zero.');
set(h_f0,'String',['[' num2str(f0.') ']']);
set(h_d0,'String',['[' num2str(d0.') ']']);
end;
f0=f0(:);
d0=d0(:);
end;
% Check if length of initialization strings is too long
% to be read on the screen and warn user
if ((length(get(h_f0,'String'))>20) | (length(get(h_d0,'String'))>20))
warn('Initialization vectors are too long to fit in screen.',...
'Take a look at them by typing "dfec_global" and "f0", "d0"');
end;
% Data choice
data=get(h_data, 'Value');
if (data==1)
if ~isempty(findstr('.mat',get(h_sim,'String')))
set(h_sim,'String','[ 100 900 10]');
warn('Found filename.','Setting [Tr,Bl,Reps] to [100 900 10]');
end;
elseif (data==2)
if ~isempty(findstr('.mat',get(h_sim,'String')))
set(h_sim,'String','[ 100 900 10]');
warn('Found filename.','Setting [Tr,Bl,Reps] to [100 900 10]');
end;
elseif (data==3)
datname = get(h_sim,'String');
if isempty(findstr('.mat',datname)),
warn('File name needs .mat extension.',...
'Setting filename to default data.mat');
datname='data.mat';
set(h_sim,'String',datname);
end;
% Change delay to Range
if (isempty(get(h_del,'String')))
warn('Define single delay in "Range" box for training',...
'Setting to 1');
set(h_del,'String','1');
delay=1;
delta=1;
else
delay=str2num(get(h_del,'String'));
if (length(delay)>1 | min(delay)<1)
warn('Define single delay in "Range" box for training',...
'Setting to 1');
set(h_del,'String','1');
delay=1;
delta=1;
else
delta=delay;
end;
end;
set(h_del,'Enable','on');
set(h_deltype,'Value',5);
end;
% Use simulation data
if (data~=3)
% Length of simulation
Lsim=round(str2num(get(h_sim,'String')));
if ((Lsim(1)+Lsim(2))*Lsim(3)<1)
Lsim=[100 900 10];
set(h_sim,'String',['[' num2str(Lsim(1)) ' '...
num2str(Lsim(2)) ' '...
num2str(Lsim(3)) ']' ]);
warn('Duration of simulation must be positive',...
'Reseting [Tr,Bl,Reps] to [100 900 10]');
end;
end;
% Step-size
muf=str2num(get(h_muf,'String'));
mud=str2num(get(h_mud,'String'));
% Algorithm choice
algorithm=get(h_alg, 'Value');
% Regressor filtering?
if get(h_reg,'Value'),
regfilt=1;
else
regfilt=0;
end;
% Decide structure of adaptation
switch algorithm,
% DFE-LMS
case 1,
structure=2; % DFE structure
alg1=1; % LMS algorithm
alg2=2; % no blind algorithm (DD by default)
if ((muf(2)~=0) | (mud(2)~=0))
set(h_muf,'String',['['num2str(muf(1)) ',0]']);
set(h_mud,'String',['['num2str(mud(1)) ',0]']);
muf=[muf(1) 0];
mud=[mud(1) 0];
warn('Training mode only.',...
'Setting second set of stepsizes to zero.');
end;
% DFE-DD
case 2,
structure=2; % DFE structure
alg1=2; % DD algorithm
alg2=2; % DD algorithm
set(h_muf,'String',['['num2str(muf(1)) ',' num2str(muf(2)) ']']);
set(h_mud,'String',['['num2str(mud(1)) ',' num2str(mud(2)) ']']);
%set(h_muf,'String',['['num2str(muf(2)) ',' num2str(muf(2)) ']']);
%set(h_mud,'String',['['num2str(mud(2)) ',' num2str(mud(2)) ']']);
%muf=[muf(2) muf(2)];
%mud=[mud(2) mud(2)];
%warn('Blind mode only.','Resetting first set of stepsizes.');
% DFE-CMA
case 3,
structure=2; % DFE structure
alg1=3; % CMA algorithm
alg2=3; % CMA algorithm
set(h_muf,'String',['['num2str(muf(1)) ',' num2str(muf(2)) ']']);
set(h_mud,'String',['['num2str(mud(1)) ',' num2str(mud(2)) ']']);
%set(h_muf,'String',['['num2str(muf(2)) ',' num2str(muf(2)) ']']);
%set(h_mud,'String',['['num2str(mud(2)) ',' num2str(mud(2)) ']']);
%muf=[muf(2) muf(2)];
%mud=[mud(2) mud(2)];
%warn('Blind mode only.','Resetting first set of stepsizes.');
% DFE-LMS+DD
case 4,
structure=2; % DFE structure
alg1=1; % LMS algorithm
alg2=2; % followed by DD algorithm
% DFE-LMS+CMA
case 5,
structure=2; % DFE structure
alg1=1; % LMS algorithm
alg2=3; % followed by CMA algorithm
% IIR-LMS
case 6,
structure=1; % LE structure
alg=1; % LMS algorithm
alg2=2; % no blind algorithm (DD by default)
if ((muf(2)~=0) | (mud(2)~=0))
set(h_muf,'String',['['num2str(muf(1)) ',0]']);
set(h_mud,'String',['['num2str(mud(1)) ',0]']);
muf=[muf(1) 0];
mud=[mud(1) 0];
warn('Training mode only.',...
'Setting second set of stepsizes to zero.');
end;
% IIR-DD
case 7,
structure=1; % LE structure
alg1=2; % DD algorithm
alg2=2; % DD algorithm
set(h_muf,'String',['['num2str(muf(1)) ',' num2str(muf(2)) ']']);
set(h_mud,'String',['['num2str(mud(1)) ',' num2str(mud(2)) ']']);
%set(h_muf,'String',['['num2str(muf(2)) ',' num2str(muf(2)) ']']);
%set(h_mud,'String',['['num2str(mud(2)) ',' num2str(mud(2)) ']']);
%muf=[muf(2) muf(2)];
%mud=[mud(2) mud(2)];
%warn('Blind mode only.','Resetting first set of stepsizes.');
% IIR-CMA
case 8,
structure=1; % LE structure
alg1=3; % CMA algorithm
alg2=3; % CMA algorithm
set(h_muf,'String',['['num2str(muf(1)) ',' num2str(muf(2)) ']']);
set(h_mud,'String',['['num2str(mud(1)) ',' num2str(mud(2)) ']']);
%set(h_muf,'String',['['num2str(muf(2)) ',' num2str(muf(2)) ']']);
%set(h_mud,'String',['['num2str(mud(2)) ',' num2str(mud(2)) ']']);
%muf=[muf(2) muf(2)];
%mud=[mud(2) mud(2)];
%warn('Blind mode only.','Resetting first set of stepsizes.');
% IIR-LMS+DD
case 9,
structure=1; % LE structure
alg1=1; % LMS algorithm
alg2=2; % followed by DD algorithm
% IIR-LMS+CMA
case 10,
structure=1; % LE structure
alg1=1; % LMS algorithm
alg2=3; % followed by CMA algorithm
end;
% Check if negative step-sizes
if ((muf<0) | (mud<0))
set(h_muf,'String',num2str(abs(muf)));
set(h_mud,'String',num2str(abs(mud)));
muf=abs(muf);
mud=abs(mud);
warn('Step-size must be positive.',...
'Changing signal of values provided.');
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% If Nfd is chosen, shadow off adaptation buttons %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if ~isempty(Nfd)
set(h_adapt,'Enable','off','Value',0);
set(h_traj,'Enable','off','Value',0);
set(h_aerr,'Enable','off','Value',0);
set(h_acluster,'Enable','off','Value',0);
set(h_fcluster,'Enable','off','Value',0);
set(h_fimp,'Enable','off','Value',0);
set(h_ffreq,'Enable','off','Value',0);
set(h_f0,'Enable','off');
set(h_d0,'Enable','off');
set(h_muf,'Enable','off');
set(h_mud,'Enable','off');
set(h_alg,'Enable','off');
set(h_init,'Enable','off');
set(h_sim,'Enable','off');
else
set(h_adapt,'Enable','on');
set(h_traj,'Enable','on');
set(h_aerr,'Enable','on');
set(h_acluster,'Enable','on');
set(h_fcluster,'Enable','on');
set(h_fimp,'Enable','on');
set(h_ffreq,'Enable','on');
set(h_muf,'Enable','on');
set(h_mud,'Enable','on');
set(h_alg,'Enable','on');
set(h_init,'Enable','on');
set(h_sim,'Enable','on');
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% If external data is chosen, shadow off channel buttons %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if (data==3)
set(h_chan,'Enable','off');
set(h_SNR,'Enable','off');
set(h_norm,'Enable','off');
set(h_coefs,'Enable','off');
set(h_resp,'Enable','off');
set(h_design,'Enable','off','Value',0);
set(h_imp,'Enable','off','Value',0);
set(h_freq,'Enable','off','Value',0);
set(h_mse,'Enable','off','Value',0);
set(h_cluster,'Enable','off','Value',0);
set(h_ep,'Enable','off','Value',0);
set(h_ser,'Enable','off','Value',0);
set(h_fimp,'Enable','off','Value',0);
set(h_ffreq,'Enable','off','Value',0);
else
set(h_chan,'Enable','on');
set(h_SNR,'Enable','on');
set(h_norm,'Enable','on');
set(h_coefs,'Enable','on');
set(h_resp,'Enable','on');
set(h_design,'Enable','on');
set(h_imp,'Enable','on');
set(h_freq,'Enable','on');
set(h_mse,'Enable','on');
set(h_cluster,'Enable','on');
set(h_ep,'Enable','on');
set(h_ser,'Enable','on');
end;
%%%%%%%%%%%%%%%%%%%
% Warning Message %
%%%%%%%%%%%%%%%%%%%
set(h_msg,'BackgroundColor',[0 1 0]);
set(h_msg,'FontAngle','italic', 'String','Warning: new params!'); drawnow;
new_params=1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -