Adaptive Equalization Using MATLAB Coder™ - MATLAB
Adaptive Equalization Using MATLAB Coder™ - MATLAB
http://www.mathworks.com/help/comm/examples/adaptive-equalization-... Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.
A source of random data. A source of a constant training sequence. A modulator that modulates the data and the training sequence. Each frame comprises 200 data symbols and 50 training symbols. A subsystem that models a multipath Rician channel with additive white Gaussian noise. A MATLAB Function block labeled gaincontrol that implements gain control for the received signal using a one-tap equalizer. A MATLAB Function block labeled Equalizer that implements a multiple-tap equalizer. Before you run the simulation, you can change the equalizer's adaptive algorithm, number of tap weights, or reference tap. To do this, double-click the Equalizer block and edit the parameters in its dialog box. A demodulator.
Although gain control and equalization could have been combined into one block, this model separates these operations for illustrative purposes.
1 of 5
12-Jan-13 7:11 PM
http://www.mathworks.com/help/comm/examples/adaptive-equalization-... Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.
Also, several Select Payload blocks in the model select the data symbols from each frame for visualization and error rate calculation purposes.
When you run the simulation, scope windows display scatter plots of the signal before gain control, after gain control, and after equalization.
After equalization:
2 of 5
12-Jan-13 7:11 PM
http://www.mathworks.com/help/comm/examples/adaptive-equalization-... Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.
Notice that the gain control operation adjusts the size and phase of the signal, while the equalizer mitigates intersymbol interference (ISI).
The Display block in the model window shows error statistics for the communications link.
An important purpose of this example is to illustrate the use of MATLAB Function blocks to encapsulate communications algorithms concisely. MATLAB Coder makes it easy to integrate MATLAB code directly into a Simulink model.
3 of 5
12-Jan-13 7:11 PM
http://www.mathworks.com/help/comm/examples/adaptive-equalization-... Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.
Viewing the Code. You can view the MATLAB code for each MATLAB Function block in this example:
To view the algorithm for the gain control operation, double-click the block labeled gaincontrol. A separate editor window opens to display the MATLAB code for this block.
Select the Equalizer block, which is a subsystem rather than the actual MATLAB Function block. Choose Look Under Mask from the model window's Edit menu. The subsystem opens to displays its contents. In the subsystem, double-click the block labeled equalizer, which is a MATLAB Function block. A separate editor window opens to display the MATLAB code for this block.
The reason why the procedure for viewing the equalizer code differs from the procedure for viewing the gain control code is that the block labeled equalizer is in a masked subsystem (namely, the Equalizer subsystem), not at the top level of the model's hierarchy. The dialog box for the masked subsystem provides a convenient way for you to change the equalizer parameters in the example.
Examining the Equalizer Block. Here are some observations about the equalizer block in this example that can help you use MATLAB Function blocks in your own communications models:
The block infers the vector sizes of the input signals and one output signal, while computing the vector size of the equalized output signal based on the size of an input signal. To see this, go to the editor window for the equalizer code and select Explore/define data from the editor window's Tools menu. This opens the Model Explorer, where the Size column indicates the vector size of each quantity. Values of -1 indicate that the block infers or inherits the size. This inheritance is useful because it means that even if you change signal sizes in the model, you do not need to adjust the sizes listed in the Model Explorer. The Equalizer subsystem passes parameters (not just Simulink signals) to the MATLAB function. The Model Explorer lists these parameters, where the Scope column entry says Parameter. The values of the parameters come from your choices in the mask dialog box or from the Initialization panel of the Mask Editor for the Equalizer block. To see the mask dialog box, double-click the Equalizer block. To see the Mask Editor, select the Equalizer block and choose Edit Mask from the model window's Edit menu. When designing your own MATLAB functions, you can parameterize them using a masked subsystem. Variables such as Delta and weights are initialized as complex variables of a designated vector size, using assignments like zeros(M,1) + 0j. The statement persistent weights causes the value of the weights variable to remain defined from one function call to the next. Persistence of weight values between successive iterations is crucial for an adaptive equalizer's operation.
For more details about the MATLAB Function, see the MATLAB Function block section of the Simulink documentation.
Selected Bibliography
[1] Proakis, John G., Digital Communications, Fourth Ed., New York, McGraw-Hill, 2001.
4 of 5
12-Jan-13 7:11 PM
http://www.mathworks.com/help/comm/examples/adaptive-equalization-... Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.
5 of 5
12-Jan-13 7:11 PM