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

📄 pertone.m

📁 ADSL经典仿真程序
💻 M
📖 第 1 页 / 共 3 页
字号:
   top = yPos - btnHt - spacing;   labelWidth = frmWidth-textWidth-.01;   labelBottom=top-textHeight;   labelLeft = left;   labelPos = [labelLeft labelBottom labelWidth textHeight];   h = uicontrol( ...      'Style','text', ...      'Units','normalized', ...      'Position',labelPos, ...      'Horiz','left', ...      'String','Margin (dB)', ...      'Interruptible','off', ...      'BackgroundColor',[0.5 0.5 0.5], ...      'ForegroundColor','white');      % set margin   textPos = [labelLeft+labelWidth-.015 labelBottom textWidth+.025 textHeight];   callbackStr = 'pertone(''setMargin'')';   str = sprintf('6');   mat = [6];   MarginHndl = uicontrol( ...      'Style','edit', ...      'Units','normalized', ...      'Position',textPos, ...      'Max',1, ...       'Horiz','right', ...      'Background','white', ...      'Foreground','black', ...      'String',str,'Userdata',mat, ...      'callback',callbackStr);         % Dmin label   btnNumber=6;   yPos=menutop-(btnNumber-1)*(btnHt+spacing);   top = yPos - btnHt - spacing;   labelWidth = frmWidth-textWidth-.01;   labelBottom=top-textHeight;   labelLeft = left;   labelPos = [labelLeft labelBottom labelWidth textHeight];   h = uicontrol( ...      'Style','text', ...      'Units','normalized', ...      'Position',labelPos, ...      'Horiz','left', ...      'String','Dmin', ...      'Interruptible','off', ...      'BackgroundColor',[0.5 0.5 0.5], ...      'ForegroundColor','white');      % set Dmin   textPos = [labelLeft+labelWidth-.015 labelBottom textWidth+.025 textHeight];   callbackStr = 'pertone(''setDmin'')';   str = sprintf('15');   mat = [15];   DminHndl = uicontrol( ...      'Style','edit', ...      'Units','normalized', ...      'Position',textPos, ...      'Max',1, ...       'Horiz','right', ...      'Background','white', ...      'Foreground','black', ...      'String',str,'Userdata',mat, ...      'callback',callbackStr);      % Dmax label   btnNumber=7;   yPos=menutop-(btnNumber-1)*(btnHt+spacing);   top = yPos - btnHt - spacing;   labelWidth = frmWidth-textWidth-.01;   labelBottom=top-textHeight;   labelLeft = left;   labelPos = [labelLeft labelBottom labelWidth textHeight];   h = uicontrol( ...      'Style','text', ...      'Units','normalized', ...      'Position',labelPos, ...      'Horiz','left', ...      'String','Dmax', ...      'Interruptible','off', ...      'BackgroundColor',[0.5 0.5 0.5], ...      'ForegroundColor','white');      % set Dmax   textPos = [labelLeft+labelWidth-.015 labelBottom textWidth+.025 textHeight];   callbackStr = 'pertone(''setDmax'')';   str = sprintf('35');   mat = [35];   DmaxHndl = uicontrol( ...      'Style','edit', ...      'Units','normalized', ...      'Position',textPos, ...      'Max',1, ...       'Horiz','right', ...      'Background','white', ...      'Foreground','black', ...      'String',str,'Userdata',mat, ...      'callback',callbackStr);      % input power label   btnNumber=8;   yPos=menutop-(btnNumber-1)*(btnHt+spacing);   top = yPos - btnHt - spacing;   labelWidth = frmWidth-textWidth-.01;   labelBottom=top-textHeight;   labelLeft = left;   labelPos = [labelLeft labelBottom labelWidth textHeight];   h = uicontrol( ...      'Style','text', ...      'Units','normalized', ...      'Position',labelPos, ...      'Horiz','left', ...      'String','Input power (dBm)', ...      'Interruptible','off', ...      'BackgroundColor',[0.5 0.5 0.5], ...      'ForegroundColor','white');      % set input power   textPos = [labelLeft+labelWidth-.015 labelBottom textWidth+.025 textHeight];   callbackStr = 'pertone(''setPwr'')';   str = sprintf('23');   mat = [23];   PwrHndl = uicontrol( ...      'Style','edit', ...      'Units','normalized', ...      'Position',textPos, ...      'Max',1, ...       'Horiz','right', ...      'Background','white', ...      'Foreground','black', ...      'String',str,'Userdata',mat, ...      'callback',callbackStr);      % AWGN power label   btnNumber=9;   yPos=menutop-(btnNumber-1)*(btnHt+spacing);   top = yPos - btnHt - spacing;   labelWidth = frmWidth-textWidth-.01;   labelBottom=top-textHeight;   labelLeft = left;   labelPos = [labelLeft labelBottom labelWidth textHeight];   h = uicontrol( ...      'Style','text', ...      'Units','normalized', ...      'Position',labelPos, ...      'Horiz','left', ...      'String','AWGN pow (dBm/Hz)', ...      'Interruptible','off', ...      'BackgroundColor',[0.5 0.5 0.5], ...      'ForegroundColor','white');      % set AWGN power   textPos = [labelLeft+labelWidth-.015 labelBottom textWidth+.025 textHeight];   callbackStr = 'pertone(''setAWGN'')';   str = sprintf('-140');   mat = [-140];   AWGNHndl = uicontrol( ...      'Style','edit', ...      'Units','normalized', ...      'Position',textPos, ...      'Max',1, ...       'Horiz','right', ...      'Background','white', ...      'Foreground','black', ...      'String',str,'Userdata',mat, ...      'callback',callbackStr);      % channel number label   btnNumber=10;   yPos=menutop-(btnNumber-1)*(btnHt+spacing);   top = yPos - btnHt - spacing;   labelWidth = frmWidth-textWidth-.01;   labelBottom=top-textHeight;   labelLeft = left;   labelPos = [labelLeft labelBottom labelWidth textHeight];   h = uicontrol( ...      'Style','text', ...      'Units','normalized', ...      'Position',labelPos, ...      'Horiz','left', ...      'String','CSA loop # (1-8)', ...      'Interruptible','off', ...      'BackgroundColor',[0.5 0.5 0.5], ...      'ForegroundColor','white');      % set channel number   textPos = [labelLeft+labelWidth-.015 labelBottom textWidth+.025 textHeight];   callbackStr = 'pertone(''setCSA'')';   str = sprintf('1');   mat = [1];   CSAHndl = uicontrol( ...      'Style','edit', ...      'Units','normalized', ...      'Position',textPos, ...      'Max',1, ...       'Horiz','right', ...      'Background','white', ...      'Foreground','black', ...      'String',str,'Userdata',mat, ...      'callback',callbackStr);      % heuristic delay search   btnNumber=11;   yPos=menutop-(btnNumber-1)*(btnHt+spacing);   top = yPos - btnHt - spacing;   labelWidth = frmWidth-textWidth-.01;   labelBottom=top-textHeight;   labelLeft = left;   labelPos = [labelLeft labelBottom+0.01 labelWidth textHeight];   mat=[1];   callbackStr='tfb(''setHDelaySearch'');';   hd = uicontrol( ...      'Style','radio', ...      'Units','normalized', ...      'Position',labelPos, ...      'Horiz','left', ...      'String','heuristic delay', ...      'Interruptible','off', ...      'BackgroundColor',[0.5 0.5 0.5], ...      'ForegroundColor','white',...      'Userdata',mat,...      'Value',1,...      'callback',callbackStr);        % optimal delay search   textPos = [labelLeft+labelWidth-.07 labelBottom+0.01 textWidth+.08 textHeight];   callbackStr='tfb(''setODelaySearch'');';   od = uicontrol( ...      'Style','radio', ...      'Units','normalized', ...      'Position',textPos, ...      'Horiz','left', ...      'String','optimal delay', ...      'Interruptible','off', ...      'BackgroundColor',[0.5 0.5 0.5], ...      'ForegroundColor','white',...      'Userdata',mat,...      'value',0,...      'callback',callbackStr);     % graphic selection menu   labelStr=['SNR & MFB'...         '|Noise Power Spectrum|delay plot'];   callbackStr='pertone(''plotGraph'');';   mat = 1;   viewHndl=uicontrol( ...      'Style','popupmenu', ...      'Units','normalized', ...      'Position',[left frmBottom+3*(btnHt+spacing) btnWid btnHt], ...      'String',labelStr,'Userdata',mat, ...      'Interruptible','on', ...      'Callback',callbackStr);      % run button   labelStr='Calculate';   callbackStr='pertone(''design'')';   closeHndl=uicontrol( ...      'Style','pushbutton', ...      'Units','normalized', ...      'Position',[left frmBottom+2*(btnHt+spacing) btnWid btnHt], ...      'String',labelStr, ...      'Callback',callbackStr);     % save pertone button   labelStr='Save Equalizer';   callbackStr='pertone(''savepertone'')';   helpHndl=uicontrol( ...      'Style','pushbutton', ...      'Units','normalized', ...      'Position',[left frmBottom+btnHt+spacing btnWid/2 btnHt], ...      'String',labelStr, ...      'Callback',callbackStr);       % save all button   labelStr='Save Parameters';   callbackStr='pertone(''saveall'')';   helpHndl=uicontrol( ...      'Style','pushbutton', ...      'Units','normalized', ...      'Position',[left+btnWid/2 frmBottom+btnHt+spacing btnWid/2 btnHt], ...      'String',labelStr, ...      'Callback',callbackStr);     % help button   labelStr='Information';   callbackStr='pertone(''info'')';   helpHndl=uicontrol( ...      'Style','pushbutton', ...      'Units','normalized', ...      'Position',[left frmBottom btnWid btnHt], ...      'String',labelStr, ...      'Callback',callbackStr);     % put all handles in userdata of the parent object   fhndlList=[freqzHnd TGHndl NwHndl NHndl CGHndl MarginHndl ...         DminHndl DmaxHndl PwrHndl AWGNHndl CSAHndl viewHndl ...     helpHndl closeHndl methodHndl h11 h21 h31 h41 h51 h61 hd od];   set(figNumber, ...      'Visible','on', ...      'UserData',fhndlList);      drawnow   axes(freqzHnd)   set(freqzHnd,'Userdata',[])   pertone('design')   set(gcf,'Pointer','arrow','handlevisibility','callback');   set(0,'showHiddenHandles',shh)   return         % change method elseif strcmp(action,'changemethod'),   v = get(gco,'value');     % 1=MMSE-UEC,2=MMSE-UTC,3=MSSNR,4=GEO,5=min-ISI,6=MBR,7=DCC,8=DCM,9=MP,   % 10=MMP, 11=Eig-App 12=ARMA   set(gco,'userdata',v);   return      % set TGelseif strcmp(action,'setTG'),   hndlList=get(gcf,'Userdata');   tg = get(hndlList(2),'userdata');   meth = get(hndlList(15),'value');   v = get(gco,'Userdata');   s = get(gco,'String');   vv = eval(s,num2str(v(1)));   % do not allow tg<1 or tg>256   if vv < 1 | vv >256      vv = v;   end   set(gco,'Userdata',vv,'String',num2str(vv));   return      % set Nwelseif strcmp(action,'setNw'),   hndlList=get(gcf,'Userdata');   nw = get(hndlList(3),'userdata');   meth = get(hndlList(15),'value');   v = get(gco,'Userdata');   s = get(gco,'String');   vv = eval(s,num2str(v(1)));   % do not allow Nw<1    if vv <= 1       vv = v;   end   set(gco,'Userdata',vv,'String',num2str(vv))   return      % set coding gain   elseif strcmp(action,'setCG'),   hndlList=get(gcf,'Userdata');   v = get(gco,'Userdata');   s = get(gco,'String');   vv = eval(s,num2str(v(1)));   % do not allow negative coding gain    if vv < 0,       vv = v;    end   set(gco,'Userdata',vv,'String',num2str(vv))   return      % set margin   elseif strcmp(action,'setMargin'),   hndlList=get(gcf,'Userdata');   v = get(gco,'Userdata');   s = get(gco,'String');   vv = eval(s,num2str(v(1)));   % do not allow negative margin   if vv < 0,       vv = v;    end   set(gco,'Userdata',vv,'String',num2str(vv))   return      % set input power   elseif strcmp(action,'setPwr'),   hndlList=get(gcf,'Userdata');   v = get(gco,'Userdata');   s = get(gco,'String');   vv = eval(s,num2str(v(1)));   % do not allow negative input power   if vv < 0,       vv = v;    end   set(gco,'Userdata',vv,'String',num2str(vv))   return      % set white noise power   elseif strcmp(action,'setAWGN'),   hndlList=get(gcf,'Userdata');   v = get(gco,'Userdata');   s = get(gco,'String');   vv = eval(s,num2str(v(1)));   % do not allow negative noise power   if vv > 0,       vv = v;    end   set(gco,'Userdata',vv,'String',num2str(vv))   return      % set channel number   elseif strcmp(action,'setCSA'),   hndlList=get(gcf,'Userdata');   v = get(gco,'Userdata');   s = get(gco,'String');   vv = eval(s,num2str(v(1)));   % only have 8 CSA channel numbered 1-8   if vv < 1 | vv > 8,       vv = v;    end   set(gco,'Userdata',vv,'String',num2str(vv))   return      % set Dmin   elseif strcmp(action,'setDmin'),   hndlList=get(gcf,'Userdata');   Dmax = get(hndlList(8),'Userdata');   v = get(gco,'Userdata');   s = get(gco,'String');   vv = eval(s,num2str(v(1)));   % Dmin cannot be smaller than 1 and larger than Dmax   if vv<1 | vv > Dmax,       vv = v;    end   set(gco,'Userdata',vv,'String',num2str(vv))   return      % set Dmax   elseif strcmp(action,'setDmax'),   hndlList=get(gcf,'Userdata');   Dmin = get(hndlList(7),'Userdata');   v = get(gco,'Userdata');

⌨️ 快捷键说明

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