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

📄 teqdemo.m

📁 ADSL经典仿真程序
💻 M
📖 第 1 页 / 共 4 页
字号:
      hold on;       plot(D+1:D+Nb,B,'r','linewidth',2); hold off;      set(gcf,'handlevisibility','callback')      grid on      xlabel('tap number')      ylabel('amplitude')      title([title_str,' TIR and SIR'])      legend('SIR','TIR');                    else      legend off      hw100 = hw(1:100)/norm(hw);      axhndlList = get(freqzHndl,'UserData');      hndl = plot(hw100);       set(gcf,'handlevisibility','callback')      grid on      xlabel('tap number')      ylabel('amplitude')      title([title_str,' SIR'])      legend('SIR');        end   elseif graphNum == 2      legend off      hndl = stem(W);       if Nw > 3         hold on;         plot(W,':');         hold off      end      axis([0 Nw+1 1.1*min(W)*(min(W)<=0) 1.1*max(W)*(max(W)>0)])      xlabel('tap number')      ylabel('amplitude')      title([title_str,' TEQ impulse response'])         elseif graphNum == 3      legend off      plot(freqAxis(usedSubs),20*log10(abs(Fw(usedSubs))+eps));      grid on      axisSet = axis;      axisSet(1) = min(freqAxis(usedSubs))-2;      axisSet(2) = max(freqAxis(usedSubs))+2;      axis(axisSet);      xlabel('frequency bin number')      ylabel('magnitude (dB)')      title([title_str,' TEQ frequency response'])         elseif graphNum == 4      legend off      plot(freqAxis(usedSubs),10*log10(subSNR(usedSubs)+eps))      hold on;      plot(freqAxis(usedSubs),10*log10(subMFB+eps),'r')      hold off      grid on      axisSet = axis;      axisSet(1) = min(freqAxis(usedSubs))-2;      axisSet(2) = max(freqAxis(usedSubs))+2;      axis(axisSet);      xlabel('frequency')      ylabel('magnitude (dB)')      title([title_str,' achieved and upper-bound SNR'])      legend('SNR','MFB',0);         elseif graphNum == 5      legend off      maxAmp = max(abs(hw));      plot(channel(1:500)/max(abs(channel))*maxAmp);      hold on      plot(hw(1:500),'r');      hold off      grid on	      xlabel('discrete time (n)')      ylabel('amplitude')      title([title_str,' Original & Shortened Channel'])      legend('original','shortened',0);                  elseif graphNum == 6      legend off      plot(freqAxis(usedSubs),20*log10(noiseSpec+eps),'r')      hold on      plot(freqAxis(usedSubs),20*log10(colorNoiseaft(usedSubs)+eps))      hold off      grid on	      axisSet = axis;      axisSet(1) = min(freqAxis(usedSubs))-2;      axisSet(2) = max(freqAxis(usedSubs))+2;      axis(axisSet);      xlabel('frequency')      ylabel('magnitude (dB)')      title([title_str,' Noise Power Spectrum'])      legend('before TEQ','after TEQ',0);                  elseif graphNum == 7      legend off      plot(Dmin:Dmax,10*log10(real(Dv(Dmin:Dmax))+eps))      grid on	      ylabel('objective function (e.g. MSE for MMSE method)')      xlabel('delay')      title([title_str,' Cost vs delay plot'])         elseif graphNum == 8      legend off      plot(freqAxis(usedSubs),10*log10(abs(Fhw(usedSubs)).^2+eps));      grid on      axisSet = axis;      axisSet(1) = min(freqAxis(usedSubs))-2;      axisSet(2) = max(freqAxis(usedSubs))+2;      axis(axisSet);      ylabel('magnitude (dB)')      xlabel('frequency')      title([title_str,' Equalized Channel Frequency Response'])   end      set(gcf,'Pointer','arrow');   return   %save teq to a fileelseif strcmp(action,'saveteq');       [filename,path]=uiputfile('*');    if filename==0        return;        end        load singleteqresults;    output=fopen([path,filename],'w');    fprintf(output,'%s','optimal delay =');    fprintf(output,' %d ;\n',TEQoptimalDelay);    fprintf(output,'\n');    fprintf(output,'%s\n','teq=[');    for i=1:length(TEQequalizerTaps)        fprintf(output,'%f \n',TEQequalizerTaps(i));    end    fprintf(output,'%s\n','];');    fprintf(output,'\n');    fprintf(output,'%s\n','feq=[');    for i=1:length(TEQequalizedChannelFreqResp)        fprintf(output,'%f \n',1/TEQequalizedChannelFreqResp(i));    end    fprintf(output,'%s\n','];');    fclose(output);        %save all parameterselseif strcmp(action,'saveall')    [filename,path]=uiputfile('*');    if filename==0;        return;    end        load singleteqresults;    output=fopen([path,filename],'w');    fprintf(output,'all the parameters are also saved into %s.mat\n',filename);    fprintf(output,'%s','SIR length =');    fprintf(output,' %d\n',TEQNb);    fprintf(output,'%s','TEQ length =');    fprintf(output,' %d;\n',TEQNw);    fprintf(output,'%s','FFT size =');    fprintf(output,' %d;\n',TEQN);    fprintf(output,'%s','coding gain =');    fprintf(output,' %f;\n',TEQCodingGain);    fprintf(output,'%s','margin =');    fprintf(output,' %d;\n',TEQMargin);    fprintf(output,'%s','Dmin =');    fprintf(output,' %d;\n',TEQDmin);    fprintf(output,'%s','Dmax =');    fprintf(output,' %d;\n',TEQDmax);    fprintf(output,'%s','input power =');    fprintf(output,' %f (dBm);\n',TEQInputPower);    fprintf(output,'%s','AWGN power =');    fprintf(output,' %f (dBm/Hz);\n',TEQAWGNPower);    fprintf(output,'%s','loop number =');    fprintf(output,' %d;\n',TEQLoopnum);    fclose(output);    str=sprintf(['save ', filename,' TEQNb TEQNw TEQN TEQCodingGain TEQMargin TEQDmin',...            ' TEQDmax TEQInputPower TEQAWGNPower TEQLoopnum;']);    eval(str);       % get helpelseif strcmp(action,'info'),   ttlStr = get(gcf,'name');   myFig = gcf;      topic1 =  ['Single-path TEQ design demo'];   helptop1 = [...     'This demo lets you design the time-domain equalizer (TEQ) and         '     'frequency-domain equalizer (FEQ) in a conventional discrete multitone '     'equalizer structure (cascade of TEQ, FFT, and FEQ) and analyze its    '     'performance.                                                          '          '                                                                      '     'Usage: Set parameters to desired values and hit the Calculate button. '     '                                                                      '     'The following TEQ design methods are supported:                       '	 '  Minimum mean squared error -- unit energy constraint,               '     '      N. Al-Dhahir and J. M. Cioffi, "Efficiently Computed            '     '      Reduced-Parameter Input-Aided MMSE Equalizers for ML Detection: '     '      A Unified Approach", IEEE Trans. on Info. Theory, vol. 42, pp.  '     '      903-915, May 1996.                                              '	 '  Minimum mean squared error -- unit tap constraint,                  '      '      N. Al-Dhahir and J. M. Cioffi, "Efficiently Computed            '     '      Reduced-Parameter Input-Aided MMSE Equalizers for ML Detection: '     '      A Unified Approach", IEEE Trans. on Info. Theory, vol. 42, pp.  '     '      903-915, May 1996.                                              '     '  Maximum shortening signal-to-noise (SNR) ratio method,              '     '      P. J. W. Melsa, R. C. Younce, and C. E. Rohrs, "Impulse Response'     '      Shortening for Discrete Multitone Transceivers", IEEE Trans. on '     '      Comm., vol. 44, pp. 1662-1672, Dec. 1996.                       '     '  Maximum geometric signal-to-noise (SNR) method,                     '     '      N. Al-Dhahir and J. M. Cioffi, "Optimum finite-length           '     '      equalization for multicarrier transceivers", IEEE Trans. on     '     '      Comm., vol 44. pp. 56-63, Jan. 1996.                            '     '  Minimum intersymbol interference method,                            '     '      G. Arslan, B. L. Evans, and S. Kiaei, "Equalization for         '     '      Discrete Multitone Transceivers to Maximize Channel Capacity",  '     '      IEEE Trans. on Signal Proc., submitted.                         '     '  Maximum bit rate method,                                            '     '      G. Arslan, B. L. Evans, and S. Kiaei, "Equalization for         '     '      Discrete Multitone Transceivers to Maximize Channel Capacity",  '     '      IEEE Trans. on Signal Proc., submitted.                         '     '  Divide and conquer -- cancellation,                                 '     '      B. Lu, L. D. Clark, G. Arslan, and B. L. Evans, "Fast           '     '      Time-Domain Equalization for Discrete Multitone Modulation      '     '      Systems", Proc. IEEE Digital Signal Processing Workshop,        '     '      Oct. 15-18, 2000, Hunt, Texas.                                  '     '  Divide and conquer -- minimization,                                 '     '      B. Lu, L. D. Clark, G. Arslan, and B. L. Evans, "Fast           '     '      Time-Domain Equalization for Discrete Multitone Modulation      '     '      Systems", Proc. IEEE Digital Signal Processing Workshop,        '     '      Oct. 15-18, 2000, Hunt, Texas.                                  '     '  Matrix pencil design method,                                        '     '      Y. Hua and T. K. Sarkar, "Matrix Pencil Method for Estimating   '     '      Parameters of Exponentially Damped/Undamped Sinusoids in Noise" '     '      IEEE Trans. Acoust. Speech Signal Processing, vol. 38, No. 5,   '     '      pp. 814-824, May 1990                                           '     '  Modified matrix pencil design method.                               '     '      Y. Hua and T. K. Sarkar, "Matrix Pencil Method for Estimating   '     '      Parameters of Exponentially Damped/Undamped Sinusoids in Noise" '     '      IEEE Trans. Acoust. Speech Signal Processing, vol. 38, No. 5,   '     '      pp. 814-824, May 1990                                           '     '      and                                                             '     '      B. Lu, D. Wei, B. L. Evans, and A. C. Bovik, "Improved Matrix   '      '      Pencil Methods", Proc. IEEE Asilomar Conf. on Signals, Systems  '     '      and Computers, Nov. 1-4, 1998, Pacific Grove, CA, vol. 2, pp.   '     '      1433-1437.                                                      '     '  Eigen approach design method                                        '     '      B. Farhang-Boroujeny and M. Ding, "An Eigen-Approach to the     '     '      Design of Near-Optimum Time Domain Equalizer for DMT            '     '      Transceivers", IEEE Int. Conf. on Comm (ICC 99), vol. 2,        '     '      pp. 937-941, 1999.                                              '     '  Autoregressive Moving Average (ARMA) modeling design method         '     '      P. J. W. Melsa, R. C. Younce, and C. E. Rohrs, "Impulse Response'     '      Shortening for Discrete Multitone Transceivers", IEEE Trans. on '     '      Comm., vol. 44, pp. 1662-1672, Dec. 1996.                       '     '  Symmetric Maximum shortening signal-to-noise (SNR) ratio method     '     '      R. K. Martin, C. R. Johnson, Jr, M. Ding, and B. L. Evans,      '     '      "Exploiting Symmetry in Channel Shortening Equalizers",         '     '      Proc. IEEE Int. Conf. on Acoustics, Speech, and Signal Proc.,   '     '      April 6-10, 2003, Hong Kong, China.                             '];      topic2 =  ['Design and Simulation Parameters'];   helptop2 = [...	 'On the top of the control window on the right is a pulldown menu      '     'from which a design method can be chosen.                             '	 'Below this pulldown menu are the following editable text windows      '     'which are used to set the desired parameters,                         '     '  Shortened impulse response (SIR) length. This is the desired length '     '   of the channel after equalization. For example, it should be set   '     '   to 33 (one plus the cyclic prefix length) for the ADSL standard.   '     '  Time domain equalizer (TEQ) length. Defines the number of taps of   ' 	 '   the TEQ.                                                           '     '  Fast Fourier transform (FFT) size. Sets the FFT size used in DMT    '     '   modulation. It is twice the number of subchannels.                 '     '  Coding gain (dB). Defines a coding in dB used during capacity       '     '   calculations.                                                      '     '  Margin (dB). Sets the desired system margin in dB. This is also     '     '   used in capacity calculations.                                     '     '  Dmin and Dmax. The optimal delay is search in the interval between  '     '   Dmin and Dmax.                                                     '	 '  Input power (dBm). Defines the input signal power in dBm.           '	 '  AWGN pow (dBm/Hz). Sets the amount of additive white Gaussian noise '     '   in dBm/Hz. AWGN is added to the near-end crosstalk noise.          '     '  CSA loop \# (1-8). Selects the desired channel to run the simulation'     '   on. Currently 8 standard CSA loops are supported.                  '];        topic3 =  ['Graphics'];   helptop3 = [...	 'Below the editable text windows is another pull-down menu which       '     'is used to select the desired graph to be displayed.                  '     'The following graphics can be selected:                               '     '  Target and shortened channel. Displays the shortened channel impulse'	 	 '   response and the target channel impulse response for the MMSE and  ' 	 '   geometric SNR methods. For all other methods the location of the   '      '   target window is displayed instead of a target impulse response.   '     '  TEQ impulse response. Shows the impulse response of the TEQ.        '     '  TEQ frequency response. Shows the TEQ in frequency domain.          '     '  SNR and matched filter bound (MFB). The SNR and matched filter bound'     '  to the SNR is displayed                                             '     '   as a function of frequency (subchannels).                          '     '  Original and shortened channel. Displays the channel impulse        '     '   response before and after equalization.                            '     '  Noise Power Spectrum. Shows the power spectrum of the noise which   '     '   consists of NEXT noise plus AWGN.                                  '     '  Delay Plot. Displays the performance measure of the method with     '     '   respect to the delay.                                              '     '  Equalized channel freq resp. Displays the frequency response of the '     '   channel after equalization.                                        '];    topic4 =  ['Performance Measures'];   helptop4 = [...'The two remaining buttons in the control frame are                    ''   Info. Displays this help.                                          ''   Calculate. Starts the calculation and performance evaluation of the''    TEQ.                                                              ''The following performance measures are calculated and listed in the   ''table:                                                                ''   Rate. Gives the achievable bit rate with the given channel and TEQ ''    settings.                                                         ''   SNR. Shows the SNR at the output of the equalizer in dB.           ''   SSNR. Shows the shortening SNR in dB. This is defined as the ratio ''    of the energy of the shortened channel impulse response in the    ''    target window the the energy outside the target window.           ''   MSE. Gives the MSE for the MMSE and geometric SNR methods.         ''   Delay. Shows the optimal delay for the system.                     ''   Max Rate 1-FIR. Shows the absolute maximum achievable bit rate     ''    given the channel and equalizer settings. It is basically the     ''    capacity calculated from the matched filter bound.                '];		    str =  { topic1 helptop1; topic2 helptop2; topic3 helptop3; topic4 helptop4 };      helpwin(str,'Topic 1','Signal-path TEQ design demo')                      return     else   disp(sprintf( 'Internal ERROR: ''%s'' not recognized',action))end     

⌨️ 快捷键说明

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