teqdemo.m

来自「ADSL经典仿真程序」· M 代码 · 共 1,363 行 · 第 1/4 页

M
1,363
字号
   labelPos = [labelLeft labelBottom labelWidth textHeight];   h = uicontrol( ...      'Style','text', ...      'Units','normalized', ...      'Position',labelPos, ...      'Horiz','left', ...      'String','TEQ length (Nw)', ...      'Interruptible','off', ...      'BackgroundColor',[0.5 0.5 0.5], ...      'ForegroundColor','white');      % set Nw   textPos = [labelLeft+labelWidth-.015 labelBottom textWidth+.025 textHeight];   callbackStr = 'teqdemo(''setNw'')';   str = sprintf('32');        %default setting changed from 16 to 3 09/18/01 by ming   mat = [32];   NwHndl = uicontrol( ...      'Style','edit', ...      'Units','normalized', ...      'Position',textPos, ...      'Max',1, ...       'Horiz','right', ...      'Background','white', ...      'Foreground','black', ...      'String',str,'Userdata',mat, ...      'callback',callbackStr);      % FFT Size label   btnNumber=3;   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','FFT Size (N)', ...      'Interruptible','off', ...      'BackgroundColor',[0.5 0.5 0.5], ...      'ForegroundColor','white');      % set FFT size   textPos = [labelLeft+labelWidth-.015 labelBottom textWidth+.025 textHeight];   callbackStr = 'teqdemo(''setN'')';   str = sprintf('512');   mat = [512];   NHndl = uicontrol( ...      'Style','edit', ...      'Units','normalized', ...      'Position',textPos, ...      'Max',1, ...       'Horiz','right', ...      'Background','white', ...      'Foreground','black', ...      'String',str,'Userdata',mat, ...      'callback',callbackStr);      % coding gain label   btnNumber=4;   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','Coding gain (dB)', ...      'Interruptible','off', ...      'BackgroundColor',[0.5 0.5 0.5], ...      'ForegroundColor','white');      % set coding gain    textPos = [labelLeft+labelWidth-.015 labelBottom textWidth+.025 textHeight];   callbackStr = 'teqdemo(''setCG'')';   str = sprintf('4.2');   mat = [4.2];   CGHndl = uicontrol( ...      'Style','edit', ...      'Units','normalized', ...      'Position',textPos, ...      'Max',1, ...       'Horiz','right', ...      'Background','white', ...      'Foreground','black', ...      'String',str,'Userdata',mat, ...      'callback',callbackStr);      % Margin label   btnNumber=5;   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','Margin (dB)', ...      'Interruptible','off', ...      'BackgroundColor',[0.5 0.5 0.5], ...      'ForegroundColor','white');      % set margin   textPos = [labelLeft+labelWidth-.015 labelBottom textWidth+.025 textHeight];   callbackStr = 'teqdemo(''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 = 'teqdemo(''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 = 'teqdemo(''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 = 'teqdemo(''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 = 'teqdemo(''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 = 'teqdemo(''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);     % graphic selection menu   labelStr=['Target & shortened channel|TEQ impulse response|'...         'TEQ frequency response|SNR & Matched Filter Bound|Original & shortened channel'...         '|Noise Power Spectrum|Delay Plot|Equalized channel freq resp'];   callbackStr='teqdemo(''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='teqdemo(''design'')';   closeHndl=uicontrol( ...      'Style','pushbutton', ...      'Units','normalized', ...      'Position',[left frmBottom+2*(btnHt+spacing) btnWid btnHt], ...      'String',labelStr, ...      'Callback',callbackStr);     % save teq button   labelStr='Save Equalizer';   callbackStr='teqdemo(''saveteq'')';   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='teqdemo(''saveall'')';   helpHndl=uicontrol( ...      'Style','pushbutton', ...      'Units','normalized', ...      'Position',[left+btnWid/2 frmBottom+btnHt+spacing btnWid/2 btnHt], ...

⌨️ 快捷键说明

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