Main Content

fskdemod

Frequency shift keying demodulation

Description

z = fskdemod(y,M,freq_sep,nsamp) noncoherently demodulates the complex envelope y of a signal using the frequency shift key method.

example

z = fskdemod(y,M,freq_sep,nsamp,Fs) specifies the sampling frequency in Hz.

z = fskdemod(y,M,freq_sep,nsamp,Fs,symorder) specifies how the function assigns binary words to corresponding integers.

Examples

collapse all

Pass an FSK signal through an AWGN channel and estimate the resulting bit error rate (BER). Compare the estimated BER to the theoretical value.

Set the simulation parameters.

M = 2;         % Modulation order
k = log2(M);   % Bits per symbol
EbNo = 5;      % Eb/No (dB)
Fs = 16;       % Sample rate (Hz)
nsamp = 8;     % Number of samples per symbol
freqsep = 10;  % Frequency separation (Hz)

Generate random data symbols.

data = randi([0 M-1],5000,1);

Apply FSK modulation.

txsig = fskmod(data,M,freqsep,nsamp,Fs);

Pass the signal through an AWGN channel

rxSig  = awgn(txsig,EbNo+10*log10(k)-10*log10(nsamp),...
    'measured',[],'dB');

Demodulate the received signal.

dataOut = fskdemod(rxSig,M,freqsep,nsamp,Fs);

Calculate the bit error rate.

[num,BER] = biterr(data,dataOut);

Determine the theoretical BER and compare it to the estimated BER. Your BER value might vary because the example uses random numbers.

BER_theory = berawgn(EbNo,'fsk',M,'noncoherent');
[BER BER_theory]
ans = 1×2

    0.0958    0.1029

Input Arguments

collapse all

Complex baseband representation of a FSK-modulated signal, specfied as vector or matrix of complex values. If y is a matrix with multiple rows and columns, fskdemod processes the columns independently.

Data Types: double | single
Complex Number Support: Yes

Modulation order, specified as an integer power of two.

Example: 2 | 4 | 16

Data Types: double

Symbol order, specified as 'bin' or 'gray'. This argument specifies how the function assigns binary vectors to corresponding integers.

  • If symorder is 'bin', the function uses a natural binary-coded ordering.

  • If symorder is 'gray', the function uses a Gray-coded ordering.

Data Types: char

Desired separation between frequencies, specified in Hz. By the Nyquist sampling theorem, freq_sep and M must satisfy (M-1)*freq_sep <= 1.

Data Types: double

Number of samples per output symbol, specified as a positive scalar greater than 1.

Data Types: double

Sample rate, specified as a positive scalar.

Data Types: double

Output Arguments

collapse all

Output signal, returned as a vector or matrix of positive integers. The elements of z have values in the range of [0, M – 1].

Example: randi([0 3],100,1)

Data Types: double

References

[1] Sklar, Bernard. Digital Communications: Fundamentals and Applications. Upper Saddle River, NJ: Prentice-Hall, 2001.

Introduced before R2006a