| Communications Toolbox | ![]() |
Minimum shift keying demodulation
z = mskdemod(y,nsamp)
z = mskdemod(y,nsamp,dataenc)
z = mskdemod(y,nsamp,dataenc,ini_phase)
z = mskdemod(y,nsamp,dataenc,ini_phase,ini_state)
[z,phaseout] = mskdemod(...)
[z,phaseout,stateout] = mskdemod(...)
z = mskdemod(y,nsamp) demodulates the complex envelope y of a signal using the differentially encoded minimum shift keying (MSK) method. nsamp denotes the number of samples per symbol and must be a positive integer. The initial phase of the demodulator is 0. If y is a matrix with multiple rows and columns, then the function treats the columns as independent channels and processes them independently.
z = mskdemod(y,nsamp,dataenc) specifies the method of encoding data for MSK. dataenc can be either 'diff' for differentially encoded MSK or 'nondiff' for nondifferentially encoded MSK.
z = mskdemod(y,nsamp,dataenc,ini_phase) specifies the initial phase of the demodulator. ini_phase is a row vector whose length is the number of channels in y and whose values are integer multiples of pi/2. To avoid overriding the default value of dataenc, set dataenc to [].
z = mskdemod(y,nsamp,dataenc,ini_phase,ini_state) specifies the initial state of the demodulator. ini_state contains the last half symbol of the previously received signal. ini_state is an nsamp-by-C matrix, where C is the number of channels in y.
[z,phaseout] = mskdemod(...) returns the final phase of y, which is important for demodulating a future signal. The output phaseout has the same dimensions as the ini_phase input, and assumes the values 0, pi/2, pi, and 3*pi/2.
[z,phaseout,stateout] = mskdemod(...) returns the final nsamp values of y, which is useful for demodulating the first symbol of a future signal. stateout has the same dimensions as the ini_state input.
The example below illustrates how to modulate and demodulate within a loop. To provide continuity from one iteration to the next, the syntaxes for mskmod and mskdemod use initial phases and/or state as both input and output arguments.
% Define parameters.
numbits = 99; % Number of bits per iteration
numchans = 2; % Number of channels (columns) in signal
nsamp = 16; % Number of samples per symbol
% Initialize.
numerrs = 0; % Number of bit errors seen so far
demod_ini_phase = zeros(1,numchans); % Modulator phase
mod_ini_phase = zeros(1,numchans); % Demodulator phase
ini_state = complex(zeros(nsamp,numchans)); % Demod. state
% Main loop
for iRuns = 1 : 10
x = randint(numbits,numchans); % Binary signal
[y,phaseout] = mskmod(x,nsamp,[],mod_ini_phase);
mod_ini_phase = phaseout; % For next mskmod command
[z, phaseout, stateout] = ...
mskdemod(y,nsamp,[],demod_ini_phase,ini_state);
ini_state = stateout; % For next mskdemod command
demod_ini_phase = phaseout; % For next mskdemod command
numerrs = numerrs + biterr(x,z); % Cumulative bit errors
end
disp(['Total number of bit errors = ' num2str(numerrs)])The output is below.
Total number of bit errors = 0
[1] Pasupathy, Subbarayan, "Minimum Shift Keying: A Spectrally Efficient Modulation," IEEE Communications Magazine, July, 1979, pp. 14-22.
mskmod, fskmod, fskdemod, Modulation
| modnorm | mskmod | ![]() |
© 1994-2005 The MathWorks, Inc.