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

📄 eqber_adaptive.html

📁 Adaptive Filter. This script shows the BER performance of several types of equalizers in a static ch
💻 HTML
字号:
<html xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">   <head>      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">         <!--This HTML is auto-generated from an M-file.To make changes, update the M-file and republish this document.      -->      <title>EQBER_ADAPTIVE - Simulation of linear and DFE equalizers</title>      <meta name="generator" content="MATLAB 7.0">      <meta name="date" content="2004-06-23">      <meta name="m-file" content="eqber_adaptive"><style>body {  background-color: white;  margin:10px;}h1 {  color: #990000;   font-size: x-large;}h2 {  color: #990000;  font-size: medium;}p.footer {  text-align: right;  font-size: xx-small;  font-weight: lighter;  font-style: italic;  color: gray;}pre.codeinput {  margin-left: 30px;}span.keyword {color: #0000FF}span.comment {color: #228B22}span.string {color: #A020F0}span.untermstring {color: #B20000}span.syscmd {color: #B28C00}pre.showbuttons {  margin-left: 30px;  border: solid black 2px;  padding: 4px;  background: #EBEFF3;}pre.codeoutput {  color: gray;  font-style: italic;}pre.error {  color: red;}/* Make the text shrink to fit narrow windows, but not stretch too far in wide windows.  On Gecko-based browsers, the shrink-to-fit doesn't work. */ p,h1,h2,div {  /* for MATLAB's browser */  width: 600px;  /* for Mozilla, but the "width" tag overrides it anyway */  max-width: 600px;  /* for IE */  width:expression(document.body.clientWidth > 620 ? "600px": "auto" );}    </style></head>   <body>      <h1>EQBER_ADAPTIVE - Simulation of linear and DFE equalizers</h1>      <p>This script runs a simulation loop for either a linear or a DFE equalizer.  It uses the RLS algorithm to initially set the         weights, then uses LMS thereafter to minimize execution time.  It plots the equalized signal spectrum, then generates and         plots BER results over a range of Eb/No values. It also fits a curve to the simulated BER points, and plots the burst error         performance of the linear and DFE equalizers. The adaptive equalizer objects automatically retain their state between invocations         of their "equalize" method.      </p>      <p>This script uses another script, <a href="eqber_siggen.html">eqber_siggen</a> to generate a noisy, channel-filtered signal.      </p><pre class="codeinput"><span class="comment">% Set parameters based on linear or DFE equalizer setting</span><span class="keyword">if</span> (strcmpi(eqType, <span class="string">'linear'</span>))    refTap     = linEq1.RefTap; <span class="comment">% set reference tap</span>    eq1        = linEq1;        <span class="comment">% set RLS equalizer for first data block</span>    eq2        = linEq2;        <span class="comment">% set LMS equalizer for remaining data blocks</span>    hSpecPlot  = hLinSpec;      <span class="comment">% set spectrum plot line handle</span><span class="keyword">elseif</span> (strcmpi(eqType, <span class="string">'dfe'</span>))    refTap     = dfeEq1.RefTap;    eq1        = dfeEq1;    eq2        = dfeEq2;    hSpecPlot  = hDfeSpec;<span class="keyword">end</span>firstErrPlot = true;   <span class="comment">% for burst error plot - reset for each eq method</span><span class="comment">% Main simulation loop</span><span class="keyword">for</span> EbNoIdx = 1 : length(EbNo)    <span class="comment">% Initialize channel and error collection parameters</span>    chanState = [];    numErrs   = 0;    numBits   = 0;    firstBlk = true;  <span class="comment">% RLS for first data block, LMS thereafter</span>    <span class="keyword">while</span> (numErrs &lt; maxErrs &amp;&amp; numBits &lt; maxBits)        eqber_siggen;  <span class="comment">% generate a noisy, channel-filtered signal</span>        <span class="keyword">if</span> (numErrs &lt; maxErrs)            <span class="comment">% Equalize the signal with an adaptive equalizer.  Use a truncated</span>            <span class="comment">% version of the transmitted signal as the training signal.  Use RLS</span>            <span class="comment">% to initially set the weights in the first data block, and LMS</span>            <span class="comment">% thereafter, for speed purposes.</span>            trainSig = txSig(1 : end-refTap+1);            <span class="keyword">if</span> (firstBlk)                [PreD, PostD] = equalize(eq1, noisySig, trainSig);                <span class="comment">% Set the weights and weight inputs of the LMS equalizer to</span>                <span class="comment">% those of the RLS equalizer for future data blocks.</span>                eq2.Weights = eq1.Weights;                eq2.WeightInputs = eq1.WeightInputs;            <span class="keyword">end</span>            <span class="comment">% Equalize all blocks, including a re-equalization of the first</span>            <span class="comment">% block.  Do not use a training sequence.  The performance of the</span>            <span class="comment">% DFE equalizer will be enhanced if called with a training sequence,</span>            <span class="comment">% but a real system would be implemented without the training</span>            <span class="comment">% sequence.</span>            [PreD, PostD] = equalize(eq2, noisySig);            <span class="comment">% Plot the spectrum of the equalized signal</span>            hSpecPlot = eqber_graphics(<span class="string">'sigspec'</span>, eqType, hSpecPlot, <span class="keyword">...</span>                nBits, PreD);            <span class="comment">% Demodulate the signal</span>            demodSig = (1-sign(real(PostD)))/2;            range1 = 1 : length(msg)-refTap+1;            range2 = refTap : length(demodSig);            [currErrs, ratio] = biterr(msg(range1), demodSig(range2));            numErrs = numErrs + currErrs;       <span class="comment">% cumulative</span>            numBits = numBits + length(range1); <span class="comment">% cumulative</span>            BER(EbNoIdx) = numErrs / numBits;            <span class="comment">% Plot the burst error performance for this data block</span>            [hErrs, hText1, hText2] = eqber_graphics(<span class="string">'bursterrors'</span>, eqType, <span class="keyword">...</span>                mlseType, firstErrPlot, msg(range1), demodSig(range2), <span class="keyword">...</span>                nBits, hErrs, hText1, hText2);            firstErrPlot = false;        <span class="keyword">end</span>        <span class="comment">% Update the BER plot</span>        [hBER, hLegend, legendString] = eqber_graphics(<span class="string">'simber'</span>, eqType, <span class="keyword">...</span>            mlseType, firstBlk, EbNoIdx, EbNo, BER, hBER, hLegend, <span class="keyword">...</span>            legendString);        firstBlk = false;  <span class="comment">% done processing first data block</span>    <span class="keyword">end</span>     <span class="comment">% end of simulation while loop</span>    <span class="comment">% Fit a plot to the new BER points</span>    hFit = eqber_graphics(<span class="string">'fitber'</span>, eqType, mlseType, hFit, EbNoIdx, EbNo, BER);    <span class="comment">% Reset the RLS equalizer for the next Eb/No</span>    <span class="keyword">if</span> (strcmpi(eqType, <span class="string">'linear'</span>))        eq1 = lineareq(nWts, alg1);        eq1.RefTap = round(nWts/2);    <span class="keyword">elseif</span> (strcmpi(eqType, <span class="string">'dfe'</span>))        eq1 = dfe(nFwdWts, nFbkWts, alg1);        eq1.RefTap = round(nFwdWts/2);    <span class="keyword">end</span>    eq1.ResetBeforeFiltering = 0;<span class="keyword">end</span>     <span class="comment">% end of 'for EbNoIdx' loop</span></pre><p class="footer">Copyright 1996-2004 The MathWorks, Inc.<br>         Published with MATLAB&reg; 7.0<br></p>      <!--##### SOURCE BEGIN #####%% EQBER_ADAPTIVE - Simulation of linear and DFE equalizers% This script runs a simulation loop for either a linear or a DFE equalizer.  It% uses the RLS algorithm to initially set the weights, then uses LMS thereafter% to minimize execution time.  It plots the equalized signal spectrum, then% generates and plots BER results over a range of Eb/No values. It also fits a% curve to the simulated BER points, and plots the burst error performance of% the linear and DFE equalizers. The adaptive equalizer objects automatically% retain their state between invocations of their "equalize" method.%% This script uses another script, <eqber_siggen.html eqber_siggen> to% generate a noisy, channel-filtered signal.%   Copyright 1996-2004 The MathWorks, Inc.%   $Revision: 1.1.4.1 $  $Date: 2004/06/30 23:03:13 $% Set parameters based on linear or DFE equalizer settingif (strcmpi(eqType, 'linear'))    refTap     = linEq1.RefTap; % set reference tap    eq1        = linEq1;        % set RLS equalizer for first data block    eq2        = linEq2;        % set LMS equalizer for remaining data blocks    hSpecPlot  = hLinSpec;      % set spectrum plot line handleelseif (strcmpi(eqType, 'dfe'))    refTap     = dfeEq1.RefTap;    eq1        = dfeEq1;    eq2        = dfeEq2;    hSpecPlot  = hDfeSpec;endfirstErrPlot = true;   % for burst error plot - reset for each eq method% Main simulation loopfor EbNoIdx = 1 : length(EbNo)        % Initialize channel and error collection parameters     chanState = [];    numErrs   = 0;    numBits   = 0;    firstBlk = true;  % RLS for first data block, LMS thereafter        while (numErrs < maxErrs && numBits < maxBits)                eqber_siggen;  % generate a noisy, channel-filtered signal                if (numErrs < maxErrs)                        % Equalize the signal with an adaptive equalizer.  Use a truncated            % version of the transmitted signal as the training signal.  Use RLS            % to initially set the weights in the first data block, and LMS            % thereafter, for speed purposes.            trainSig = txSig(1 : end-refTap+1);            if (firstBlk)                [PreD, PostD] = equalize(eq1, noisySig, trainSig);                                % Set the weights and weight inputs of the LMS equalizer to                % those of the RLS equalizer for future data blocks.                eq2.Weights = eq1.Weights;                eq2.WeightInputs = eq1.WeightInputs;            end                        % Equalize all blocks, including a re-equalization of the first            % block.  Do not use a training sequence.  The performance of the            % DFE equalizer will be enhanced if called with a training sequence,            % but a real system would be implemented without the training            % sequence.            [PreD, PostD] = equalize(eq2, noisySig);                                    % Plot the spectrum of the equalized signal            hSpecPlot = eqber_graphics('sigspec', eqType, hSpecPlot, ...                nBits, PreD);            % Demodulate the signal            demodSig = (1-sign(real(PostD)))/2;            range1 = 1 : length(msg)-refTap+1;            range2 = refTap : length(demodSig);            [currErrs, ratio] = biterr(msg(range1), demodSig(range2));            numErrs = numErrs + currErrs;       % cumulative            numBits = numBits + length(range1); % cumulative            BER(EbNoIdx) = numErrs / numBits;            % Plot the burst error performance for this data block            [hErrs, hText1, hText2] = eqber_graphics('bursterrors', eqType, ...                mlseType, firstErrPlot, msg(range1), demodSig(range2), ...                nBits, hErrs, hText1, hText2);            firstErrPlot = false;        end                        % Update the BER plot        [hBER, hLegend, legendString] = eqber_graphics('simber', eqType, ...            mlseType, firstBlk, EbNoIdx, EbNo, BER, hBER, hLegend, ...            legendString);        firstBlk = false;  % done processing first data block            end     % end of simulation while loop        % Fit a plot to the new BER points    hFit = eqber_graphics('fitber', eqType, mlseType, hFit, EbNoIdx, EbNo, BER);        % Reset the RLS equalizer for the next Eb/No    if (strcmpi(eqType, 'linear'))        eq1 = lineareq(nWts, alg1);        eq1.RefTap = round(nWts/2);    elseif (strcmpi(eqType, 'dfe'))        eq1 = dfe(nFwdWts, nFbkWts, alg1);        eq1.RefTap = round(nFwdWts/2);    end    eq1.ResetBeforeFiltering = 0;           end     % end of 'for EbNoIdx' loop##### SOURCE END #####-->   </body></html>

⌨️ 快捷键说明

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