| Contents | Index |
This Simulink model shows how to process complex data in transmission signals of a communication system.
| On this page… |
|---|
What Is Frame Synchronization?
In communication systems, frame synchronization is a method of finding valid data in a transmission that consists of data frames. To aid frame synchronization, the transmitter inserts a fixed data pattern at the start of each data frame to mark the start of valid data. The receiver searches for the fixed pattern in each data frame and achieves frame synchronization when the correlation between the input data and the fixed pattern is high.
Model Structure
The model contains the following components.

The chart contains the following states, transitions, and MATLAB functions.

Key characteristics of the chart include:
Complex input and output signals
The chart accepts a complex input signal I/Q. After synchronizing the data frame, the chart stores the valid data in a complex output signal frame.
Complex multiplication
The output signal frame is a vector of complex products between each valid data point and the phase angle of the carrier wave.
Indexing into a complex vector
The chart uses the temporalCount operator to index into the complex vector frame. (See Using Temporal Logic in State Actions and Transitions for information about the temporalCount operator.)
MATLAB functions with complex arguments
The MATLAB functions correlate and get_carrier_phase have complex input and output arguments.
Simulation Results
The sf_frame_sync_controller model does not produce simulation results. The purpose of this example is to explain how to process complex data in a chart.
How the Chart Works
The chart calculates the correlation between the input signal I/Q and the fixed data pattern trainSig. You define trainSig by writing and running a MATLAB script before you simulate the model.
If the correlation exceeds 50 percent, frame synchronization occurs. The chart stores 220 valid data points in the complex vector frame.
If the correlation stays below 50 percent after the chart has evaluated 300 data points, the frame synchronization algorithm resets.
| Stage | Summary | Details |
|---|---|---|
| 1 | Activation of the frame synchronization algorithm | When the chart wakes up, the state look_for_sync activates to start the frame synchronization algorithm. |
| 2 | Calculation of correlation between the input signal and the fixed pattern | The MATLAB function correlate finds the correlation between the input signal I/Q and the fixed data pattern trainSig. Then, the function stores the complex correlation as corr. |
| 3 | Calculation of absolute value of the complex correlation | The MATLAB function correlate also finds the absolute value of corr and stores the output as corrAbs. The value of corrAbs is the correlation percentage, which can range from 0 to 100 percent. At 0 percent, there is no correlation; at 100 percent, there is perfect correlation. |
| 4 | Identification of valid data in a frame | If corrAbs exceeds 50 percent, the correlation is high and the chart has identified the start of valid data in a data frame. The transition from the state look_for_sync to get_payload occurs. If corrAbs stays below 50 percent after the chart has evaluated 300 data points, the frame synchronization algorithm restarts. |
| 5 | Storage of valid data in a complex vector | When the correlation is high, the state get_payload activates. The MATLAB function get_carrier_phase finds the phase angle of the carrier wave and stores the value as phasor. Then, the state multiplies the input signal I/Q with the phase angle phasor and stores each complex product in successive elements of the vector frame. |
| 6 | Output of valid frame data | After collecting 220 data points, the chart outputs the vector frame to the next block in the model. |
| 7 | Restart of the frame synchronization algorithm | The state look_for_sync reactivates, and the frame synchronization algorithm restarts for the next data frame. |
![]() | Best Practices for Using Complex Data in Stateflow Charts | Frequency Response Measurement with a Spectrum Analyzer | ![]() |

Learn how engineers use Stateflow to model state machines in their Simulink models.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |