Getting Started    

Finding the Delay in the Model

In constructing this model, to set the parameters for the Error Rate Calculation block and Delay block correctly, you need to know the delay between the transmitted and received signals. You can sometimes determine this delay from the parameters of the blocks between the transmitted and received signals. But if you are unable to determine the delay in this way, you can do so with the xcorr function, from the Signal Processing Toolbox, which finds the cross correlation between the signal and shifts of its delayed version.

To use the xcorr function, you must modify the model slightly as follows:

  1. Set the Es/No parameter of the AWGN Channel block to 100. This essentially removes all noise from the model.
  2. Drag a Signal To Workspace block, from the DSP Sinks library, into the model window.
  3. Connect the line leading out of the Bernoulli Binary Generator block to the Signal To Workspace block. You can do this by right-clicking the line and moving the mouse pointer to the input port of the Signal To Workspace block while pressing the mouse button.
  4. Double-click the Signal To Workspace block to open its mask, and change the Variable name parameter to Tx.
  5. Drag another Signal To Workspace block, from the DSP Sinks library, into the model window and connect it to the line leading out of the M-FSK Demodulator Passband block.
  6. Double-click the second Signal To Workspace block into the model window and change the Variable name parameter to Rx.
  7. Pull down the Simulation menu and select Simulation parameters. Set Stop time to 1.

When you are done, the model should appear as in the following figure.

Determining the Delay in the FSK Model

Running the model sends the transmitted and received signals to the workspace as vectors called Tx and Rx, respectively. To find the delay between Tx and Rx, type the following commands at the MATLAB prompt.

MATLAB should return delay=6, which is the correct value of the delay.

The xcorr function calculates the correlations between Tx and Rx when the two vectors are shifted in all possible ways that overlap. The maximum correlation occurs at the shifted distance corresponding to the true delay.

You can test whether you have found the correct value for the delay by using the MATLAB isequal command, which returns a 1 when two vectors are equal, and a 0 when they differ. To do so, at the MATLAB prompt type

MATLAB returns a 1 if the number of symbols Tx and Rx are offset by is delay.

If you use this procedure and MATLAB returns a 0 to the isequal command, it might indicate that there is still noise present in the model.


  Delays in the Model Multirate Models