Main Content

comm.CPFSKModulator

Modulate using CPFSK method

Description

The comm.CPFSKModulator System object™ modulates a signal using the continuous phase frequency shift keying (CPFSK) method. The output is a baseband representation of the modulated signal.

To modulate using the CPFSK method:

  1. Create the comm.CPFSKModulator object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

cpfskMod = comm.CPFSKModulator creates a modulator System object that modulates the input signal using the CPFSK modulation method.

cpfskMod = comm.CPFSKModulator(Name=Value) creates a CPFSK modulator object and sets properties using one or more name-value arguments. For example, comm.CPFSKModulator(InitialPhaseOffset=pi/4), configures the object with an initial phase offset of pi/4 radians.

cpfskMod = comm.CPFSKModulator(M,Name=Value) creates a CPFSK modulator object with the ModulationOrder property set to M, and optional name-value arguments.

example

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Size of the symbol alphabet, specified as a power-of-two integer scalar.

Option to provide input as bits, specified as a numeric or logical 0 (false) or 1 (true).

  • When you set this property to false, input X must be a column vector of odd integer values in the range [–(M–1), (M-1)], where M represents the value of the ModulationOrder property.

  • When you set this property to true, input X must be a column vector of P-length bit words, where P = log2(M). The object maps each bit word to an integer K in the range [0, M], using the mapping that you specify in the SymbolMapping property. The object then maps the integer K to the intermediate value 2K–(M–1) and proceeds as in the case when you set the BitInput property to false.

Data Types: double | logical

Symbol encoding, specified as Binary or Gray. This property determines how the object maps each input P-length bit word, where P = log2(M), to an integer in the range [0, M–1]. M represents the ModulationOrder property.

  • When you set this property to Binary, the object uses binary-coded ordering.

  • When you set this property to Gray, the object uses Gray-coded ordering.

Dependencies

This property applies when you set the BitInput property to true.

Modulation index, specified as a scalar, h, or a column vector, [h0, h1, …. hH-1], where H-1 represents the length of the column vector. The phase shift over a symbol is π × h.

  • When hi varies from interval to interval, the object operates in multi-h.

  • When the object operates in multi-h, hi must be a rational number.

Initial phase offset, specified in radians as a numeric scalar.

Number of samples per output symbol, specified as a positive, integer scalar. The upsampling factor is the number of output samples produced for each input sample when you call the object.

Data type of the output, specified as 'double' or 'single'.

Usage

Description

Y = cpfskMod(X) modulates input data, X, with the CPFSK method. The output is the modulated CPFSK baseband signal.

Input Arguments

expand all

Input data, specified as an integer scalar or column vector.

  • When you set BitInput to false, the input data must be double-precision or signed integer.

  • When you set BitInput to true, the input data must be double-precision or logical.

This object accepts variable-size inputs. After the object is locked, you can change the size of each input channel, but you cannot change the number of channels. For more information, see Variable-Size Signal Support with System Objects.

Data Types: double | int8 | int16 | int32 | logical

Output Arguments

expand all

CPFSK-modulated baseband output, returned as a column vector. The length of output vector Y is equal to the number of input samples times the number of samples per symbol that you specify in the SamplesPerSymbol property. The OutputDataType property specifies the data type of the output.

Data Types: double | single
Complex Number Support: Yes

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Create a CPFSK modulator, an AWGN channel, and a CPFSK demodulator. Configure the modulator and demodulator with modulation order set to 8, bit input, and Gray-encoded symbol mapping.

M = 8; % Modulation order
cpfskMod = comm.CPFSKModulator(M, ...
    BitInput=true, ...
    SymbolMapping='Gray');
awgnChan = comm.AWGNChannel( ...
    NoiseMethod='Signal to noise ratio (SNR)', ...
    SNR=0);
cpfskDemod = comm.CPFSKDemodulator(M, ...
    BitOutput=true, ...
    SymbolMapping='Gray');

Define the simulation parameters. Create an error rate calculator, accounting for the delay caused by the Viterbi algorithm that the CPFSK demodulator uses.

numFrames = 1000; % Number of frames transmitted
k = log2(M);      % Bits per symbol 
spf = 100;        % Symobls per frame

delay = log2(M)*cpfskDemod.TracebackDepth;
errorRate = comm.ErrorRate( ...
    ReceiveDelay=delay);
for counter = 1:numFrames
    data = randi([0 1],k*spf,1);
    modSignal = cpfskMod(data);
    noisySignal = awgnChan(modSignal);
    receivedData = cpfskDemod(noisySignal);
    errorStats = errorRate(data,receivedData);
end

fprintf('Error rate = %f\nNumber of errors = %d\n', ...
    errorStats(1),errorStats(2))
Error rate = 0.004247
Number of errors = 1274

Algorithms

For CPFSK the phase shift per symbol is π × h, where h is the modulation index.

References

[1] Anderson, John B., Tor Aulin, and Carl-Erik Sundberg. Digital Phase Modulation. New York: Plenum Press, 1986.

Extended Capabilities

Version History

Introduced in R2012a

expand all