📄 teqdemo.m
字号:
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 & MFB|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+2*(btnHt+spacing) btnWid btnHt], ... 'String',labelStr,'Userdata',mat, ... 'Interruptible','on', ... 'Callback',callbackStr); % help button labelStr='Info'; callbackStr='teqdemo(''info'')'; helpHndl=uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left frmBottom+btnHt+spacing btnWid btnHt], ... 'String',labelStr, ... 'Callback',callbackStr); % run button labelStr='Calculate'; callbackStr='teqdemo(''design'')'; closeHndl=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 NbHndl NwHndl NHndl CGHndl MarginHndl ... DminHndl DmaxHndl PwrHndl AWGNHndl CSAHndl viewHndl ... helpHndl closeHndl methodHndl h11 h21 h31 h41 h51 h61]; set(figNumber, ... 'Visible','on', ... 'UserData',fhndlList); drawnow axes(freqzHnd) set(freqzHnd,'Userdata',[]) teqdemo('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 Nbelseif strcmp(action,'setNb'), 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 Nb<1 or if MSSNR is chosen Nb<=Nw if vv < 1 | (vv <= nw & meth == 3), vv = v; end set(gco,'Userdata',vv,'String',num2str(vv)); return % set Nwelseif strcmp(action,'setNw'), hndlList=get(gcf,'Userdata'); nb = 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 Nw<1 or if MSSNR is chosen Nw>=Nb if vv <= 1 | (vv >= nb & meth == 3), 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)));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -