for designing and simulating communication system algorithms with M ATLAB
®KEY FEATURES
■ Signal generator functions for creating test signals
■ Display functions, such as eye diagram and scatter plots, to visualize modulated signals
■ Source coding, including quantizers, differential pulse code modulation (DPCM), µ-law, and A-Law companders
■ Block coding with Reed-Solomon, Hamming, BCH, general cyclic, and linear codes
■ Convolutional coding, including Viterbi decoders
■ Baseband and passband digital modulation functions, including amplitude shift keying (ASK), phase shift keying (PSK), and frequency shift keying (FSK)
■ Baseband and passband analog modulation libraries, including analog modulation (AM), frequency modulation (FM), and phase modulation (PM)
■ An additive white Gaussian noise (AWGN) channel
■ Galois field calculations for GF(qm) polynomial manipulation and representation
Signal display functions like this scatter plot help you to quickly visualize a modulated signal with a single function call.
Creating a 32-tone baseband FSK modulated signal is as easy as calling the dmodcefunction with appropriate parameters.
% Number of symbols and tone spacing M = 32, tone =.25;
% Symbol and sample rates Fd = 1; Fs = 6;
% Generate 200 random symbols x = randint(200,1,M);
% Perform FSK modulation
y = dmodce(x,Fd,Fs,’fsk’,M,tone);
Functions
Signal Sources
randerr Generate bit error patterns
randint Generate matrix of uniformly distributed random integers
randsrc Generate random matrix using prescribed alphabet
wgn Generate white Gaussian noise
Signal Analysis Functions
biterr, Compute number of bit or symbol errors symerr and bit or symbol error rate
eyediagram Generate an eye diagram scatterplot Generate a scatter diagram
Source Coding
compand Source code µ-law or A-law compressor or expander
dpcmenco, Encode and decode using differential dpcmdeco pulse code modulation
dpcmopt Optimize differential pulse code modulation parameters
lloyds Optimize quantization parameters using the Lloyd algorithm quantiz Produce a quantization index and
a quantized output value
Error-Control Coding
bchpoly, Produce parameters or generator cyclpoly, polynomial for BCH, cyclic, or rspoly Reed-Solomon code
convenc Convolutionally encode binary data cyclgen, Produce parity check and generator hammgen matrix for cyclic and Hamming code encode, Block encoder and decoder
decode
gen2par Convert between parity-check and generator matrices
gfweight Calculate the minimum distance of a linear block code
rsencof, Encode or decode an ASCII file using rsdecof Reed-Solomon code
syndtable Produce syndrome decoding table
vitdec Decode convolutionally encoded binary data using the Viterbi algorithm
Lower-Level Functions for Error-Control Coding bchenco, BCH encoder and decoder
bchdeco
rsenco, Reed-Solomon encoder and decoder rsdeco
rsencode, Reed-Solomon encoding and decoding rsdecode using the exponential format
Modulation
Analog Passband and Baseband Modulation and Demodulation amod, Passband modulate and demodulate an ademod analog signal with double sideband AM,
single sideband AM, QAM, FM, or PM amodce, Baseband modulate and demodulate ademodce an analog signal using complex envelope
with double sideband AM, single sideband AM, QAM, FM, or PM
Digital Passband and Baseband Modulation and Demodulation dmod, Passband modulate and demodulate
ddemod a digital signal with ASK, PSK, QASK, FSK, or MSK
dmodce, Baseband modulate and demodulate ddemodce a digital signal using complex envelope
with ASK, PSK, QASK, FSK, or MSK
A plot from the eye diagram function shows the decision point of a modulated signal.
-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5
Eye Diagram for In-Phase Signal
-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5
Eye Diagram for Quadrature Signal
Digital Mapping/Demapping modmap Map a digital signal to an analog signal demodmap Demap a digital message from a demodulated
signal
apkconst Plot a combined circular APK-PSK signal constellation
qaskdeco Demap a message from a QASK square signal constellation
qaskenco Map a message to a QASK square signal constellation
Special Filters
hilbiir Design a Hilbert transform IIR filter hank2sys Convert a Hankel matrix to a linear
system model
rcosfir, Design a raised cosine FIR or IIR filter rcosiir (lower-level function)
rcosflt Filter the input signal using a raised cosine filter rcosine Design a raised cosine filter
Channel Functions
awgn Add white Gaussian noise to a signal Galois Field Computation Functions
flxor Perform integer exclusive OR (XOR) computation gfadd, Add, divide, multiply, and subtract
gfdeconv, polynomials over a Galois field gfconv,gfsub
gfmul, Multiply and divide elements of gfdiv a Galois field
gfcosets Produce cyclotomic cosets for a Galois field gfplus Add elements of a Galois field of characteristic
two
gffilter Filter data using polynomials over a prime Galois field
gftrunc Minimize the length of a polynomial representation
gflineq Solve the linear equation Ax=b over a prime Galois field
gfminpol Find the minimal polynomial of an element of a Galois field
gfroots Find the roots of a polynomial over a prime Galois field
gfprimck Check whether a polynomial over a Galois field is primitive
gfprimdf, Provide default primitive polynomials
gfprimfd and find primitive polynomials for a Galois field gfrank Compute the rank of a matrix over a Galois field gfrepcov Convert one GF(2) polynomial representation to
another
gftuple Simplify or convert the format of elements of a Galois field
gfpretty Display a polynomial in traditional format
Utilities
bi2de, Convert between binary vectors and de2bi decimal numbers
erf Error function (in MATLAB)
erfc Complementary error function (in MATLAB) istrellis Check if input is a valid trellis structure marcumq Generalized Marcum Q function
oct2dec Convert octal numbers to decimal numbers poly2trellis Convert convolutional code polynomials
to trellis description
vec2mat Convert a vector into a matrix Here, the symbol error function is used to calculate the symbol error rate of
M-ary PSK for a range of Eb/No value.
2 4 6 8 10 12 14 16
Performance of M-ary PSK
Empirical
PRODUCT REQUIREMENTS
The Communications Toolbox is available on all MathWorks supported platforms. It requires the Signal Processing Toolbox.
% Define alphabet (quaternary).
M = 4;
% Generate 2048 random integers in the range [0,M-1]
msg_mod = randsrc(2048,1,[0:M-1]);
% Digitally modulate and upsample the signal msg_tx = dmodce(msg_mod, Fd, Fs, ‘psk’, M);
% Add Gaussian noise to the signal at 10dB SNR. The noise signal is
% calibrated using the ‘measured’ option. The noise power is scaled for
% oversampling.
msg_rx = awgn(msg_tx, 10, ‘measured’, [], ‘dB’);
% Demodulate, detect, and downsample the signal msg_demod = ddemodce(msg_rx, Fd, Fs, ‘psk’, M);
% Calculate bit error count, BER, symbol error count and SER [errBit ratBit] = biterr(msg_mod, msg_demod, log2(M));
[errSym ratSym] = symerr(msg_mod, msg_demod);
In this code sample, Communications Toolbox functions generate random integers, modulate with QPSK, add Gaussian noise and demodulate, then calculate bit error and symbol error rates.
The MathWorks
Tel: 508.647.7000 info@mathworks.com www.mathworks.com© 2000 by The MathWorks, Inc. MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, and Target Language Compiler is a trademark of The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective holders.
9060v01 10/00 For demos, application examples, tutorials, user stories, and pricing:
• Visit www.mathworks.com
• Contact The MathWorks directly US & Canada 508-647-7000 Benelux +31 (0)182 53 76 44 France +33 (0)1 41 14 67 14 Germany +49 (0)89 995901 0 Spain +34 93 362 13 00 Switzerland +41 (0)31 954 20 20
UK +44 (0)1223 423 200
Visit www.mathworks.comto obtain contact information for authorized MathWorks representatives in countries throughout Asia Pacific, Latin America, the Middle East, Africa, and the rest of Europe.
The DSP Blockset is an intuitive tool, com-posed of Simulink®block libraries, for the rapid design, graphical simulation, and prototyping of DSP systems. It is a component of the DSP and Communications Design Suites, which provide complete system-level design capability.
DSP Blockset models are constructed within the Simulink environment. You select blocks from the available libraries and interconnect them in various configurations using the mouse. Signal source blocks are available for testing your models. You can visualize your simulation interactively or pass simula-tion results to MATLAB®for post-processing.
In addition to the built-in blocks, you can incorporate C code, MATLABfunctions, and M-files. You can use Real-Time Workshop® to generate ANSI standard C code directly from your model.
The DSP Blockset provides the algorithmic foundation for many applications in speech and audio processing, telephony, wireless and broadband communications, computer peripherals, radar/sonar, and medical electronics. It contains blocks for filter design, spectral estimation, and transforms, among others.
Working with the DSP Blockset
The DSP Blockset complements the power-ful algorithm development and signal analysis tools in MATLABby providing an interactive block diagram environment for system-level simulation and real-time algorithm design.
Advanced Signal Processing
The DSP Blockset offers a wide range of built-in DSP techniques, including trans-forms, buffering, filter design, and linear algebra. You can create sophisticated DSP simulations without low-level program-ming and easily add your own custom algorithms.