| Communications Blockset | ![]() |
www.kxcad.net Home > CAE Software Index > MATLAB Index >
| On this page… |
|---|
Setting Parameters in the FSK Model Learning About Delays in the Model |
Frequency-shift keying (FSK) is a standard modulation technique in which a digital signal is modulated onto a sinusoidal carrier whose frequency shifts between different values. The Bell Telephone System first used this technique in their Model 103 modem. The model shown in the following figure is an example of the baseband representation of FSK.
FSK Model

To open a completed version of the model, type fskdoc at the MATLAB prompt.
You can build the FSK model by adding blocks to the model shown in the figure Channel Noise Model. To open the channel noise model, enter channeldoc at the MATLAB prompt. Then save the model as my_fsk in the directory where you keep your work files. See Saving a Model.
You need to add the following blocks to the model:
The M-FSK Modulator Baseband block, from FM in the Digital Baseband sublibrary of the Modulation library, modulates the binary signal using a baseband representation of FSK modulation.
The M-FSK Demodulator Baseband block, from FM in the Digital Baseband sublibrary of the Modulation library, demodulates the baseband signal.
The AWGN Channel block, from the Channels library, models a channel using additive white Gaussian noise. In this model, AWGN is more suitable than a binary symmetric channel.
The Relational Operator block, from the Simulink Logic and Bit Operations library, compares the transmitted signal, from the Bernoulli Binary Generator block, with the received signal, from the M-FSK Demodulator Baseband block. The block outputs a 0 when the two signals agree, and a 1 when they differ.
The Scope block, from the Simulink Sinks library, displays the transmitted signal, the received signal, and the output of the Relational Operator block. To create three input ports for the block, follow these steps:
Double-click the block to open the scope.
Click the Parameters button
on the toolbar.
Set Number of axes to 3.
Set Time range to 1 and click OK.
To set the limits on the vertical axes,
Right-click the vertical axis at the left side of the upper scope.
In the context menu, select Axes properties.
In the Y-min field, type -1.
In the Y-max field, type 2, and click OK.
Repeat these steps for the middle and lower vertical axes.
The Delay block, from the Signal Processing Blockset Signal Operations library, delays the transmitted signal so that it can be accurately compared with the received signal. Its purpose is explained further in Learning About Delays in the Model.
Drag these blocks into the model window and connect them as shown in the figure FSK Model. Remove the Binary Symmetric Channel block because it is no longer needed. The next section explains how to set the parameters for these blocks.
Make the following changes to the default parameter settings in the dialog boxes for the blocks:
Double-click the Bernoulli Binary Generator block and make the following changes to the default parameters in the block's dialog box:
Set Probability of a zero to 0.5.
Set Sample time to 1/1200.
Double-click the M-FSK Modulator Baseband block and make the following changes to the default parameters in the block's dialog box:
Set M-ary number to 2. This specifies the number of frequencies in the modulated signal.
Set Frequency separation to 1000. This specifies the separation between the two frequencies of the modulated signal.
Set Samples per symbol to 5. This causes the block to oversample the incoming signal. Oversampling increases the sampling rate by a factor of 5.
Double-click the M-FSK Demodulator Baseband block and make the same changes to the block's default parameters as for the M-FSK Modulator Baseband block.
Double-click the AWGN Channel block and set Symbol period to 1/1200.
Double-click the Error Rate Calculation block and make the following changes to the default parameters in the block's dialog box:
Set Receive delay to 1.
Set Output data to Port.
Set the Stop time parameter to 15 and run the model.
Double-click the Scope block to open the scope.

The top window displays the transmitted signal. The middle window displays the received signal. The bottom window displays a 0 where the two signals agree and a 1 where they differ.
Some blocks cause a signal to be delayed as it passes through a model, because of the way they process data. For example, there is a delay of one symbol period between the input signal to the M-FSK Modulator Baseband block and the output signal from the M-FSK Demodulator Baseband block. As a result, there is a delay of 1 between the transmitted and received signals in the model. Finding the Delay in a Model shows how to find the value of this delay.
To compare these two signals and calculate the bit error rate correctly, you need to delay the transmitted signal by 1 to synchronize it with the received signal. This is why you set the Receive delay to 1 in the dialog box for the Error Rate Calculation block, and left the Delay at its default value of 1 in the Delay block.
Note If the Error Rate Calculation block in a model gives an error rate close to .5 for a random binary signal, you might not have taken into account delays in the model. The block is probably comparing two unsynchronized signals. |
Several blocks in the Communications Blockset Modulation library produce delays. A list of these is given in Delays in Digital Modulation in the online Communications Blockset documentation. The Viterbi Decoder block, from the Convolutional sublibrary of the Error Detection and Correction library, also produces a delay equal to its Traceback depth parameter; see the section Viterbi Decoder.
To find the delay between the transmitted and received signals in a model, you can use a Find Delay block. To do so, insert the following blocks into the FSK model:
Find Delay, from the Utility Blocks library
Display, from the Simulink Sinks library
Connect the blocks as shown at the top right of the following figure.

When you run the simulation, the Display block labeled Display shows that the delay is 1. You can use this information to set the Receive delay parameter in the Error Rate Calculation block and the Delay parameter in the Delay block.
The model shown in the figure FSK Model differs from the earlier models in that it contains signals with different sample times. The Bernoulli Binary Generator block has a sample time of 1/1200. The M-FSK Modulator Baseband block receives this signal and upsamples it at a rate of five samples per symbol. As a result, the sample time of the block's output signal is 1/6000. A model that contains signals with different sample times is called a multirate model.
The multiple sample times present in this model do not affect the bit error rate of a simulation. But be aware that in other models, sample times can affect the results of a simulation. This is usually the case when different signals are combined. See Setting Sample Times and Samples per Frame for an example of this.
You can easily check whether there are different sample times in a model by selecting Sample time colors from the Port/signal displays submenu of the Format menu. Then select Update diagram from the Edit menu. When you do this, blocks and lines in the model are colored according to their sample times.
Red blocks and lines indicate the fastest sample time in the model. Green indicates the second fastest sample time. Yellow blocks contain signals with different sample times. If all sample times in the model are the same, all blocks and lines are colored red. For more information on sample time colors, see the Simulink documentation.
For frame-based signals, the colors correspond to the frame periods of the signals rather than sample times.
If you need to determine the actual sample time of a signal, you can use a Probe block as described in Using a Probe Block to Determine Symbol Period.
| Reducing the Error Rate with a Cyclic Code | Building a Convolutional Code Model | ![]() |
© 1984-2007 The MathWorks, Inc. Terms of Use Patents Trademarks Acknowledgments