function comm_con

% COMM_CON Show the help for the functions in this toolbox.

% This file is automatically generated.  Matthew Simoneau, 09-04-98
% Copyright (c) 1984-98 by The MathWorks, Inc. All Rights Reserved
% $Revision: 1.14 $ $Date: 1998/10/16 23:19:11 $

helpwin('comm_con/Contents');

function Contents
%MATLAB Tour Partial Function Help:  comm_con
%
%Double click on any function for more information
%
%  Communications Toolbox.
%  Version 1.4   (R11) 10-Jul-1998
% 
%  What's new.
%    Readme      - New features, bug fixes, and changes in this version.
%  
%  Simulink Block Library.
%    commlib     - Open the Communications Toolbox Simulink Block Library.
% 
%  Signal Sources and Display Functions.
%    biterr      - Bit error number and bit error rate computation.
%    eyescat     - Eye-pattern diagram or scatter plot.
%    randint     - Random integer matrix generator.
%    randbit     - Binary noise generator.
%    symerr      - Symbol error number and symbol error rate computation.
% 
%  Source Coding.
%    compand     - Source code mu-law or A-law compressor or expander.
%    dpcmdeco    - Differential pulse code modulation decode computation.
%    dpcmenco    - Differential pulse code modulation encode computation.
%    dpcmopt     - Differential pulse code modulation parameter optimization.
%    lloyds      - Scalar quantization optimization using training data.
%    quantiz     - Quantization index and quantized output value.
% 
%  Error-Control Coding.
%    bchpoly     - BCH code generator polynomial.
%    cyclgen     - Cyclic code generator and parity-check matrices.
%    cyclpoly    - Cyclic generator polynomial.
%    decode      - Decode computation for error-control coding methods.
%    encode      - Encode computation for error-control coding methods.
%    gen2par     - Generator matrix to parity-check matrix conversion.
%    gen2abcd    - Convert a convolution function into state-space form.
%    gfweight    - Calculates Hamming weight.
%    hammgen     - Hamming code generator and parity-check matrices.
%    htruthtb    - Truth table from generator or parity check matrix.
%    oct2gen     - Convolution code octal form to binary form conversion.
%    rsdecof     - Decode a Reed-Solomon code encoded text file.
%    rsencof     - Encode a text file using Reed-Solomon code.
%    rspoly      - Produce Reed-Solomon code generator polynomial  
%    sim2gen     - Convolution code transfer function in octal from a Simulink model.
%    sim2logi    - Simulink model to convolution code logic representation.
%    sim2tran    - Simulink model to convolution code transfer function.
%    viterbi     - Viterbi convolution code decode with limited memory.
% 
%  Lower-Level Functions for Error-Control Coding.
%    bchcore     - The kernel computation part for BCH decode.
%    bchdeco     - BCH decode computation.
%    bchenco     - BCH code encode computation.
%    convdeco    - Convolution code decode.
%    convenco    - Convolution code encode.
%    errlocp     - Error-location polynomial for BCH and RS code.
%    rscore      - Reed-Solomon decode core.
%    rsdeco      - A user-interfaced Reed-Solomon decode calculation. 
%    rsdecode    - Decode Reed-Solomon code.
%    rsencode    - Encode Reed-Solomon code.
%    rsenco      - A user-interfaced Reed-Solomon encode calculation.
% 
%  Modulation/Demodulation.
%    ademod      - Analog demodulation computation.
%    ademodce    - Demodulate from a complex envelope of analog modulated signal.
%    amod        - Analog modulation.
%    amodce      - Complex envelope of analog modulation.
%    apkconst    - Compute/plot ASK/PSK constellation.
%    ddemod      - Demodulate a digital modulated signal.
%    ddemodce    - Demodulate from complex envelope of digital modulated signal.
%    demodmap    - Digital demodulation demapping.
%    dmod        - Digital modulation.
%    dmodce      - Complex envelope of digital modulation.
%    modmap      - Digital modulation mapping.
%    qaskdeco    - Decode a two-dimensional code to one dimension message.
%    qaskenco    - Encode a message to two-dimensional form for QASK use.
%    
%  Special Filters.
%    hank2sys    - Convert Hankel matrix to linear system.
%    hilbiir     - Hilbert transform IIR filter.
%    imp2sys     - FIR filter to IIR filter conversion.
%    rcosflt     - Filtering signal using raised cosine filter.
%    rcosine     - Design raised cosine filter.
% 
%  Lower-Level Functions for special filters.
%    rcosfir     - Raised cosine FIR filter (used by rcosine).
%    rcosiir     - Raised cosine IIR filter (used by rcosine).
% 
%  Galois Field Computation.
%    flxor       - Exclusive OR calculation.
%    gfadd       - GF additive computation.
%    gfconv      - GF polynomial convolution (multiply) computation.
%    gfcosets    - Cyclotomic cosets generator.
%    gfdeconv    - GF polynomial deconvolution (dividing) computation.
%    gfdiv       - GF dividing computation.
%    gffilter    - GF filtering computation.
%    gflineq     - Computer X in A X = B in GF(p) field.
%    gfminpol    - Find minimal polynomials.
%    gfmul       - GF multiplicative computation.
%    gfplus      - GF(2^p) additive computation.
%    gfpretty    - GF polynomial presentation.
%    gfprimck    - Test GF irreducible and primitive properties.
%    gfprimdf    - Output default primitive polynomial at a given degree.
%    gfprimfd    - Find GF primitive polynomial.
%    gfrank      - Find the rank of a matrix in Galois field.
%    gfrepcov    - GF polynomial conversion.
%    gfroots     - Find roots of a polynomial in GF(p^m) field.
%    gfsub       - GF subtraction computation.
%    gftrunc     - GF polynomial truncation processing.
%    gftuple     - GF m-tuple representation and power representation.
% 
%  Utilities.
%    bi2de       - Binary to positive decimal integer conversion.
%    blkdiag     - Block diagonal concatenation of input arguments (MATLAB Toolbox).
%    callhelp    - Display help text section.
%    checkinp    - Function default value check.
%    closebut    - Close all but specified figure window.
%    de2bi       - Positive decimal integer to binary conversion.
%    vec2mat     - Convert vector to matrix by a given column number.
% 
%  Graphical User Interface example.
%    commgui     - An MATLAB GUI example of bit-error rate computation.
%  
%  -------------------------------------------
%
%  Communications Toolbox Simulink files.
% 
%  Top level file for the Communications Toolbox library.
%    commlib       - Communications Toolbox top level library.
% 
%  Secondary level files for communications toolbox library.
%    com_case    - Case study and examples.
%    com_chan    - Channel sub-library.
%    com_code    - Error-control code sub-library.
%    com_frmt    - Source coding sub-library.
%    com_mlac    - Multi-access sub-library.
%    com_modu    - Modulation / demodulation sub-directory.
%    com_sour    - Source/sink sub-library.
%    com_sync    - Synchronization sub-library.
%    com_util    - Utility sub-library.
% 
%  Lower level files for communications toolbox library.
%    comcdbch    - BCH error-control code sub-library.
%    comcdcon    - Convolution error-control code sub-library.
%    comcdcyc    - Cyclic error-control code sub-library.
%    comcdham    - Hamming error-control code sub-library.
%    comcdlin    - Linear block error-control code sub-library.
%    comcdrs     - Reed-Solomon error-control code sub-library.
%    comcdint    - Interleave, scrambler sub-library.
%    com_cdmo    - Analog modulation, passband simulation sub-library.
%    com_cemo    - Analog modulation, baseband simulation sub-library.
%    com_ddmo    - Digital modulation, passband simulation sub-library.
%    com_ddm2    - Additional digital modulation, passband simulation sub-library.
%    com_mocd    - Digital modulation, passband mapping sub-library.
%    com_moce    - Digital modulation, baseband simulation sub-library.
%    com_momp    - Digital modulation, baseband mapping sub-library.
%    
%  Source/sink library demonstration files.
%    ttrigwks    - Read/write workspace variables
%    ttrigfil    - Read/write files
%    tsteyesc    - Eye-pattern Diagram and Error-meter
%    tstbterr    - Error-meter
%    turand      - Uniform random noise generator
%    tgrand      - Gaussian random noise generator
%    tirand      - Random integer generator
%    tprand      - Poisson integer generator
%    tbrand      - Binary vector generator
%    tstrayl     - Rayleigh noise generator
%    tstricia    - Rician noise generator
% 	
%  Source coding library demonstration files.
%    tstquans    - quantization encode and decode
%    tstdpcms    - DPCM encode and decode
%    tstquant    - enable quantization encode and decode
%    
%  Error-Control Coding Library.
%    tsthammc    - Hamming code vector I/O
%    tsthamsq    - Hamming code sequential I/O
%    tstbchcd    - BCH code vector I/O
%    tutbchcd    - BCH code vector I/O, 2
%    tstbchsq    - BCH code sequential I/O
%    tstrscod    - RS code integer vector I/O
%    tstrscbv    - RS code binary vector I/O
%    tstrsinv    - RS code integer sequential I/O
%    tstrsbnv    - RS code binary sequential I/O
%    tstcyclc    - Cyclic code, Hamming code, and linear block code vector I/O
%    tstcycsq    - Cyclic code sequential I/O
%    tstlinco    - Linear block code vector I/O
%    tstlinsq    - Linear block code sequential I/O
%    tstconcd    - Convolution code vector I/O
%    tutconcd    - Convolution code vector I/O, 2
%    tstconsq    - Convolution code Sequential I/O
%    fig_10_9    - Block diagram for building convolution code transfer function
%    exconvcd    - Block diagram for building convolution code transfer function
%    testinterleave - A basic example of interleaving
%    tstrsbch    - Combination of R-S code, interleave and BCH code
%    testscrm    - Scrambler and descrambler
%    dsss        - Direct sequence spread spectrum system
%     
%  Modulation and demodulation demonstration files.
%    test_am2    - DSB-SC AM/ADM passband and baseband
%    test_qa2    - QAM passband and baseband
%    test_fm2    - FM passband and baseband
%    test_fm2    - PM passband and baseband
%    testssba    - SSB AM passband and baseband
%    testamc2    - AM with carrier passband and baseband
%    tstam2cd    - MASK map/demap, passband
%    tstqa2cd    - QASK S-map map/demap, passband
%    tstps2cd    - QASK C-map map/demap, passband
%    tstps3cd    - QASK A-map map/demap, passband
%    tstfs2cd    - MFSK map/demap, passband
%    tstpk2cd    - MPSK map/demap, passband
%    tmpam2cd    - MASK map/demap, baseband
%    tmpqa2cd    - QASK S-map map/demap, baseband
%    tmpps2cd    - QASK C-map map/demap, baseband
%    tmpps3cd    - QASK A-map map/demap, baseband
%    tmpfs2cd    - MFSK map/demap, passband
%    tmppk2cd    - MPSK map/demap, passband
%    tddmmask    - MASK modem, passband
%    tddmqask    - QASK S-map modem, passband
%    tutcdwmo    - QASK S-map with BCH code, passband
%    tddps2cd    - QASK C-map modem, passband
%    tddps3cd    - QASK A-map modem, passband
%    tddmmfsk    - MFSK modem, passband
%    tddmmpsk    - MPSK modem, passband
%    tstam2ce    - MASK modem, baseband
%    tcemqask    - QASK S-map modem, baseband
%    tceps2cd    - QASK C-map modem, baseband
%    tceps3cd    - QASK A-map modem, baseband
%    tcemmfsk    - MFSK modem, baseband
%    tcemmpsk    - MPSK modem, baseband
%    tdpsk2      - DPSK modem, passband
%    tdpsk       - DPSK map/demap, passband
%    tbpsk       - BPSK modem, passband
%    tbpsk2      - BPSK map/demap, passband
%    tqpsk       - QPSK modem, passband
%    tqpskmap    - QPSK map/demap, passband
%    toqpsk      - OQPSK modem, passband
%    toqpskmp    - OQPSK map/demap, passband
%    tmsk        - MSK modem, passband
%     
%  Multiple access demonstration files.
%    tsttdma     - Digital TDMA
%    tsttdmaa    - Time-sharing multiplex
%    tstfdma     - FDMA
%    tstcdma     - CDMA
%    
%  Special filters demonstration files.
%    tstrcos     - Raised cosine filter
%    tstrcos2    - Raised cosine filter
%    tstsinc     - Sinc filter
%    tsthilbt    - Hilbert transform filter
%     
%  Synchronization demonstration files.
%    tstpll      - Phase locked loop
%     
%  Utilities and miscellany library demonstration files.
%    testregi    - Register shift and triggered buffer down.
%    tstdist     - Triggered signal switch
% 
%   -------------------------------------------
%
%  Communications Toolbox S-functions.
%  
%  M-file S-functions
%     arraymax        - Compute the index with maximum input.
%     arraymin        - Compute the index with minimum input.
%     arraysin        - Compute the vector I/O functions.
%     asciicod        - ASCII code coding.
%     eyediasi        - Eye-pattern diagram and scatter plot.
%     eyesampl        - Eye-pattern diagram and scatter plot (sampled time version).
%     pulsegen        - Generate pulses.
%     sbiterr         - Bit error figure.
%     sbiterrs        - Reset the data for the Bit error figure.
%     simrdbit        - Random bit error generator.
%     sviternd        - Convolution decode without trellis plot.
%     trigfmfl        - Triggered read M-file.
%     
%  C-file S-functions
%     apskdem2        - APSK demodulation.
%     apskdem3        - APSK demodulation.
%     apskdemo        - APSK demodulation.
%     arymimai        - Index of max/min value for the input vector.
%     arymodu         - Modulo computation.
%     arysin          - Array function computation.
%     cmplxflt        - Complex filter.
%     homopuls        - Pulse generator.
%     indxtabl        - Source code decoding.
%     modulint        - Modulo integration.
%     moveint         - Windowed integration.
%     regdown         - Register buffer down.
%     regshift        - Register shift.
%     schdint         - Scheduling reset integration.
%     scomawgnchan    - Additive white gaussian noise channel.
%     scomconvenc     - Convolutional encoder.
%     scompoissrc     - Poisson distribution number generator.
%     scomrbitsrc     - Zero vector with random bit ones.
%     scomrintsrc     - Random integer source.
%     scomsc2vec      - Scalar to Vector conversion.
%     scomunisrc      - Uniform random number generator.
%     scomvec2sc      - Vector to scalar conversion.
%     scomviterbi     - Viterbi decoder.
%     sconvenc        - Convolution encode.
%     simbchdc        - BCH decoding.
%     simbi2de        - Binary to decimal conversion.
%     simde2bi        - Decimal to binary conversion.
%     simquan         - Quantization computation.
%     simquans        - Quantization computation.
%     simrscbv        - RS binary format encode.
%     simrscod        - RS integer format encode.
%     simrsdbv        - RS binary format decode
%     simrsdec        - RS integer format decode.
%     simscram        - Scrambler and descrambler.
%     srandbit        - Random bit error generator.
%     srandint        - Random integer generator.
%     srandpoi        - Poisson noise generator.
%     sreadfil        - Read from a file.
%     stdmamux        - TDMA mux/demux computation.
%     surandom        - Uniform random distribution.
%     sviterba        - Convolution decode without trellis plot.
%     sviterbi        - Convolution decode with trellis plot.
%     switchbx        - Select block output.
%     swritfil        - Write to a file.
%     swritwks        - Write to workspace.
%     trigwksp        - Triggered write to workspace.
%     v34recv         - A Simulink example for v34 transmission.
%     v34trans        - A Simulink example for v34 transmission.
% 
%   

function Readme
%MATLAB Tour Partial Function Help:  comm_con
%
%  README file for the Communications Toolbox.
%  Version 1.4   (R11) 10-Jul-1998
%  
%  For a complete listing of the changes with Version 1.4 of the
%  Communications Toolbox, please see the Communications Toolbox 
%  New Features Guide.
% 
% 
%  COMPATIBILITY
%  ~~~~~~~~~~~~~
%  All old (v1.3 and prior) models are supported and will run
%  in this release while you transition to v1.4.  Note that there
%  is no automatic model upgrade facility.
% 
%  You cannot directly mix the old complex data format with the
%  new intrinsic complex data type; conversion blocks are provided
%  in the DSP Blockset Elementary Functions library which can translate 
%  between the two complex formats while transitioning older models to v1.4.
% 
% 
%  NEW FEATURES
%  ~~~~~~~~~~~~
%  Version 1.4 of the Communications Toolbox contains the following
%  new blocks:
% 
%   - Convolutional Encoder
%   - Viterbi Decoder
%   - Data Mapper
%   - Error Rate Calculation 
% 
%  The Simulink block libraries have been reorganized and streamlined.
%  To access the new Version 1.4 library, type "commlib" at the MATLAB
%  prompt.  The command "commlib 1" will access the Version 1.3 library.  
%  
%  Complex data is now an intrinsic data type, and blocks and
%  lines now automatically recognize when data is real or complex.
%  This greatly reduces the risk of unintentionally sending complex
%  data to a block which only accepts real inputs.
% 
% 
%  ENHANCEMENTS
%  ~~~~~~~~~~~~
%  The AWGN Channel now includes the functionality of the following
%  Version 1.3 blocks: AWGN Channel, AWGN w Vary Para, Rayleigh Noise
%  Channel CE, Rayleigh Noise Channel with Vary Var CE.
% 
%  The Integer Scalar to Vector and Integer Vector to Scalar blocks 
%  now allow you to reverse the order of the elements in the vector.
% 
%  The PM and FM Baseband blocks have a new parameter, Modulation
%  Constant.
% 

function commlib
%MATLAB Tour Partial Function Help:  comm_con
%
%  COMMLIB Open The Communications Toolbox Simulink Block Library
% 
%   COMMLIB opens the latest version of this library.
% 
%   COMMLIB(1) opens previous version.
%   COMMLIB 1  also opens previous version.
% 
%   The Communications Toolbox Simulink Block Library has the
%   following tree structure:
% 
%     COMMLIB             Main Library
%       COMMSOURCE          Communication Sources
%       COMMSINK            Communication Sinks
%       COMMSRCCOD          Source Coding
%       COMMFECCOD          Channel Coding
%         COMMBLKCOD          Block Coding
%         COMMCNVCOD          Convolutional Coding
%       COMMMOD             Modulation Techniques
%         COMMDIGBBND         Baseband Digital Modulation/Demodulation
%         COMMDIGPBND         Passband Digital Modulation/Demodulation
%         COMMANABBND         Baseband Analog Modulation/Demodulation
%         COMMANAPBND         Passband Analog Modulation/Demodulation
%       COMMCHAN            Communication Channel Models Library
%       COMMSYNC            Synchronization Library
%       COMMUTIL            Utility Library
% 

function biterr
%MATLAB Tour Partial Function Help:  comm_con
%
% BITERR Computes bit error.
%        [NUMBER, RATIO] = BITERR(X, Y) compares the elements in the input
%        matrices X and Y. The number of the bit differences is outputted in 
%        NUMBER. The ratio of NUMBER to the total bit number contained in
%        Y is output in RATIO. All elements in X and Y should be non-negative
%        integers. The total bit number in Y is estimated by 
%             column_y * row_y * K, 
%        where K is the bit number for each element in Y. K is the smallest
%        integer satisfying MAX < 2^K, where MAX is the maximum number in both
%        X and Y. When X or Y is a matrix and the other is a vector, this 
%        function convert the vectors to a matrix with the column number the
%        same as the matrix before the comparison.
% 
%        [NUMBER, RATIO] = BITERR(X, Y, K) specifies the bit number in X and Y
%        in the calculation.
% 
%        [NUMBER, RATIO] = BITERR(X, Y, K, 'columnwise') NUMBER and RATIO are
%        row vectors with the number and ratio for each column comparison.
% 
%        

function eyescat
%MATLAB Tour Partial Function Help:  comm_con
%
% EYESCAT Produces eye-pattern diagram or scatter plot.
%        EYESCAT(X, Fd, Fs) produces an eye-pattern diagram with time range
%        from 0 to 1/Fd. The sample frequency for input signal X is 1/Fs. Fs
%        must be larger than Fd. Fs / Fd must be a positive integer.
% 
%        EYESCAT(X, Fd, Fs, OFFSET) specifies the number of points offset in
%        the eye-pattern diagram x-axis arrangement. OFFSET must be an integer.
%        The actual time shift in the plot is OFFSET/Fs second.
% 
%        EYESCAT(X, Fd, Fs, OFFSET, Dpoint) marks the decision point location
%        in the eye-pattern diagram. Dpoint must be an integer, which indicates
%        number of points from time zero. The location is at time Dpoint/Fs.
%        Dpoint is independent of axis shifting location OFFSET. When Dpoint is
%        a string, this function produces a scatter plot. The valid string can
%        be Dpoint = '.', '*', 'x', 'o' or '+', which specifies the plot
%        symbols. In scatter plots, OFFSET point is used as a decision point,
%        when decisions are made. When OFFSET=0, the decision point is at the
%        very end point of a digit transfer sequence.
% 
%        

function randint
%MATLAB Tour Partial Function Help:  comm_con
%
% RANDINT Random integer matrix generator.
%        OUT = RANDINT(N) generates an N-by-N matrix of random binary numbers. 
%        The appearance of "0" and "1" have even probability.
% 
%        OUT = RANDINT(N, M) generates an N-by-M matrix of random binary 
%        numbers. The appearance of "0" and "1" have even probability.
% 
%        OUT = RANDINT(N, M, RANGE) generates an N-by-M matrix of random 
%        integer numbers.
% 
%        The minimum and maximum output integer numbers are specified in 
%        RANGE(1) and RANGE(2). All integers in range [RANGE(1), RANGE(2)] 
%        have even probability and appear in the output variable OUT. When
%        RANGE is a scalar positive integer, the output integer range is 
%        [0, RANGE-1].
%        
%        OUT = RANDINT(N, M, RANGE, SEED) specifies the random number seed 
%        in SEED.
% 
%        

function randbit
%MATLAB Tour Partial Function Help:  comm_con
%
% RANDBIT Binary noise generator.
%        OUT = RANDBIT(N, M) generates an N-by-M zero matrix with an single 
%        "1" randomly placed in any bit of each row. 
% 
%        OUT = RANDBIT(N, M, PROB) generates an N-by-M zeros matrix with "1"s
%        uniformly distributed in any bit of each row. The probability of "1"
%        appearance is specified in variable PROB. The first element of PROB
%        is the probability of single "1" in each row. The second element of
%        PROB is the probability of double "1" in each row and so on. The size
%        of vector prob is the maximum "1" bit in each row. The sum of the 
%        PROB cannot be larger than one. 
% 
%        OUT = RANDBIT(N, M, PROB, SEED) specify the seed.
% 
%        This function is initially designed to test error-control coding.
% 
%        

function symerr
%MATLAB Tour Partial Function Help:  comm_con
%
%  SYMERR Symbol error analysis.
%        [NUMBER, RATIO] = SYMERR(X, Y) compares the elements in the two
%        matrices X and Y. The number of the differences is outputted in
%        NUMBER. The ratio of NUMBER to the dimension of Y is output in
%        RATIO. When the inputs include both a vector and a matrix, this
%        function first converts the vector to a matrix with the same
%        column number as the matrix, where each column has the same
%        element.
% 
%        [NUMBER, RATIO] = SYMERR(X, Y, 'columnwise') specifies that the output
%        NUMBER and RATIO are row vectors, which are the number and ratio for
%        each columnwise comparison.
% 
%        

function compand
%MATLAB Tour Partial Function Help:  comm_con
%
% COMPAND Computes source code mu-law or A-law compressor or expander.
%        OUT = COMPAND(IN, PARAM, V) computes mu-law compressor with mu given
%        in PARAM and the peak magnitude given in V.
% 
%        OUT = COMPAND(IN, PARAM, V, METHOD) computes mu-law or A-law 
%        compressor or expander computation with the computation method given
%        in METHOD. PARAM provides the mu or A value. V provides the input 
%        signal peak magnitude. METHOD can be chosen as one of the following:
%        METHOD = 'mu/compressor' mu-law compressor.
%        METHOD = 'mu/expander'   mu-law expander.
%        METHOD = 'A/compressor'  A-law compressor.
%        METHOD = 'A/expander'    A-law expander.
% 
%        The prevailing values used in practice are mu=255 and A=87.6.
% 
%        

function dpcmdeco
%MATLAB Tour Partial Function Help:  comm_con
%
% DPCMDECO Decodes a DPCM encoded signal.
%        SIG = DPCMDECO(INDX, CODEBOOK, PREDICTOR) decodes a differential pulse
%        code modulation (DPCM) encoded index signal INDX. The predictive
%        transfer function is provided in PREDICTOR. The predictive-error
%        quantization codebook is given in CODEBOOK. In general, an M-th
%        order transfer function has the form of [0, n1, n2, ... nM]. To
%        obtain a correct decode result, the parameters must match the encode
%        parameters.
% 
%        [SIG, QUANT] = DPCMDECO(INDX, CODEBOOK, PREDICTOR) outputs the
%        quantized predictive error in QUANT.
% 
%        The input parameters CODEBOOK and PREDICTOR can be estimated by using
%        DPCMOPT.
% 
%        

function dpcmenco
%MATLAB Tour Partial Function Help:  comm_con
%
% DPCMENCO Encodes a signal using differential pulse code modulation method.
%        INDX = DPCMENCO(SIG, CODEBOOK, PARTITOIN, PREDICTOR) produces
%        differential pulse code modulation (DPCM) encoded index INDX. The
%        signal to be encoded is SIG. The predictive transfer function is
%        provided in PREDICTOR. The predictive-error quantization partition
%        and code book are given in PARTITION and CODEBOOK respectively. In
%        general, an M-th order transfer function numerator has the form of 
%        [0, n1, n2, ... nM].
% 
%        [INDX, QUANT] = DPCMENCO(SIG, CODEBOOK, PARTITION, PREDICTOR) outputs
%        the quantized value in QUANT.
% 
%        The input parameters CODEBOOK, PARTITION,  and PREDICTOR can be 
%        estimated by using DPCMOPT.
% 
%        

function dpcmopt
%MATLAB Tour Partial Function Help:  comm_con
%
% DPCMOPT DPCM parameter optimization using training data.
%        P_TRANS = DPCMOPT(TRAINING_SET, ORD) estimates the predictive transfer
%        function P_TRANS using the given order ORD and the training set
%        TRAINING_SET.
% 
%        [P_TRANS,CODEBOOK,PARTITION] = DPCMOPT(TRAINING_SET,ORD,INI_CODEBOOK)
%        produces the optimized predictive transfer function P_TRAINS,  
%        CODEBOOK, and PARTITION for the DPCM. The input variable INI_CODEBOOK
%        can either be a vector that contains the initial estimated value of
%        the codebook vector or a scalar integer that specifies the vector
%        size of CODEBOOK.
% 
%        

function lloyds
%MATLAB Tour Partial Function Help:  comm_con
%
% LLOYDS Optimizes scalar quantization partition and codebook.
%        [PARTITION, CODEBOOK] = LLOYDS(TRAINING_SET, INI_CODEBOOK) optimizes
%        the scalar quantization PARTITION and CODEBOOK based on the provided
%        training vector TRAINING_SET using the Lloyd I algorithm. The data in 
%        the variable TRANING_SET should be typical data for the message source
%        to be quantized. INI_CODEBOOK is the initial guess of the codebook
%        values. The optimized CODEBOOK has the same vector size as
%        INI_CODEBOOK. When INI_CODEBOOK is a scalar integer instead of vector,
%        it is the length of the desired CODEBOOK vector. PARTITION is a vector
%        with the vector length being the CODEBOOK vector length minus 1. The
%        optimization will be terminated if the relative distortion is less
%        than 10^(-7).
% 
%        [PARTITION, CODEBOOK] = LLOYDS(TRAINING_SET, INI_CODEBOOK, TOL)
%        provides the tolerance in the optimization.
% 
%        [PARTITION, CODEBOOK, DISTORTION] = LLOYDS(...) outputs the final
%        distortion value.
% 
%        [PARTITION, CODEBOOK, DISTORTION, REL_DISTORTION] = LLOYDS(...)
%        outputs the relative distortion value in terminating the computation.
% 
%        

function quantiz
%MATLAB Tour Partial Function Help:  comm_con
%
% QUANTIZ Produces the quantization index and output value.
%        INDX = QUANTIZ(SIG, PARTITION) produces a quantization index INDEX of
%        the input signal SIG based on the decision points PARTITION. Each
%        element in INDX is one of the N integers in range [0 : N-1]. PARTITION
%        is a strict ascending ordered N-1 vector that specifies the
%        boundaries. Elements of INDX = 0, 1, 2, ..., N-1 represent SIG in the
%        range of (-Inf, PARTITION(1)], (PARTITION(1), PARTITION(2)],
%        (PARTITION(2), PARTITION(3)], ..., (PARTITION(N-1), Inf).
% 
%        [INDX, QUANT] = QUANTIZ(SIG, PARTITION, CODEBOOK) produces the output
%        value of the quantizer in QUANT. CODEBOOK is a length N vector that
%        contains the output set.
% 
%        [INDX, QUANT, DISTOR] = QUANTIZ(SIG, PARTITION, CODEBOOK) outputs 
%        DISTOR, the estimated distortion value of the quantization.
% 
%        There is no decode quantizer function in this toolbox. The decode
%        computation could be easily computed by
%        Y = CODEBOOK(INDX+1).
% 
%        

function bchpoly
%MATLAB Tour Partial Function Help:  comm_con
%
% BCHPOLY Produces GF(2) BCH code generator polynomial.
%        BCHPOLY lists the codeword length, message length, and
%        error-correction capability for BCH code in a figure. The codeword
%        lengths listed are 7, 15, 31, 63, 127, 255, and 511.
% 
%        Pg = BCHPOLY outputs the list to a vector Pg. The first column is
%        the code word length, the second column is the message length, and the
%        third column is the error-correction capability.
% 
%        Pg = BCHPOLY(N) outputs the code word length equal or larger than N,
%        its message lengths, and error-correction capability on the first,
%        second and third column of Pg respectively. When N > 511, the error
%        control capability is not listed.
% 
%        Pg = BCHPOLY(N, K) produces BCH code generator polynomial Pg based on
%        two positive numbers: the codeword length N and the message length K.
%        The codeword length must be the solution of 2^M - 1, where M is a 
%        integer larger than 2. K should be a valid message length, which can
%        be found by using Pg = BCHPOLY(N) to get a list. 
%        When N is a binary vector instead of a positive number, N is a
%        primitive polynomial generating the field GF(2^DEG), where DEG is the
%        degree of polynomial N(X). The codeword length in this case should be 
%        2^DEG - 1.
% 
%        [Pg, Pm] = BCHPOLY(N, K) outputs minimum polynomials Pm in the field
%        GF(2^M). Each row of Pm is a minimum polynomial.
% 
%        [Pg, Pm, CS] = BCHPOLY(N, K) list the cosets that are the roots of
%        the polynomial Pg.
% 
%        [Pg, Pm, CS, H] = BCHPOLY(N, K) outputs the parity-check matrix H.
% 
%        [Pg, Pm, CS, H, T] = BCHPOLY(N, K) outputs the error-control
%        capability of the BCH code.
% 
%        

function cyclgen
%MATLAB Tour Partial Function Help:  comm_con
%
% CYCLGEN Produces cyclic code generator matrix in GF(2).
%        H = CYCLGEN(N, P) produces the parity-check matrix for a given
%        codeword length N and generates polynomial P. Polynomial P can
%        generate a cyclic code only if P is a factor of polynomial X^N-1.
%        The message length of the coding is K = N - M where M is the degree
%        of P. The parity-check matrix is an M-by-N matrix.
% 
%        H = CYCLGEN(N, P, OPT) produces the parity-check matrix based on the
%        instruction given in OPT. When
%        OPT = 'nonsys', the function produces a non-systematic cyclic parity-
%                        check matrix;
%        OPT = 'system', the function produces a systematic cyclic parity-check
%                        matrix. This option is the default.
% 
%        [H, G] = CYCLGEN(...) produces the generator matrix G as well as the 
%        generator matrix G. The parity-check matrix is an K-by-N matrix,
%        where K = N - M;
% 
%        [H, G, K] = CYCLGEN(...) outputs the message length K.
% 
%        

function cyclpoly
%MATLAB Tour Partial Function Help:  comm_con
%
% CYCLPOLY  Finds cyclic generator polynomials in GF(2).
%        PR = CYCLPOLY(N, K) finds one cyclic generator polynomial for a given
%        codeword length N and message length K.
% 
%        PR = CYCLPOLY(N, K, FD_FLAG) finds cyclic generator polynomial(s) for
%        a given code word length N and message length K. The flag FC_FLAG
%        means:
%        FD_FLAG = 'min'  find the minimum degree cyclic generator polynomial.
%        FD_FLAG = 'max'  find the maximum degree cyclic generator polynomial.
%        FD_FLAG = 'all'  do an exhaustive search for all cyclic generator 
%                         polynomials of the given degree.
%        FD_FLAG = L      find all cyclic generator polynomials with L terms.
% 
%        If no cyclic generator polynomial is found provided the given 
%        condition, PR is an empty output. A cyclic generator polynomial is
%        an irreducible polynomial.
% 
%        

function decode
%MATLAB Tour Partial Function Help:  comm_con
%
% DECODE Error-control code decoding computation.
%        MSG = DECODE(CODE, N, K) decodes binary codeword in CODE using Hamming
%        code method. The code word length is N and the message length is K.
%        The format of CODE can be either a vector or an N column matrix. A
%        Hamming code has codeword length 2^M -1, where M is an integer no less
%        than 3. The message length is 2^M - M - 1. The Hamming code is a 
%        single error-correction code.
% 
%        MSG = DECODE(CODE, N, K, METHOD, OPT1, OPT2, OPT3, OPT4) decodes the
%        codeword signal CODE using an error-control coding method such that
%        the message length is K and code word length is N with the coding
%        method specified in variable METHOD. OPT1 to OPT4 are extra
%        optional parameters used in some of the methods.
%        
%         METHOD         ENCODE SCHEME
%        'hamming'       Hamming code
%        'linear'        Linear block code
%        'cyclic'        Cyclic code
%        'bch'           BCH code
%        'rs'            Reed-Solomon code
%        'convol'        Convolution code
% 
%        To use all of the methods, the message signal in CODE could be a binary
%        vector or a L-column matrix. In using methods other than the "rs"
%        method, L equals N. In using the "rs" method, L = M, where 
%        N = 2^M - 1. M is an integer >= 3. CODE can also be a non-negative
%        integer in the range of [0, 2^L-1]. In this case, you have to add 
%        '/decimal' in the method specification. For example, 'bch' is 
%        equivalent to 'bch/binary'. 'bch/decimal' means the data in MSG is
%        binary. Except for the 'rs' method, MSG can only be a vector when 
%        using the decimal method.
% 
%        The output MSG contains the decoded message. The format of MSG matches
%        the format of CODE. When CODE is a N-column matrix, the output MSG is
%        a K-column matrix. 
% 
%        When the format of the input CODE is not the same as the output
%        of function ENCODE, this function stops processing.
% 
%        [MSG, ERR] = DECODE(...) indicates the number of errors detected in
%        the decoding. If the element in ERR is a negative number, it means
%        that more errors occurred than the error-correction capability.
%        
%        [MSG, ERR, CCODE] = DECODE(...) outputs the corrected CODE in CCODE.
% 
%        [MSG, ERR, CCODE, CERR] = DECODE(...) outputs errors corresponding to
%        each row of CCODE.
% 
%        Use DECODE(METHOD) to view the help for a specific method.
% 
%        

function encode
%MATLAB Tour Partial Function Help:  comm_con
%
% ENCODE Error-control code encoding computation.
%        CODE = ENCODE(MSG, N, K) encodes the binary message specified in MSG 
%        using the Hamming coding technique. The code word length is N and 
%        the message length is K. The format of MSG can be either a vector or
%        K column matrix. A Hamming code has code word length 2^M -1, where M 
%        is an integer no less than 3. The message length is 2^M - M - 1. 
%        Hamming code is a single error-correction code.
% 
%        CODE = ENCODE(MSG, N, K, METHOD, OPT) encodes the message signal MSG
%        using an error-control coding method such that the message length is
%        K and code word length is N with the coding method as specified in
%        variable METHOD. OPT is an optional parameter used in some of
%        the methods.
%        
%        METHOD      ENCODE SCHEME
%        'hamming'   Hamming code.
%        'linear'    Linear block code.
%        'cyclic'    Cyclic code.
%        'bch'       Binary BCH code.
%        'rs'        Reed-Solomon code.
%        'convol'    Convolution code.
% 
%        The CODE outputs the encoded code word. The format of CODE matched the
%        format of MSG. When MSG is a K-column matrix, the output CODE is a 
%        N-column matrix. 
% 
%        [CODE, ADDED] = ENCODE(MSG, N, K, METHOD, OPT) outputs the number of
%        columns added to MSG in order to make the encoding.
% 
%        Use ENCODE(METHOD) to view the help for a specific method.
% 
%        

function gen2par
%MATLAB Tour Partial Function Help:  comm_con
%
% GEN2PAR Converts generator matrix to parity-check matrix in GF(2).
%        H = GEN2PAR(G) computes parity-check matrix H from generator matrix G.
%        The function can also used to convert a parity-check matrix to a 
%        generator matrix. The conversion is used in GF(2) only.
% 
%        

function gen2abcd
%MATLAB Tour Partial Function Help:  comm_con
%
% GEN2ABCD Convert a convolution generate function into [A, B, C, D] form.
%    [A, B, C, D] = GEN2ABCD(GEN) converts the generate function provided
%    in GEN, either the binary form of output from SIM2GEN2 or the OCT form
%    output from SIM2GEN into the binary state form [A, B, C, D]. The state
%    form of the generating function is
%        x(k+1) = A x(k) + B u(k)
%        y(k)   = C x(k) + D u(k)
%    For the octal form GEN, the realization may not be the minimum degree
%    realization.
% 
%    [A, B, C, D] = GEN2ABCD(TRAN_FUNC, CODE_PARAM) converts the binary
%    generating function into [A, B, C, D] form.  CODE_PARAM = [N, K, M],
%    where N is the output codeword length and is the row number of D. K
%    is the input message length and is the column number of D. M is the
%    memory length. The output of this function TRAN_FUNC is a K-by-N*(M+1)
%    binary matrix. TRAN_FUNC has the following form:
%                      | G11   G12  ... G1N |
%          TRAN_FUNC = | ...                |
%                      | GK1   GK2  ... GKN |
%    where Gij is a length M row vector, which is the transfer from the Ith
%    input to Jth output. 
% 
%    [A, B, C, D, N, K, M] = GEN2ABCD(....) outputs the codeword length N,
%    message length K, and memory length M.
% 
%    TRAN_FUNC = GEN2ABCD(...) outputs the input form of the first syntax
%    form.
% 
%    

function gfweight
%MATLAB Tour Partial Function Help:  comm_con
%
% GFWEIGHT Calculates Hamming weight based on generator or parity-check matrix.
%        WT = GFWEIGHT(G) outputs the Hamming weight of the given generator
%        matrix G.
%        WT = GFWEIGHT(G, GH_FLAG) outputs the Hamming weight, where GF_FLAG is
%        used to specify the feature of the first input parameter.
%        When GH_FLAG == 'gen', g is a generator matrix.
%        When GH_FLAG == 'par', g is a parity-check matrix.
%        When GH_FLAG == n, which represents the code word length, G is a
%        generator polynomial.
% 
%        

function hammgen
%MATLAB Tour Partial Function Help:  comm_con
%
% HAMMGEN Produces the Hamming code generator and the parity-check matrices.
%        H = HAMMGEN(M) produces the parity-check matrix H for a given positive
%        integer M, M >= 3. The code length of a Hamming code is N=2^M-1. The
%        message length is K = 2^M - M - 1. The parity-check matrix is an 
%        M-by-N matrix.
% 
%        H = HAMMGEN(M, P) produces the parity-check matrix using a given
%        GF(2) primitive polynomial P.
% 
%        [H, G] = HAMMGEN(...) produces the generator matrix G as well as the 
%        generator matrix G. The parity-check matrix is a K-by-N matrix.
% 
%        [H, G, N, K] = HAMMGEN(...) outputs the dimension information N and K.
% 
%        Note: The input number M should be a larger than integer 3. Hamming
%        code is a single error-correction code defined in GF(2).
% 
%        

function htruthtb
%MATLAB Tour Partial Function Help:  comm_con
%
% HTRUTHTB Generates a Hamming code truth table.
%        TRT = HTRUTHTB(G) produces a truth table for single error-correction
%        code. The size of G has the dimension defined in Hamming coding.
% 
%        

function oct2gen
%MATLAB Tour Partial Function Help:  comm_con
%
% OCT2GEN Converts an octal form of transfer function into a binary one.
%        [TRAN_FUNC, CODE_PARAM] = OCT2GEN(GEN) converts an octal form of
%        transfer function matrix GEN into a binary form of transfer function
%        TRAN_FUNC. This function is designed to convert the convolution coding
%        transfer function. The input GEN is an octal form transfer function,
%        which has the structure of
%                    | g11  g12 ... g1N |
%              GEN = | ......           |
%                    | gK1  gK2 ... gKN |
%        in which gIJ is the Ith input Jth output octal form transfer function.
%        The function converts GEN into convolution code parameter CODE_PARAM =
%        [N, K, M], and convolution code transfer function TRAN_FUNC.
%        N is the output codeword length and is the row number of GEN. K is the
%        input message length and is the column number of GEN. M is the memory
%        length. The output of this function TRAN_FUNC is a K-by-N*(M+1) binary
%        matrix. TRAN_FUNC has the following form:
%                      | G11   G12  ... G1N |
%          TRAN_FUNC = | ...                |
%                      | GK1   GK2  ... GKN |
%        where Gij is a length M row vector, which is the transfer from the Ith
%        input to Jth output. 
% 
%        TRAN_FUNC = OCT2GEN(GEN, CODE_PARAM) converts a binary form transfer
%        function matrix GEN into an octal form of transfer function TRAN_FUNC.
% 
%        

function rsdecof
%MATLAB Tour Partial Function Help:  comm_con
%
% RSDECOF Reed-Solomon decode for an ASCII file.
%        RSDECOF(FILE_IN, FILE_OUT) decodes an ASCII file FILE_IN using
%        a code-word length 127, message length 117 Reed-Solomon code. The
%        error-correction capability of this code is 5 (for every 127
%        characters). The decoded message is written to FILE_OUT. Both
%        FILE_IN and FILE_OUT are string variables. FILE_IN should be 
%        the output processed by RSENCOF.
% 
%        RSDECOF(FILE_IN, FILE_OUT, ERR_COR) decodes an ASCII file FILE_IN
%        using code-word length 127, error-correction capability as ERR_COR
%        Reed-Solomon code. The message length is 127 - 2*ERR_COR.
% 
%        

function rsencof
%MATLAB Tour Partial Function Help:  comm_con
%
% RSENCOF Reed-Solomon encode for an ASCII file.
%        RSENCOF(FILE_IN, FILE_OUT) encodes an ASCII file FILE_IN using
%        codeword length 127, message length 117 Reed-Solomon code. The
%        error-correction capability of this code is 5 (for every 127
%        characters). The encoded code is written to FILE_OUT. Both
%        FILE_IN and FILE_OUT are string variables.
% 
%        RSENCOF(FILE_IN, FILE_OUT, ERR_COR) encodes an ASCII file FILE_IN
%        using codeword length 127, error-correction capability as ERR_COR
%        Reed-Solomon code. The message length is 127 - 2*ERR_COR.
% 
%        

function rspoly
%MATLAB Tour Partial Function Help:  comm_con
%
% RSPOLY Produces Reed-Solomon code generator polynomial.
%        Pg = RSPOLY(N, K) outputs the generator polynomial of Reed-Solomon
%        code with codeword length N, message length K. A valid N should be
%        2^M-1, where M is an integer no less than 3. K should be an odd
%        positive number. The error-correction capability is (N - K) / 2. The
%        output Pg is a polynomial in GF(2^M). Each element is represented by
%        the power form.
% 
%        Pg = RSPOLY(N, K, TP) produces generator polynomials using the
%        specified GF(2^M) element list. TP is a (N+1)-by-M matrix, where
%        N = 2^M-1. When TP is a scalar, it specifies M. This form is suggested
%        to speed up the calculation.
% 
%        [Pg, T] = RSPOLY(N, K) outputs the error-correction capability of the
%        RS code.
% 
%        

function sim2gen
%MATLAB Tour Partial Function Help:  comm_con
%
% SIM2GEN Converts a Simulink block diagram to convolution code transfer function.
%        TRAN_FUNC = SIM2GEN(SIM_FILE) reads in a Simulink block diagram file
%        specified in the string SIM_FILE. The output TRAN_FUNC has the
%        form:
%                    | g11  g12 ... g1N |
%        TRAN_FUNC = | ......           |
%                    | gK1  gK2 ... gKN |
%        in which gIJ is the Ith input Jth output octal form transfer function.
%        For example gij = 65 represents the transfer function for Ith input
%        and Jth output g(D) = 1 + D + D^3 + D^5.
%        SIM_FILE should contain no subsystem. The SIMULINK file is built using
%        following blocks:
%            Memory    -- register
%            XOR Logic -- logic add
%            Inport    -- message input port
%            Outport   -- code output port
%        Currently, this function only processes the case when there is a
%        feedback loop.
% 
%        

function sim2logi
%MATLAB Tour Partial Function Help:  comm_con
%
% SIM2LOGIC Convert a Simulink block diagram to convolution code logic representation.
%        TRAN_FUNC = SIM2LOGI(SIM_FILE) reads in a Simulink block diagram file
%        specified in the string SIM_FILE. The function outputs TRAN_FUNC in
%        the non-linear form. Please refer the user's guide for the 
%        nonlinear transfer function format.
% 
%        

function sim2tran
%MATLAB Tour Partial Function Help:  comm_con
%
% SIM2TRAN Converts a Simulink block diagram to convolution code transfer function.
%        TRAN_FUNC = SIM2TRAN(SIM_FILE) reads in a Simulink block diagram file
%        specified in the string SIM_FILE. The function outputs TRAN_FUNC in the
%        form 
%                    | a11  a12 ... a1M b11 b12 ... b1K N   |
%                    | ......           ....            K   |
%                    | aMM  aMM ... aMM bM1 bM2 ... bMK M   |
%        TRAN_FUNC = | c11  c12 ... c1M d11 d12 ... d1K 0   |
%                    | ......           ......          0   |
%                    | cN1  cN2 ... cNM dN1 dN2 ... dNK -Inf|
%        The transfer function has the form 
%            x(k+1) = A x(k) + B u(k)
%            y(k)   = C x(k) + D u(k)
%        where A, B, C, D are binary matrices.
% 
%        SIM_FILE should contain no subsystems. The SIMULINK file is built using
%        following blocks:
%            Memory    -- register
%            XOR Logic -- logic add
%            Inport    -- message input port
%            Outport   -- code output port
%        Currently, this function only processes the case when there is a
%        feedback loop.
% 
%        

function viterbi
%MATLAB Tour Partial Function Help:  comm_con
%
% VITERBI Convolution decode using Viterbi algorithm.
%        MSG = VITERBI(CODE, TRAN_FUNC) uses the Viterbi algorithm to recover the
%        message in CODE with the transfer function matrix provided in TRAN_FUNC.
%        The transfer function matrix is provided in state system form as
%        described in the help file for SIM2TRAN. You can use SIM2TRAN to
%        generate the transfer function from a block diagram of convolution
%        code. CODE is received in a binary symmetric channel (BSC). All
%        elements in CODE should be binary. CODE is a matrix with the column
%        size the same as the code length. See function OCT2GEN for the format
%        of an octal form of transfer function matrix. 
% 
%        MSG = VITERBI(CODE, TRAN_FUNC, LEN) keeps the trace memory length
%        no larger than LEN.
%        
%        MSG = VITERBI(CODE, TRAN_FUNC, LEN, TRAN_PROB) uses the Viterbi algorithm
%        to recover the message in CODE with the transfer function matrix provided
%        in TRAN_FUNC. TRAN_FUNC is in octal form. CODE is assumed to be
%        received in a discrete memoryless channel (DMC). The element in CODE
%        may not be in a binary form. TRAN_PROB is a parameter specifying the
%        transfer probability. TRAN_PROB is a three row matrix specifying the
%        transfer probability in soft decision case. The first row of TRAN_PROB
%        specifies the receiving range; the second row specifies the probability
%        of "zero" signal transfer probability to the receiving range; the third
%        row specifies the probability of "one" signal transfer probability to
%        the receiving range. For example,
%        TRAN_PROB = [-Inf 1/10, 1/2, 9/10; 
%                      2/5, 1/3, 1/5, 1/15; 
%                     1/16, 1/8, 3/8, 7/16]
%        means that transferred "zero" signal has 2/5 probability receiving in
%        range (-Inf, 1/10], 1/3 in range (1/10, 1/2], 1/5 in range 
%        (1/2, 9/10], and 1/15 in range (9/10, Inf). The "one" signal has
%        1/16 probability in range (-Inf, 1/10], 1/8 in range (1/10, 1/2], 
%        3/8 in range (1/2, 9/10], 7/16 in range (9/10, Inf). When TRAN_PROB is
%        assigned to be zero, this function processes hard-decision decode.
%        In order to do soft-decision decode,  you must use a three row matrix.
%        Please see page 3-44 of the User's guide for more information.
% 
%        [MSG, DIST] = VITERBI(CODE, TRAN_FUNC) returns the Hamming distance
%        in each step of recovering the message.
% 
%        [MSG, REC_PROB, SURVIVOR] = VITERBI(...) outputs the survivors of the
%        code.
% 
%        [...] = VITERBI(CODE, TRANS_FUNC, LEN, TRAN_PROB, PLOT_FLAG) plots the
%        trellis diagram for the decoding.  PLOT_FLAG, a positive integer,
%        is the figure number to be used to plot the diagram. In the
%        trellis diagram, yellow paths are the possible paths; red paths are
%        the survivors. The number in the state position is the metric or the
%        accumulated Hamming distance in the BSC case. When PLOT_FLAG is not
%        an integer or it is a negative number, the function does not plot
%        the diagram. Note that the function computation is very slow if the
%        plot is required.
% 
%        

function bchcore
%MATLAB Tour Partial Function Help:  comm_con
%
% BCHCORE The core part of the BCH decode.
%        [MSG, ERR, CCODE] = BCHCORE(CODE, POW_DIM, DIM, K, T, TP) decodes
%        a BCH code, in which CODE is a code word row vector,  with its column
%        size being POW_DIM. POW_DIM equals 2^DIM -1. K is the message length,
%        T is the error correction capability. TP is a complete list of the
%        elements in GF(2^DIM).
% 
%        This function can share information between a Simulink file and
%        MATLAB functions. It is not designed to be called directly. There is
%        no error checking in order to eliminate overhead.
% 

function bchdeco
%MATLAB Tour Partial Function Help:  comm_con
%
% BCHDECO Decodes a codeword using BCH decode method.
%        MSG = BCHDECO(CODE, K, T) recovers a message signal MSG from a
%        codeword CODE using BCH code technique provided K is the message
%        length and T is the error-correction capability.
% 
%        MSG = BCHDECO(CODE, K, T, ORD) specifies the primitive polynomial in
%        producing the minimal polynomial of the BCH code.
% 
%        [MSG, ERR] = BCHDECO(...) outputs the corrected error number. When 
%        the number of errors is larger than t, the error correction
%        capability, ERR equals -1.
% 
%        [MSG, ERR, CCODE] = BCHDECO(...) outputs corrected codeword.
% 
%        This example uses BCHDECO to process a three error correction code.
%        [pg, pm, cs, h, t] = bchpoly(15, 5);  % produce generator polynomial
%        [h, gen] = cyclgen(15, pg);           % produce generator matrix
%        msg = randint(100, 5);                % message signal
%        code = encode(msg, gen);              % encode
%        code = rem(code + randbit(100,15,[.3,.3,.3]), 2);   % add errors.
%        [dec, err] = bchdeco(code, 5, t);     % decode

function bchenco
%MATLAB Tour Partial Function Help:  comm_con
%
% BCHENCO Encodes message signal using binary BCH code.
%        CODE = BCHENCO(MSG, N, K) encodes the K-column message MSG to N-column
%        codeword CODE by using BCH code method. 
% 
%        CODE = BCHENCO(MSG, N, K, PG) specifies the generator polynomial PG
%        for the BCH code.
% 

function convdeco
%MATLAB Tour Partial Function Help:  comm_con
%
% CONVDECO Decodes a convolution code using the Viterbi algorithm.
%        MSG = CONVDECO(CODE, TRAN_FUNC) decodes an encoded convolution
%        codeword CODE by using the Viterbi algorithm. The convolution code
%        transfer function is provided in octal form in TRANS_FUNC. All
%        elements in CODE should be binary. CODE is a matrix with the
%        column size the same as the code length. The output MEG is the
%        decoded output with the column size as the message length. This
%        format of command call is used for hard decision decoding. See
%        function OCT2GEN for the format of an octal form of transfer function
%        matrix. 
%        
%        [MSG, DIST] = CONVDECO(CODE, TRAN_FUNC) returns the Hamming distance
%        in each step of recovering the message.
% 
%        MSG = CONVDECO(CODE, TRAN_FUNC, TRAN_PROB) decodes a convolution
%        codeword CODE by using the Viterbi algorithm. This format of command 
%        call is used for soft decision decoding. The element in CODE may not
%        be binary. TRAN_PROB specifies the transfer probability. TRAN_PROB is
%        a three row matrix with the first row containing the receiving range,
%        the second row specifying the probability of "zero" signal transfer
%        to the receiving range, and the third row specifying the probability 
%        of "one" signal transfer to the receiving range.
%        For example,
%        TRAN_PROB = [-Inf 1/10, 1/2, 9/10; 
%                      2/5, 1/3, 1/5, 1/15; 
%                     1/16, 1/8, 3/8, 7/16]
%        means that the "zero" signal has 2/5 probability in range (-Inf, 1/10],
%        1/3 in range (1/10, 1/2], 1/5 in range (1/2, 9/10], and 1/15 in 
%        range (9/10, Inf). The "one" signal has 1/16 probability in 
%        range (-Inf, 1/10], 1/8 in range (1/10, 1/2], 3/8 in range
%        (1/2, 9/10], 7/16 in range (9/10, Inf).
% 
%        [MSG, REC_PROB] = CONVEDECO(CODE, TRAN_FUNC, TRAN_PROB) returns the
%        likelihood in each step of determining MSG.
% 
%        [MSG, REC_PROB, SURVIVOR] = CONVDECO(...) outputs the survivors of the
%        code.
% 
%        [...] = CONVDECO(CODE, TRANS_FUNC, TRAN_PROB, PLOT_FLAG) plots the
%        trellis diagram for the decoding. PLOT_FLAG is a positive integer.
%        PLOT_FLAG is the figure number used to plot the diagram. In the
%        trellis diagram, yellow path is the possible survivor path; red path
%        is the survivor. The number in the state position is the metric or the
%        accumulated Hamming distance in  the BSC case. When PLOT_FLAG is not
%        an integer or it is a negative number, the function will not plot the
%        diagram. For a hard decision case, assign TRAN_PROB to 0. The plot is
%        not recommended when the size of CODE is large.
% 
%        

function convenco
%MATLAB Tour Partial Function Help:  comm_con
%
%  CONVENCO Encodes convolution code.
%        CODE = CONVENCO(MSG, TRAN_FUNC) encodes the K-column message MSG to
%        N-column code word CODE by using the convolution code method. The
%         transfer function matrix is provided in state system form as 
%        described in the help file for SIM2TRAN. You can use SIM2TRAN to
%        generate the transfer function from a block diagram of convolution
%        code.
% 
%        The column number of the input MSG should be K. The column number of
%        the output CODE is N. The row number of CODE is row_number_of_MSG+M,
%        where M is the memory length.
%        
%        

function errlocp
%MATLAB Tour Partial Function Help:  comm_con
%
% ERRLOCP Computes the error-location polynomial.
%        [SIGMA, ERR] = ERRLOCP(SYNDROME, T, TP, ERR, FLAG) computes the
%        error-location polynomial from the length 2*T input vector SYNDROME.
%        T is the error-correction capability. Tp is the complete tuple list
%        of all elements in GF(2^M). POW_DIM = 2^M - 1, is the dimension
%        of GF(2^M).  ERR contains the error information in the computation.
%        FLAG indicates the method to be used in the computation.
%        FLAG = 1, uses normal method.
%        FLAG = 0, use simplified method. The simplified method can be
%                       used for binary code only. 
% 
%        Warning: This function does not provide error-checking. Make sure
%                 the parameters are signed correctly.

function rscore
%MATLAB Tour Partial Function Help:  comm_con
%
% RSCORE The core function in Reed-Solomon decode.
%        MSG = RSCORE(CODE, K, TP, M, POW_M, T2) decodes a single codeword
%        vector CODE using the Reed-Solomon decoding technique. The message length
%        is K. The complete (and correct) list of all members in GF(2^M) is
%        in TP. The code word length is provided in POW_M, which equals
%        2^M - 1. The decoding result is provided in the output variable MSG.
% 
%        [MSG, ERR] = RSCORE(CODE, K, TP, M, POW_M, T2) outputs the error 
%        detected in the decoding.
% 
%        [MSG, ERR, CCODE] = RSCORE(CODE, K, TP, M, POW_M, T2) outputs the
%        corrected codeword in CCODE.
% 
%        NOTE: Unlike all of the other encoding/decoding functions,
%        this function takes exponential input instead of regular input for
%        processing. For example [-Inf, 0, 1, 2, ...] represents
%        [0 1 alpha, alpha^2, ...] in GF(2^m). There are 2^M elements in
%        GF(2^M). Hence, the input CODE represents 2^M * (2^M - 1) bits of
%        information. The decoded MSG represents 2^M * K bits of information.
%        To speed computation, no error-checking is placed in this function,
%        all input variables must be present.
%        

function rsdeco
%MATLAB Tour Partial Function Help:  comm_con
%
% RSDECO Reed-Solomon decode function.
%        MSG = RSDECO(CODE, N, K) decodes the binary message in MSG by using
%        the Reed-Solomon decoding technique with codeword length N, message length
%        K. A valid Reed-Solomon code should have its code word length 
%        N = 2^M - 1, where M is an integer no less than 3. The message length
%        K should be smaller than the codeword length N. The input variable
%        CODE should have the same format as the output of RSENCO. Let L1=N*M
%        and Z be any positive integer. The input variable CODE can be
%        either of the two formats:
%            (1) a column vector with length L1*Z
%         or (2) a L1-by-Z matrix. 
%        The output format of this function matches the style of the input.
%        When the input uses format (1), the output MSG is an L2 * Z column
%        vector  with L2 = L1 * K / N. When input uses format (2), the
%        output MSG is a L2-by-Z matrix with L2 given above. When the input
%        CODE is not an output format of RSENCO, the function will cause an
%        error. To speed up the calculation, the code word length N could be
%        the list of all elements in GF(2^M), a 2^M-by-M matrix.
% 
%        MSG = RSDECO(CODE, N, K, TYPE_FLAG) specifies the format of CODE by
%        using TYPE_FLAG. The default TYPE_FLAG is 'binary'. The CODE can also
%        be 'decimal' or 'power'. If TYPE_FLAG = 'decimal', the elements in 
%        CODE are integers in the range between 0 to N. If TYPE_FLAG = 'power'
%        the elements in CODE are represented using the power format in
%        GF(2^M), which are -Inf and integer 0 to N-2. Any negative number in
%        this form is equivalent to -Inf. With either TYPE_FLAG = 'decimal' or
%        TYPE_FLAG = 'power', the elements in CODE should match the code
%        type. When TYPE_FLAG equals 'power' or 'decimal', the input CODE
%        format could be either
%            (i) a column vector with length N*Z
%         or (ii) an N-by-Z matrix
%        Note the different dimension compared to the 'binary' case. The output
%        of this function MSG matches the input format and data type of the
%        input. When input is in case (i), the output MSG is an K*Z column
%        When input CODE is in format case (ii), the output MSG is a K-by-Z
%        matrix. The function will cause an error if the input data format
%        does not follow the rules.
% 
%        [MSG, ERR] = RSDECO(...) outputs the number ERR, which specifies the
%        number of errors found in the decode of the MSG provided in the same
%        column in MSG. 
%        
%        [MSG, ERR, CCODE] = RSDECO(...) outputs the corrected CODE. The format
%        of CCODE will match exactly the CODE in the input.
% 
%        [MSG, ERR, CCODE, ERR_C] = RSDECO(...) outputs the number ERR_C which
%        specifies the number of errors found in matching the CCODE column.
%        
%        Note that Reed-Solomon code is specially designed for correcting
%        "burst error" instead of "random error."
% 
%        The following example shows a two error correction case. If less than
%        two 'burst errors' occur between the green lines in the plot generated
%        in the following code, the method should be able to correct the error.
%        
%        % bit number in calculation.
%        L = 1000;       
%        M = 4;
%        % codeword length
%        N = 2^M - 1;
%        % message length
%        K = N - 4;
%        % testing 1000 bits transfer.
%        MSG = randint(L, 1);
%        % generate all members in GF(2^M).
%        TP = gftuple([-1 : N-1]',M);
%        % encode
%        [CODE, ADDED] = rsenco(MSG, TP, K);
%        % add 3% noise,
%        NOI = rand(length(CODE)/M, 1) < .03;  
%        % make a burst error
%        NOI = (NOI * ones(1, M))'; 
%        NOI = NOI(:);
%        % add noise to the message.
%        CODE_NOI = rem(CODE + NOI, 2);
%        % decode.
%        [DEC, ERR, CCODE, ERR_C] = rsdeco(CODE_NOI, TP, K);
%        % Adjust length prepare for comparison.
%        MSG = [MSG; zeros(ADDED, 1)];
%        % comparison.
%        max(abs(DEC-MSG));
%        X = [1:length(NOI)];
%        Z = [1:M*N:length(NOI)];
%        Y=zeros(1,length(Z));Z=[Z;Z];
%        Y=[Y+min(ERR_C);Y+max(ERR_C)];
%        subplot(211);
%        % placed v.s. detected error 
%        plot(X,NOI,'yo',X,ERR_C,'rx',Z,Y,'g-');
%        title('Error Detection Record');
%        xlabel(...
%          'o--placed error;x--detected error;vertical bar: RS-DECO section.');
%        axis([1, length(NOI), min(ERR_C), max(ERR_C)]);
%        X = [1:length(MSG)];                  % x-axis for MSG
%        Z = [1:M*K:length(MSG)];Y=zeros(1,length(Z));
%        Z=[Z;Z];Y=[Y;Y+max(MSG)];
%        subplot(212);
%        plot(X, MSG,'yo',X,DEC,'rx',Z,Y,'g-');
%        title('Message and Decoded Signal Comparison');
%        xlabel('o--original message; x--decoded result.');
%        axis([1, length(MSG), min(min(MSG)), max(max(MSG))]);
% 
%        

function rsdecode
%MATLAB Tour Partial Function Help:  comm_con
%
% RSDECODE Reed-Solomon decode.
%        MSG = RSDECODE(CODE, K) recovers the message information from code
%        word CODE, which has been coded using the Reed-Solomon encoding technique.
%        CODE is a matrix with the row length being N = 2^M - 1, where
%        M is a positive integer no less than 3. K is the message length.
%        Usually, the message length is an odd number. The error-correction
%        capability of a Reed-Solomon code is T = floor((M - K) / 2). The
%        recovered message is stored in MSG. The row number of MSG is the same as
%        the row number of CODE. The column number of MSG is K. Note the 
%        difference from all of the other encoding/decoding functions.
%        This function takes exponential input instead of regular input
%        for processing. For example [-Inf, 0, 1, 2, ...] represents
%        [0 1 alpha, alpha^2, ...] in GF(2^m). There are 2^M elements in
%        GF(2^M). Hence, the input CODE represents 2^M * (2^M - 1) bits of
%        information. The decoded MSG represents 2^M * K bits of information.
% 
%        MSG = RSDECODE(CODE, K, TP) recovers the length K message information
%        from code word CODE with specified GF(2^M) elements in TP. This
%        format is recommended even if the GF(2^M) is a default one in speeding
%        up the process. A default TP can be generated by using
%        TP = gftuple([-1:2^M-2]',M);
% 
%        [MSG, ERR] = RSDECODE(...) provides the error correction information. 
%        A non-negative positive element in ERR indicates the number of errors
%        that have been corrected. A negative element in ERR indicates there 
%        were more errors encountered in the decode than it could correct.
% 
%        [MSG, ERR, CCODE] = RSDECODE(...) provides the corrected code word in
%        CCODE.
% 
%        Example:
%        M = 4;                      % M is a number larger or equal to 3.
%        N = 2^M - 1;                % The code word length.
%        K = 9;                      % K is the message length.
%        T = floor((N - K)/2);       % Error-correction capability.
%        NUM_ROW = 10;               % Number of rows in the calculation
%        MSG = randint(NUM_ROW, K, [-1, N-1])
%                                    % Generate a random number. Note that
%                                    % a "-1" is equivalent to "-Inf".
%        TP = gftuple([-1:N-1]', M); % A complete list of all elements in
%                                    % GF(2^M).
%        PG = rspoly(N, K);          % Produce generator polynomial.
%        CODE =rsencode(MSG,PG,N,TP);% Reed-Solomon encode calculation.
%        CODE_NOI = CODE + randbit(NUM_ROW, N, [1 1 1]/4);
%        DEC = rsdecode(CODE_NOI, K, TP) % Reed-Solomon decode calculation.
%        
%        

function rsencode
%MATLAB Tour Partial Function Help:  comm_con
%
% RSENCODE Reed-Solomon encode, power format input/output signals.
%        CODE = RSENCODE(MSG, PG, N) encodes the message MSG using Reed-Solomon
%        coding technique. PG is the generator polynomial. N is the code word 
%        length. The decode pair for this function is RSDECODE. N=2^M, M is a
%        positive integer no less than 3.
% 
%        CODE = RSENCODE(MSG, PG, N, TP) provides a list of all elements in
%        GF(2^M).
% 
%        Note that the elements of MSG, PG and CODE are in GF(2^M). The power 
%        form is used in the representation, i.e., [-Inf, 0, 1, 2, ...] represents
%        [0, 1, alpha, alpha^2, ...]. For a regular binary coding, use ENCODE.
% 
%        

function rsenco
%MATLAB Tour Partial Function Help:  comm_con
%
% RSENCO Reed-Solomon encode function.
%        CODE = RSENCO(MSG, N, K) encodes the binary message in MSG by using
%        code word length N, message length K Reed-Solomon coding technique.
%        A valid Reed-Solomon code should have its codeword length N equal
%        to 2^M - 1, where M is an integer no less than 3, and should have its
%        message length K < N. Let L1 = K*M, and Z be a positive integer. The
%        input variable MSG can be either
%            (1) a column vector with length L1*Z
%         or (2) a L-by-Z matrix. 
%        When input MSG has format (1), the output CODE is a L2 column vector
%        with L2 = ceil(L/K/M)*M*N. When input MSG has format (2), the output
%        CODE is a L2-by-Z matrix with L2 given as above. For speeding the
%        calculation, the code word length N can be the list of all
%        elements in GF(2^M), a 2^M-by-M matrix.
% 
%        CODE = RSENCO(MSG, N, K, TYPE_FLAG) specifies the format of MSG by
%        using TYPE_FLAG. The default TYPE_FLAG is 'binary'. The MSG can also
%        be 'decimal' or 'power'. If TYPE_FLAG = 'decimal', the elements in 
%        MSG are integers in the range between 0 to N. If TYPE_FLAG = 'power'
%        the elements in MSG are represented using the power format in GF(2^M),
%        which are -Inf and integer 0 to N-1. Any negative number in this form
%        is equivalent to -Inf. In either case, with TYPE_FLAG = 'decimal' or
%        TYPE_FLAG = 'power', the elements in MSG should match the code type.
%        In these two cases, MSG could be 
%            (i) a length K*Z column vector 
%         or (ii) an K-by-K matrix.
%        Note the different dimensions compared to the 'binary' case. When the
%        input MSG uses format case (i), the output CODE is an N*Z column 
%        vector. When the input MSG uses format (ii), the output CODE is a
%        K-by-N matrix.
% 
%        CODE = RSENCO(MSG, N, K, TYPE_FLAG, PG) specifies the generator
%        polynomial of the Reed-Solomon code. 
% 
%        [CODE, ADDED] = RSENCO(...) outputs the number ADDED in specifying how
%        many columns have been added to MSG based on whichever MSG format it
%        is.
% 
%        The output CODE type matches the input MSG type. The
%        computation in this function follows the order of the data type
%        conversion: MSG: binary-->decimal-->power;
%        CODE: power-->decimal-->binary whenever it is necessary.
% 
%        Note that Reed-Solomon code is specially designed for correcting
%        "burst error" instead of "random error".
% 
%        

function ademod
%MATLAB Tour Partial Function Help:  comm_con
%
% ADEMOD Demodulates a modulated signal.
%        X = ADEMOD(Y, Fc, Fs, METHOD, OPT1, OPT2, OPT3, OPT4, OPT5)
%        demodulates a modulated signal Y with carrier frequency Fc (Hz) and
%        sample frequency Fs (Hz) using the demodulation method provided in
%        METHOD. The time interval between two successive points in Y is 1/Fs.
%        When Fs is a two element vector, the second element specifies the
%        initial phase in the carrier signal modulation. The unit of the
%        initial phase is rad. NUM and DEN are the numerator and
%        denominator of the low-pass filter respectively. The sample time of
%        the filter is 1/Fs. When NUM is zero, empty, or not given, this
%        function uses the default low-pass filter which is
%        [NUM, DEN] = BUTTER(5, Fc*2/Fs).
% 
%        Use ADEMOD(METHOD) to view the help for a specific method.
% 
%        METHOD is a string, which can be one of the following:
%        'amdsb-tc'  Amplitude demodulation, double sideband with transmission
%                    carrier.
%        'amdsb-sc'  Amplitude demodulation, double sideband suppressed
%                    carrier.
%        'amssb'     Amplitude demodulation, single side band suppressed
%                    carrier.
%        'qam'       Quadrature amplitude demodulation.
%        'fm'        Frequency demodulation.
%        'pm'        Phase demodulation.
% 
%        

function ademodce
%MATLAB Tour Partial Function Help:  comm_con
%
% ADEMODCE Demodulates the complex envelope of a modulated signal.
%        Z = ADEMODCE(Y, Fs, METHOD, OPT1, OPT2, OPT3) demodulates the complex
%        envelope of a modulated signal Y using the demodulation method
%        provided in METHOD. The sample rate of Y is 1/Fs. When Fs is a two
%        element vector, the second element is the initial phase of the carrier
%        signal. A lowpass filter is needed in the demodulation process. The
%        sampling frequency, numerator and denominator of the lowpass filter
%        must be specified. When the filter is not specified, no filter is
%        placed in this function.
% 
%        METHOD is a string, which can be one of the following:
%        'am' or 'amdsb-tc'  Amplitude demodulation, double sideband with
%                   transmission carrier
%        'amdsb-sc' Amplitude demodulation, double sideband suppressed carrier
%        'amssb'    Amplitude demodulation, single sideband suppressed carrier
%        'qam'      Quadrature amplitude demodulation
%        'fm'       Frequency demodulation
%        'pm'       Phase demodulation
% 
%        Use ADEMODCE(METHOD) to view the help for a specific method.
% 
%        

function amod
%MATLAB Tour Partial Function Help:  comm_con
%
% AMOD   Analog signal modulation.
%        Y = AMOD(X, Fc, Fs, METHOD, OPT1, OPT2, OPT3) modulates the
%        message signal X with carrier frequency Fc (in Hz) and sample
%        frequency Fs (Hz) using the modulation scheme in string variable
%        METHOD. The time interval between two successive points in X is
%        1/Fs. When Fs is a two element vector, the second element specifies
%        the initial phase in the carrier signal modulation. The unit of the
%        initial phase is rad. For best results, Fs > Fc is required (by
%        Nyquist theory).
% 
%        METHOD is a string, which can be one of the following:
%        'amdsb-tc'  Amplitude modulation, double sideband with transmission
%                    carrier
%        'amdsb-sc'  Amplitude modulation, double sideband suppressed carrier
%        'amssb'     Amplitude modulation, single sideband suppressed carrier
%        'qam'       Quadrature amplitude modulation
%        'fm'        Frequency modulation
%        'pm'        Phase modulation
% 
%        Use AMOD(METHOD) to view the help for a specific method.
% 
%        

function amodce
%MATLAB Tour Partial Function Help:  comm_con
%
% AMODCE Complex envelope of analog modulation.
%        Y = AMODCE(X, Fs, METHOD, OPT1, OPT2, OPT3) outputs complex envelope of
%        the modulation of the input signal X. The input and the output have
%        the same sample frequency Fs (Hz). When Fs is a two element vector,
%        the second element is the initial phase (rad) of the carrier signal in
%        the modulation. The modulation method is specified in the input
%        variable METHOD. Input variables OPT1, OPT2, and OPT3 are optional
%        variables based on METHOD in use. 
% 
%        METHOD is a string, which can be one of the following:
%        'am' or 'amdsb-tc'  Amplitude demodulation, double sideband with
%                    transmission carrier
%        'amdsb-sc'  Amplitude demodulation, double sideband suppressed carrier
%        'amssb'     Amplitude demodulation, single sideband suppressed carrier
%        'qam'       Quadrature amplitude demodulation
%        'fm'        Frequency demodulation
%        'pm'        Phase demodulation
% 
%        Use AMODCE(METHOD) to view the help for a specific method.
% 
%        

function apkconst
%MATLAB Tour Partial Function Help:  comm_con
%
% APKCONST Plots ASK/PSK constellation.
%        APKCONST(NIC, AIC, PIC) plots the constellation with the number in
%        each circle specified in NIC (Number_In_Circle); amplitude in each
%        circle specified AIC (Amplitude_In_Circle); and phase in each circle
%        specified in PIC (Phase_In_Circle, in rad). The number of points is
%        evenly distributed on each circle with one of the points having its
%        phase been specified.
% 
%        APKCONST(NIC, AIC) plots the constellation with default PIC as all
%        zeros.
% 
%        APKCONST(NIC) plots the constellation with default AIC as unit
%        increment for each circle.
%  
%        Y = APKCONST(...) outputs a complex vector with its real part as the 
%        in-phase component and the imaginary part as the quadrature component.
% 

function ddemod
%MATLAB Tour Partial Function Help:  comm_con
%
% DDEMOD Demodulates a digital modulated signal.
%        DDEMOD(Y, Fc, Fd, Fs) plots eye-pattern diagram for the signal Y.
%        The sampling frequency for Y is Fs (Hz) and the digital sampling
%        frequency is Fd (Hz). When Fd is a two element vector, the second
%        element is the offset value for the decision point. The offset
%        should be an integer. The offset timing in the plot is offset/Fs.
%        The parameter Fc is not used.
% 
%        Z = DDEMOD(Y, Fc, Fd, Fs, METHOD, OPT1, OPT2, OPT3, OPT4, OPT5)
%        demodulates a digital modulated signal Y with carrier frequency 
%        Fc (Hz), digital signal frequency Fd (Hz), and computation sampling
%        frequency Fs (Hz). This function requires Fs/Fd to be a positive
%        integer. When Fd is a two element vector, the second element is the
%        offset value for the decision point. The offset timing in the plot is
%        offset/Fs. The default offset is 0. The received digital signal is 
%        sampled at time point i/Fd + offset/Fs. The sample value keeps until
%        time (i+1)/Fd+offset/Fs when the next sample point is taken place. 
%        The demapping process finds the distance from the sample value
%        to all of the possible digital symbols. The digital symbols with the
%        shortest distance to the current sampling point are the demodulated
%        output. When Fs is a two element vector, the second element specifies
%        the initial phase of the carrier signal in modulation.
% 
%        METHOD is a string, which can be one of the following:
%        'ask'       M-ary Amplitude shift keying modulation.
%        'psk'       M-ary Phase shift keying modulation.
%        'qask'      M-ary Quadrature amplitude shift-keying modulation, with 
%                    choices of 'qask/sqr' (default), 'qask/cir', or 'qask/arb'
%                    for different mapping constellations.
%        'fsk'       M-ary Frequency shift keying modulation.
%        'msk'       Minimum shift keying modulation.
%        'sample'    Down sampling from a higher sampling frequency signal.
% 
%        When there is a '/eye' or 'scat' string appended to the end of the
%        variable METHOD, the function plots eye-pattern diagram or the scatter 
%        plot.
% 
%        The demodulation uses a lowpass filter. When it is not specified, the
%        default lowpass filter [NUM, DEN] = butter(5, Fc*2/Fs) is used.
% 
%        Use DDEMOD(METHOD) to view the help for a specific method.
% 
%        

function ddemodce
%MATLAB Tour Partial Function Help:  comm_con
%
% DDEMODCE Demodulates complex envelope of a digital modulated signal.
%        DDEMODCE(Y, Fd, Fs) plots eye-pattern diagram for the signal Y. The
%        sampling frequency for Y is Fs (Hz) and the digital sampling
%        frequency is Fd (Hz). When Fd is a two element vector, the second
%        element is the offset value for the decision point. The offset should
%        be an integer. The offset timing in the plot is offset/Fs. Fc is not
%        used.
% 
%        X = DDEMODCE(Y, Fd, Fs, METHOD, OPT1, OPT2, OPT3, OPT4, OPT5)
%        demodulates a digital modulated signal Y with digital signal frequency
%        Fd (Hz), and computation sampling frequency Fs (Hz). This function 
%        requires Fs/Fd be a positive integer. When Fd is a two element
%        vector, the second element is the offset value for the decision point.
%        The offset timing in the plot is offset/Fs. The default offset is 0.
%        The received digital signal is sampled at time point i/Fd + offset/Fs.
%        The output keeps the same sample value until the next sample point is
%        taken , which is at time (i+1)/Fd + offset/Fs. The demapping
%        process finds the distance from the sample value to all of the
%        possible digital symbols. The digital symbols with the shortest
%        distance to the current sampling point are the demodulated output.
%        When Fs is a two element vector, the second element specifies the
%        initial phase of the carrier signal in modulation.
% 
%        METHOD is a string, which can be one of the following:
%        'ask'       M-ary Amplitude shift keying modulation.
%        'psk'       M-ary Phase shift keying modulation.
%        'qask'      M-ary Quadrature amplitude shift keying modulation, with
%                    choice of 'qask/cir', 'qask/arb' for different mapping table.
%        'fsk'       M-ary Frequency shift keying modulation.
%        'msk'       Minimum shift keying modulation.
%        'sample'    Down sampling from a higher sampling frequency signal.
% 
%        When there is a '/eye' or 'scat' string appended to the end of the
%        variable METHOD, the function plots eye-pattern diagram or the scatter
%        plot.
% 
%        Use DDEMODCE(METHOD) to view the help for a specific method.
% 
%        

function demodmap
%MATLAB Tour Partial Function Help:  comm_con
%
% DEMODMAP Demaps a modulation mapped signal to the closest digit number.
%        DEMODMAP(Y, Fd, Fs) plots an eye-pattern diagram for the signal Y. The
%        sampling frequency for Y is Fs (Hz) and the digital sampling frequency 
%        is Fd (Hz).
% 
%        Z = DEMODMAP(Y, Fd, Fs, METHOD, OPT1, OPT2, OPT3) is a reverse mapping
%        of function MODMAP. This function demaps a sampling frequency Fs (Hz)
%        analog signal into a sampling frequency Fd (Hz) digital signal Z. Y is
%        a two column matrix where the first column is an in-phase component and
%        second column is a quadrature component. When METHOD = 'ask', 'fsk',
%        or 'msk', Y is a one column vector instead of a matrix. When Fd is a 
%        two element vector, the second element is the offset value for the
%        decision point. The offset timing in the plot is offset/Fs. The
%        default offset is 0. The received digital signal is sampled at time
%        i/Fd + offset/Fs. The sample value holds until time 
%        (i+1)/Fd +offset/Fs when the next sample point is taken. The
%        demapping process finds the distance from the sample value to
%        all of the possible digital symbols. The digital symbols with the 
%        shortest distance to the current sampling point is the demodulated
%        output. 
% 
%        METHOD is a string, which can be one of the following:
%        'ask'       Amplitude shift keying modulation.
%        'psk'       Phase shift keying modulation.
%        'qask'      Quadrature amplitude shift keying modulation, with choice
%                    of 'qask/cir', 'qask/arb' for different mapping table.
%        'fsk'       Frequency shift keying modulation.
%        'msk'       Minimum shift keying modulation.
%        'sample'    Down sampling from a higher sampling frequency signal.
%        'eye'       Eye-pattern plot.
%        'scatter'   Scatter plot.
% 
%        Use DEMODMAP(METHOD) to view the help for a specific method.
% 
%        

function dmod
%MATLAB Tour Partial Function Help:  comm_con
%
% DMOD   Digital modulation.
%        Y = DMOD(X, Fc, Fd, Fs, METHOD, OPT1, OPT2, OPT3) modulates signal X
%        with carrier frequency Fc (Hz) using the given method in the input 
%        variable METHOD. The sampling frequency for X is Fd (Hz). The sampling
%        frequency for the complex envelope output is Fs (Hz). It is required
%        that Fs>Fc. Fs/Fc must be a positive integer. The time interval
%        between two successive points in X is 1/Fd. The column number of the
%        modulated signal Y is Fs/Fd times the length of the input signal X.
%        The time interval between two successive points in Y is 1/Fs. When Fs
%        is a two element vector, the second element specifies the initial
%        phase (rad) in the modulation. For baseband simulation or complex
%        envelope simulation, please use DMODCE.
% 
%        METHOD is a string, which can be one of the following:
%        'ask'       M-ary Amplitude shift keying modulation.
%        'psk'       M-ary Phase shift keying modulation.
%        'qask'      M-ary Quadrature amplitude shift-keying modulation.
%        'fsk'       M-ary Frequency shift keying modulation.
%        'msk'       Minimum shift keying modulation.
%        'sample'    Up sample the input signal.
% 
%        With the switch '/nmap' appended to the string of the METHOD variable,
%        the function will not process the digital to analog mapping. The input
%        signal is assumed to have sampling frequency Fs.
% 
%        DMOD(METHOD, OPT1, OPT2, OPT3) plot constellation layout.
% 
%        Use DMOD(METHOD) to view the help for a specific method.
% 
%        

function dmodce
%MATLAB Tour Partial Function Help:  comm_con
%
% DMODCE Complex envelope of digital modulation. 
%        Y = DMODCE(X, Fd, Fs, METHOD, OPT1, OPT2, OPT3) output Y, the complex
%        envelope of a digital modulated signal. The sampling frequency for X
%        is Fd (Hz). The sampling frequency for Y is Fs (Hz). Fs must be larger
%        than Fd. Fs/Fc must be a positive integer. The time interval between
%        two successive points in X is 1/Fd. The column number of the modulated
%        signal Y is Fs/Fd times the length of the input signal X. The time
%        interval between two successive points in Y is 1/Fs. When Fs is a two
%        element vector, the second element specifies the initial phase (rad)
%        in the modulation. 
% 
%        METHOD is a string, which can be one of the following:
%        'ask'       M-ary Amplitude shift keying modulation.
%        'psk'       M-ary Phase shift keying modulation.
%        'qask'      M-ary Quadrature amplitude shift-keying modulation.
%        'fsk'       M-ary Frequency shift keying modulation.
%        'msk'       Minimum shift keying modulation.
%        'sample'    Up sample the input signal.
% 
%        With a switch '/nomap' appended to the string of the METHOD variable,
%        the function will not process the digital to analog mapping. The
%        input signal is assumed to have sampling frequency Fs.
% 
%        DMODCE(METHOD, OPT1, OPT2, OPT3) plots constellation layout.
% 
%        Use DMODCE(METHOD) to view the help for a specific method.
% 
%        

function modmap
%MATLAB Tour Partial Function Help:  comm_con
%
% MODMAP Maps a digital signal to an analog signal for modulation.
%        Y = MODMAP(X, Fd, Fs, METHOD, OPT1, OPT2, OPT3) maps a sample
%        frequency Fd (Hz) signal vector X in to a sample frequency Fs (Hz)
%        in-phase and quadrature components in Y. Y is a two column matrix.
%        The first column is an in-phase component and second column is a
%        quadrature component. When METHOD = 'ask', Y is a column vector
%        instead of a matrix. This function does mapping only. For digital
%        modulation, use DMOD for passband simulation and DMODCE for baseband
%        simulation.
% 
%        METHOD is a string, which can be one of the following:
%        'ask'       M-ary Amplitude shift keying modulation.
%        'psk'       M-ary Phase shift keying modulation.
%        'qask'      M-ary Quadrature amplitude shift-keying modulation.
%        'fsk'       M-ary Frequency shift keying modulation.
%        'msk'       Minimum shift keying modulation.
%        'sample'    Up sample the input signal.
% 
%        MODMAP(METHOD, OPT1, OPT2, OPT3) plots the constellation of given 
%        method.
% 
%        Use MODMAP(METHOD) to view the help for a specific method.
% 
%        

function qaskdeco
%MATLAB Tour Partial Function Help:  comm_con
%
% QASKDECO Decodes QASK mapped signal back to integer symbols.
%        MSG = QASKDECO(X, Y, M) decodes the message signal MSG from the
%        in-phase component X and quadrature component Y with the M-ary
%        number M. M must equal 2^K with K being an positive integer. The
%        minimum and the maximum numbers are assumed to be the same as in the
%        output from QASKENCO.
% 
%        MSG = QASKDECO(X, Y, M, MINMAX) decodes the information where
%        the maximum and minimum values of X and Y are given in MINMAX
%        by the form:
%                     | X_min    X_max |
%            MINMAX = |                |
%                     | Y_min    Y_max |
% 
%        

function qaskenco
%MATLAB Tour Partial Function Help:  comm_con
%
% QASKENCO Calculates a QASK square constellation mapping.
%        QASKENCO(M) plots a QASK square constellation with M-ary number M.
%        M must be a power of 2.
% 
%        QASKENCO(MSG, M) plots the location of MSG in constellation with
%        M-ary number M. The elements in MSG must be integers in the range
%        [0, M-1].
% 
%        [X, Y] = QASKENCO(M) outputs the in-phase component and quadrature 
%        component of the QASK square constellation into variable X and Y
%        respectively.
% 
%        [X, Y] = QASKENCO(MSG, M) encodes the message signal given in MSG
%        into in-phase and quadrature vectors X and Y.
%    
%        The output maximum number are listed as follows:
%           M = 2,   maximum = 1;   M = 4,   maximum = 1;
%           M = 8,   maximum = 3;   M = 16,  maximum = 3;
%           M = 32,  maximum = 5;   M = 64,  maximum = 7;
%           M = 128, maximum = 11;  M = 256, maximum = 15;
% 
%        This function generates a Gray code with 2^K , K is a even
%        integer. When K is an odd integer, this function generates a
%        non-Gray-code near-square constellation.
% 
%        

function hank2sys
%MATLAB Tour Partial Function Help:  comm_con
%
% HANK2SYS Converts a Hankel matrix to a linear system model.
%        [NUM, DEN] = HANK2SYS(H, INI, TOL) converts a Hankel matrix H to a
%        linear system transfer function with numerator NUM and denominator DEN.
%        INI is the system impulse at time zero. When TOL > 1, TOL indicates
%        the order of the conversion. When TOL < 1, TOL indicates the tolerance
%        in selecting the order based on the singular values. The default value
%        of tol is 0.01. This conversion uses the singular value decomposition
%        (SVD) method.
% 
%        [NUM, DEN, SV] = HANK2SYS(...) outputs the transfer function and the
%        SVD values.
% 
%        [A, B, C, D] = HANK2SYS(...) outputs A, B, C, D matrices of the linear
%        system state-space model.
% 
%        [A, B, C, D, SVD ] = HANK2SYS(...) outputs the state-space model and
%        the SVD values.
% 
%        

function hilbiir
%MATLAB Tour Partial Function Help:  comm_con
%
% HILBIIR Designs a Hilbert transform digital IIR filter.
%        HILBIIR produces a plot showing the impulse responses of an ideal
%        Hilbert transform filter and a designed fourth order digital Hilbert
%        transform IIR filter. The filter sample time is 2/7 second. The filter
%        time delay is one second. The ideal Hilbert transform filter impulse
%        response of the system is 1/(t-1)/pi. No compensator is applied.
% 
%        HILBIIR(ST) produces a plot showing the impulse responses of an ideal
%        theoretical Hilbert transform filter and a designed fourth order
%        digital Hilbert transform IIR filter. The filter sample time is
%        ST (sec). The filter time delay equals 3.5*ST (a suggested value).
%        The order of the filter is determined by using TOL=0.05. No
%        compensator is added. The filter is assumed to be used for bandwidth
%        1/ST/2 input signal.
% 
%        HILBIIR(ST, DLY) produces a plot with the impulse response of a designed
%        Hilbert transform filter with sample time as ST, delay as DLY (sec).
%        No compensator is used. For an accurate calculation, the parameters
%        should be chosen such that DLY is at least a few times larger than
%        ST, and rem(DLY, ST) = ST/2.
% 
%        HILBIIR(ST, DLY, BANDWIDTH) produces a plot with the impulse response of
%        a designed Hilbert transform filter with sample time as ST, delay 
%        DLY. The filter design uses a compensator for the input signal. The
%        input signal has bandwidth BANDWIDTH. When BANDWIDTH = 0 or 
%        BANDWIDTH > 1/TS/2, no compensator is added.
% 
%        HILBIIR(ST, DLY, BANDWIDTH, TOL) produces a plot with impulse response
%        of a designed Hilbert transform filter with sample time ST, delay
%        DLY, and bandwidth BANDWIDTH. TOL specifies the tolerance
%        in the filter design. The order of the filter is determined by
%        truncated-singular-value/maximum-singular-value < TOL; when TOL is
%        larger than or equal to one, TOL is the order of the filter. If
%        BANDWIDTH = 0 or BANDWIDTH > 1/TS/2, the filter order is exactly TOL,
%        since no compensator is added. Otherwise, the filter order is
%        TOL + max(3,ceil(TOL)/2) with a compensator added.
% 
%        [NUM, DEN] = HILBIIR(...) outputs the transfer function NUM(s)/DEN(s).
% 
%        [NUM, DEN, SV] = HILBIIR(...) outputs the additional parameter SV, the
%        singular value in the calculation.
% 
%        [A, B, C, D] = HILBIIR(...) outputs state-space solution.
% 
%        [A, B, C, D, SV] = HILBIIR(...) outputs state-space solution and
%        singular values.
% 

function imp2sys
%MATLAB Tour Partial Function Help:  comm_con
%
% IMP2SYS Identifies a linear system model using system impulse response.
%        [NUM, DEN] = IMP2SYS(IMP) identifies a linear system transfer function
%        with numerator NUM, and denominator DEN, by using the system impulse
%        response data sequence IMP. The order of the model is determined by
%        choosing tolerance value TOL = 0.01. The Hankel matrix has dimension
%        FLOOR(LENGTH(IMP)/2).
% 
%        [NUM, DEN] = IMP2SYS(IMP, TOL) identifies a transfer function based on
%        system impulse response sequence IMP and the tolerance value TOL. 
%        When TOL > 1, TOL is the order of the conversion. When TOL < 1, TOL
%        indicates the tolerance in selecting the order based on the singular
%        values. The default value of TOL is 0.01.
% 
%        [NUM, DEN] = IMP2SYS(IMP, TOL, ORD) identifies a transfer function 
%        based on system impulse response sequence IMP and the tolerance value
%        TOL by constructing a Hankel matrix with order ORD. When ORD is larger
%        than FLOOR(LENGTH(IMP)/2), the Hankel matrix fills the absent value
%        with zeros.
% 
%        [NUM, DEN, SV] = IMP2SYS(...) outputs the transfer function and the
%        SVD values.
% 
%        [A, B, C, D] = IMP2SYS(...) outputs the state-space model (A,B,C,D).
% 
%        [A, B, C, D] = IMP2SYS(...) outputs the state-space model and the SVD
%        values.

function rcosflt
%MATLAB Tour Partial Function Help:  comm_con
%
% RCOSFLT Filters the input signal using raised cosine filter.
%        Y = RCOSFLT(X, Fd, Fs) filters the input signal X using raised cosine
%        (R-C) FIR filter. The sample frequency for X is Fd (Hz). The sample
%        frequency for Y is Fs. Fs must be larger than Fd. Fs/Fd must be an
%        integer. The rolloff factor R has a default of .5. The time delay is a
%        default of 3. The extra delay has been taken from output Y,
%        such that offset Fs/Fd - 1 is the best decision point (as it is
%        in function MODMAP). The row number (or vector length) of Y is Ys/Yd
%        times that of X's.
% 
%        Y = RCOSFLT(X, Fd, Fs, TYPE_FLAG) gives specific computation
%        instruction. TYPE_FLAG is a string, which can be one of the following:
%        'fir'    Use FIR R-C filter (default).
%        'iir'    Use IIR R-C filter.
%        'normal' Use normal R-C filter (default), in contrast to 'qart'.
%        'sqrt'   Use square root raised cosine filter.
%        'wdelay' Keep the full length of the filtered result, in the case
%                 the row number (or vector length) of Y is 
%                 (length_of_X + DELAY)*Fs/Fd. The value DELAY is a default of
%                 3. The function default has had the delay cut off from
%                 the output.
%        'Fs'     X is input with sample frequency Fs. In this case, only
%                 elements X(i*Fs/Fd+1,:) are used in the calculation. All
%                 others are discarded.
%        'filter' Means then filter is provided in this function call. When 
%                 TYPE_FLAG contains 'filter', the calling format is
%                 Y = RCOSFLT(X, Fd, Fs, TYPE_FLAG, NUM).
%                 When TYPE_FLAG contains both 'filter' and 'iir', the calling
%                 format is Y = RCOSFLT(X, Fd, Fs, TYPE_FLAG, NUM, DEN).
%                 where NUM and DEN are numerator and denominator of raised
%                 cosine filter. The raised cosine filter can be designed
%                 using function RCOSINE.
%       'default' Use all default values.
% 
%        TYPE_FLAG can be a combination of the above string with a '/' as
%        separation. For example, TYPE_FLAG = 'iir/sqrt'.
% 
%        Y = RCOSFLT(X, Fd, Fs, TYPE_FLAG, R) gives the rolloff factor. In
%        general, it is a real number in the range [0, 1].
% 
%        Y = RCOSFLT(X, Fd, Fs, TYPE_FLAG, R, DELAY) gives the delay in
%        1/Fd time steps. DELAY should be a positive integer.
%        DELAY/Fd will be the time delay in the raised cosine filter design.
%        If the default time delay is used, assign an empty matrix for DELAY.
% 
%        Y = RCOSFLT(X, Fd, Fs, TYPE_FLAG, R, DELAY, TOL) provides the
%        tolerance in IIR filter design. The default value is .01.
% 
%        [Y, T] = RCOSFLT(...) outputs the time vector.
% 
%        

function rcosine
%MATLAB Tour Partial Function Help:  comm_con
%
% RCOSINE Designs a raised cosine filter.
%        NUM = RCOSINE(Fd, Fs) designs a FIR raised cosine filter to filter a
%        digital signal with the digital transfer sampling frequency Fd. The
%        filter sample frequency is Fs. Fs must be larger than Fd. Fs/Fd must
%        be an integer. The rolloff factor has a default of .5. The time delay
%        has a default of 3, which means the filter has delay 3 / Fd second.
% 
%        [NUM, DEN] = RCOSINE(Fd, Fs, TYPE_FLAG) gives specific filter design
%        instructions. TYPE_FLAG could be 'iir', 'sqrt', or a combination
%        such as 'iir/sqrt'. The order of the arguments  is not important.
%          'fir'    Design FIR raised cosine filter (default).
%          'iir'    Design using IIR raised cosine filter.
%          'normal' Design the regular raised cosine filter (default).
%          'sqrt'   Design square root raised cosine filter.
%          'default' Use the default (FIR, Normal raised cosine filter).
% 
%        [NUM, DEN] = RCOSINE(Fd, Fs, TYPE_FLAG,  R) specifies the 
%        rolloff factor. In general, it is a real number in the range [0, 1].
% 
%        [NUM, DEN] = RCOSINE(Fd, Fs, TYPE_FLAG, R, DELAY) specifies the delay
%        step. DELAY should be a positive integer. Delay/Fd will be the time
%        delay in the raised cosine filter design.
% 
%        [NUM, DEN] = RCOSINE(Fd, Fs, TYPE_FLAG, R, DELAY, Tol) provides the
%        tolerance in IIR filter design. The default value is .01.
% 
%        When the designed filter is a FIR filter, the output in DEN is 1.
% 
%        

function rcosfir
%MATLAB Tour Partial Function Help:  comm_con
%
% RCOSFIR Designs raised cosine FIR filter.
%        NOTE: The output of this function is a raised cosine FIR filter. You
%              should use function RCOSFLT to filter your digital signal
%              instead of using FILTER.
%        RCOSFIR(R, N_T, RATE, T) produces the time response and frequency response
%        of a raised cosine filter at a given rolloff factor R. N_T is a length 2
%        vector that indicates the number of T windows in the design. The
%        default value for N_T is [-3, 3]. RATE is the sample point in each T,
%        or, the sampling rate of the filter is T/RATE. The default value of 
%        RATE is 5. The order of the FIR filter is determined by 
%            (N_T(2) - N_T(1)) * RATE
%        where T is the symbol interval. The default value of T is 1.
%        The time response of the raised cosine filter has the form of
%        h(t) = SINC(t/T) COS(pi R t/T)/(1 - 4 R^2 t^2 /T^2)
%        The frequency domain has the spectrum
%               /  T                                 when 0 < |f| < (1-r)/2/T
%               |          pi T         1-R    T           1-R         1+R
%        H(f) = < (1 + cos(----) (|f| - ----) ---    when  --- < |f| < ---
%               |            r           2T    2           2 T         2 T
%               \  0                                 when |f| > (1+r)/2/T
% 
% 
%        RCOSFIR(R, N_T, RATE, T, FILTER_TYPE) produces the time response and
%        frequency response of a square root raised cosine filter if 
%        FILTER_TYPE == 'sqrt'.
% 
%        RCOSFIR(R, N_T, RATE, T, FILTER_TYPE, COLOR) produces the time response
%        and frequency response with the curve color as specified in the string
%        variable COLOR. The string in COLOR can be any type as defined in
%        PLOT.
% 
%        B = RCOSFIR(...) returns the designed raised cosine FIR filter.
%        The size of vector B is  (N_T(2) - N_T(1))*RATE + 1. 
% 
%        [B, Sample_Time] = RCOSFIR(...) returns the FIR filter and the sample
%        time for the filter. Note that the filter sample time is T / RATE.
%        The digital transmission rate is T.
% 
%        

function rcosiir
%MATLAB Tour Partial Function Help:  comm_con
%
% RCOSIIR Designs raised cosine IIR filter.
%        NOTE: The output of this function is a raised cosine FIR filter. You
%              should use function RCOSFLT to filter your digital signal
%              instead of using FILTER.
%        RCOSIIR(R, T_DELAY, RATE, T, TOL) produces the time response and
% 	    frequency response of the raised cosine filter at given rolloff
% 	    factor R. T_DELAY is an integer to specify how many times of T 
% 	    delay. RATE is the number of sample points in each interval T, or the 
%        sampling rate of the filter is T/RATE. The default value of RATE is 5. 
%        T is the symbol interval. The order of the IIR filter is determined by 
%        TOL when ORDER is an integer greater than 1. If TOL has its value less
%        than 1, it is considered as the relative tolerance in the SVD
%        computation in selecting the order. The default value of TOL is 0.01.
%        The time response of the raised cosine filter has the form of
%        h(t) = sinc(t/T) cos(pi R t/T)/(1 - 4 R^2 t^2 /T^2)
%        The frequency domain has the spectrum
%               /  T                                 when 0 < |f| < (1-r)/2/T
%               |          pi T         1-R    T           1-R         1+R
%        H(f) = < (1 + cos(----) (|f| - ----) ---    when  --- < |f| < ---
%               |            r           2T    2           2 T         2 T
%               \  0                                 when |f| > (1+r)/2/T
% 
%        RCOSIIR(R, T_DELAY, RATE, T, TOL, FILTER_TYPE) produces time response
%        and frequency response of a square root raised cosine filter if
%        FILTER_TYPE == 'sqrt'.
% 
%        RCOSIIR(R, T_DELAY, RATE, T, TOL, FILTER_TYPE, COLOR) produces time
%        response and frequency response with the curve color as specified in
%        the string variable COLOR. The string in COLOR can be any type as
%        defined in PLOT.
% 
%        [NUM, DEN] = RCOSIIR(...) returns the designed raised cosine IIR
%        filter. 
%    
%        [NUM, DEN, Sample_Time] = RCOSIIR(...) returns the IIR filter and the
%        sample time for the filter.
% 
%        

function flxor
%MATLAB Tour Partial Function Help:  comm_con
%
% FLXOR  Exclusive OR computation.
%        FLXOR(X,Y) returns bit-wise exclusive OR computation
%        between the two integers X and Y.
% 
%        

function gfadd
%MATLAB Tour Partial Function Help:  comm_con
%
% GFADD  Add two GF(P) polynomials or two GF(P^M) elements.
%        C = GFADD(A, B) adds two GF(2) polynomials A and B. The resulting
%        GF(2) polynomial C will keep the larger length between A and B.
% 
%        C = GFADD(A, B, P) adds two polynomials A and B in GF(P) when P is
%        a scalar prime number.
% 
%        When P is a matrix that contains the tuple of all elements in 
%        GF(Q^M), this function takes A and B as indices (power number of the
%        exponential form) of GF(Q^M) elements and the output C is 
%        alpha^C = alpha^A + alpha^B in GF(Q^M). The computation is 
%        element-by-element computation. You can generate the tuple of all
%        elements in GF(Q^M) by P = GFTUPLE([-1:Q^M-2]', M, Q).  In power
%        representation form, [-Inf, 0, 1, 2, ...] represents 
%        [0, 1, alpha, alpha^2, ...] in GF(p^m).
% 
%        C = GFADD(A, B, P, LEN) adds two GF(P) polynomials A and B. The
%        resulting GF(P) polynomial C keeps the given length LEN. When LEN is a
%        negative number, the length of C equals degree(C) + 1. P must be a 
%        scalar integer when using this format.
% 
%        In polynomial computation, A, B, and C are in ascending order, i.e.,
%        A = [a_0, a_1, a_2,..., a_(n-1), a_n] represents
%        A(X) = a_0 + a_1 X + a_2 X^2 +...+ a_(n-1) X^(n-1) + a_n X^n
%        where a_i must be a element in GF(P).
% 
%        In power representation form, [-Inf, 0, 1, 2, ...] represents 
%        [0, 1, alpha, alpha^2, ...] in GF(p^m).
% 
%        

function gfconv
%MATLAB Tour Partial Function Help:  comm_con
%
% GFCONV GF(P) polynomial convolution or GF(P^M) element multiplication.
%        C = GFCONV(A, B) computes the convolution between two GF(2)
%        polynomials A and B. The polynomial degree of the resulting GF(2)
%        polynomial C equals degree(A) + degree(B).
% 
%        C = GFCONV(A, B, P) computes the convolution between two GF(P)
%        polynomials when P is a scalar prime number.
%        When P is a matrix that contains the tuple of all elements in GF(Q^M),
%        this function takes A and B as indices (power number of the
%        exponential form) of GF(Q^M) elements. The output C is 
%        alpha^C = alpha^A * alpha^B in GF(Q^M). The computation is 
%        element-by-element computation. You can generate the tuple of all
%        elements in GF(Q^M) by P = GFTUPLE([-1:Q^M-2]', M, Q). 
% 
%        In polynomial computation, A, B, and C are ascending ordered, i.e.,
%        A = [a_0, a_1, a_2,..., a_(n-1), a_n] represents
%        A(X) = a_0 + a_1 X + a_2 X^2 +...+ a_(n-1) X^(n-1) + a_n X^n
%        a_i must be a element in GF(P).
% 
%        In power representation form, [-Inf, 0, 1, 2, ...] represents 
%        [0, 1, alpha, alpha^2, ...] in GF(p^m).
% 
%        

function gfcosets
%MATLAB Tour Partial Function Help:  comm_con
%
% GFCOSETS Produces cyclotomic cosets mod(P^M - 1) with a prime number P.
%        CS = GFCOSETS(M) produces cyclotomic cosets mod(2^M - 1). Each row
%        of the output CS contains equivalent elements in the modulus
%        calculation.
% 
%        CS = GFCOSETS(M, P) produces cyclotomic cosets mod(P^M - 1) with
%        prime number P.
%        
%        Because the length of the cosets varies in the complete set, NaN is
%        used to fill out the extra space in order to make all variables
%        have the same length in the output matrix CS.
% 
%        

function gfdeconv
%MATLAB Tour Partial Function Help:  comm_con
%
% GFDECONV GF(P) polynomial deconvolution or GF(P^M) elements dividing.
%        [Q, R] = GFDECONV(B, A) computes the quotient Q and remainder R of
%        deconvolution B by A in GF(2).
% 
%        [Q, R] = GFDECONV(B, A, P) computes the quotient and remainder R of
%        deconvolution B by A in GF(P) when P is a scalar prime number.
%        When P is a matrix containing the tuple of all elements in GF(p^M),
%        this function takes A and B as indices (power number of the
%        exponential form) of GF(p^M) elements. The output Q is
%        alpha^C = alpha^A / alpha^B in GF(p^M). The computation is
%        element-by-element computation. You can generate the tuple of all
%        elements in GF(Q^M) by P = GFTUPLE([-1:Q^M-2]', M, Q). 
%    
%        In polynomial computation, A, B, and C are in ascending order, i.e.,
%        A = [a_0, a_1, a_2,..., a_(n-1), a_n] represents
%        A(X) = a_0 + a_1 X + a_2 X^2 +...+ a_(n-1) X^(n-1) + a_n X^n
%        a_i must be a element in GF(P).
% 
%        In power representation form, [-Inf, 0, 1, 2, ...] represents 
%        [0, 1, alpha, alpha^2, ...] in GF(p^m).
% 
%       

function gfdiv
%MATLAB Tour Partial Function Help:  comm_con
%
% GFDIV  Element-by-element division in GF(P) or GF(P^M).
%        Q = GFDIV(B, A)  divides B by A resulting in the quotient Q in GF(2).
%        A zero element in A will result in an NaN solution.
% 
%        Q = GFDIV(B, A, P) divides B by A resulting in the quotient Q in
%        GF(P), where P must be a prime number. When P is a list of all the
%        elements in GF(P^M), and P is a prime number, Q is the result of the
%        dividing operation in the GF(P^M) field.
% 
%        

function gffilter
%MATLAB Tour Partial Function Help:  comm_con
%
% GFFILTER GF(P) polynomial filter computation.
%        Y = FILTER(B, A, X) filters the data in vector X with the
%        filter described by vectors A and B to create the filtered
%        data Y in GF(2).
% 
%        Y = FILTER(B, A, X, P) filters the data in GF(P).
% 
%        The filter uses the standard difference equation:
%        y(n) = b_nb*x(n) + b_(nb-1)*x(n-1) + ... + b_0*x(n-nb)
%                   - a_(na-1)*y(n-1) - ... - a_0*y(n-na)
% 
%        While all of the other GF functions in this toolbox, this
%        this function uses descending ordered polynomial, i.e.
%          A = [a_n, a_(n-1), ..., a_2, a_1, a_0] represents
%          A(X) = a_n X^n + ... + a_2 X^2 + a_1 X + a_0
%        a_i must be a non-negative integer less than P.
% 
%        

function gflineq
%MATLAB Tour Partial Function Help:  comm_con
%
% GFLINEQ Solves linear equations in GF(p).
%         X = GFLINEQ(A, B) outputs the solution of linear equation
%         A X = B in GF(2), where the elements in A and B are binary.
% 
%         [X, VLD] = GFLINEQ(A, B) outputs a flag for the validation of
%         the solution. The solution is valid only if VLD = 1.
% 
%         

function gfminpol
%MATLAB Tour Partial Function Help:  comm_con
%
% GFMINPOL Produces minimum polynomial of the given elements in GF(P^M).
%        PL = GFMINPOL(K, M) produces minimum polynomials of the given elements
%        K in GF(2^M). K = i represents alpha^i, where alpha is an
%        element in GF(2^M) field. GF(2^M) is a field generated by the default
%        M-degree primitive polynomial, where M is a positive integer. When M
%        is a binary vector instead of a positive number, M is a primitive
%        polynomial generated GF(2^DEG), where DEG is the degree of polynomial
%        ORD(X). The output roots PL is a row vector that represents the
%        minimum polynomial. When K is a vector, the output PL is a matrix with
%        i-th row representing the minimum polynomial of element K(i).
% 
%        PL = GFMINPOL(K, M, P) produces minimum polynomials in GF(P^M).
% 
%        

function gfmul
%MATLAB Tour Partial Function Help:  comm_con
%
% GFMUL  Element-by-element multiply in GF(P) or GF(P^M).
%        C = GFMUL(A, B) multiplies A with B in GF(2) element-by-element. A and
%        B are scalars or vectors in GF(2).
% 
%        C = GFMUL(A, B, P) multiplies A with B in GF(P) element-by-element
%        when P is a prime number. In this case, A and B are scalars or vectors
%        in GF(P). When P is a matrix that contains the list of all tuple
%        elements in GF(p^M), this function multiplies A with B in GF(P^M). The
%        output C is alpha^C = alpha^A * alpha^B in GF(Q^M). In this case A and
%        B are scalars or vectors in GF(p^M).  You can generate the tuple of all
%        elements in GF(Q^M) by P = GFTUPLE([-1:Q^M-2]', M, Q). 
% 
%        The element in GF(p^M) is represented by power form.
%        [-Inf, 0, 1, 2,...] represents [0, 1, alpha, alpha^2,...] in GF(p^m).
% 
%        

function gfplus
%MATLAB Tour Partial Function Help:  comm_con
%
% GFPLUS Adds two GF(2^M) elements.
%        C = GFPLUS(A, B, ALPHA, BETA) adds two GF(2^M) element A and B results
%        in C, i.e., a^C = a^A + a^B, where [a^-Inf, a^0,...a^(M-2)] is the 
%        exponential representation of all elements in GF(2^M). The variable
%        ALPHA is an integer vector that contains the decimal form of the
%        tuple of all elements in GF(2^M). ALPHA can be computed by
%        ALPHA = GFTUPLE([-1 : 2^M-2]', M) * 2.^[0 : M - 1]'
%        BETA is the index-contents reverse of ALPHA, which can be obtained by
%        BETA(ALPHA + 1) = 0 : 2^M - 1;
%        ALPHA and BETA must be length 2^M vectors. This function is the same
%        as GFADD but is much faster.
% 
%        

function gfpretty
%MATLAB Tour Partial Function Help:  comm_con
%
% GFPRETTY Pretty display of a GF(P) polynomial.
%        GFPRETTY(A) prints GF(P) polynomial in a traditional polynomial
%        format. All zero coefficient terms are eliminated.
% 
%        GFPRETTY(A, STR) prints GF(P) polynomial with the polynomial variable
%        specified in a string variable STR.
% 
%        GFPRETTY(A, STR, N) uses screen width N instead of the default 79.
% 
%       The polynomial A is in ascending order, i.e.,
%       A = [a_0, a_1, a_2,..., a_(n-1), a_n] represents
%             A(X) = a_0 + a_1 X + a_2 X^2 +...+ a_(n-1) X^(n-1) + a_n X^n
%       This function can also take a polynomial not in GF(P).
% 
%       

function gfprimck
%MATLAB Tour Partial Function Help:  comm_con
%
% GFPRIMCK GF(P) polynomial irreducible and primitive check.
%        CK = BFPRIMCK(A) checks the irreducible and primitive property
%        of a given GF(2) polynomial A. The meaning of the output CK is as
%        follows.
%            CK = -1   A is not a irreducible polynomial;
%            CK =  0   A is irreducible but not a primitive polynomial;
%            CK =  1   A is a primitive polynomial.
% 
%        CK = BFPRIMCK(A, P) checks the irreducible and primitive property
%        of a given GF(P) polynomial A.
% 
%        The polynomial represented in A is in ascending order, i.e.,
%        A = [a_0, a_1, a_2,..., a_(n-1), a_n] represents
%        A(X) = a_0 + a_1 X + a_2 X^2 +...+ a_(n-1) X^(n-1) + a_n X^n
%        where a_i must be an element in GF(P).
% 
%        

function gfprimdf
%MATLAB Tour Partial Function Help:  comm_con
%
% GFPRIMDF Produces a default primitive polynomial in GF(P^M).
%        Pol = GFPRIMDF(M) outputs the default primitive polynomial Pol in
%        GF(2^M). 
% 
%        Pol = GFPRIMDF(M, P) outputs the default primitive polynomial Pol
%        in GF(P^M).
% 
%        The default primitive polynomials are monic polynomials.
% 
%        

function gfprimfd
%MATLAB Tour Partial Function Help:  comm_con
%
% GFPRIMFD Searches primitive polynomials with a given polynomial degree.
%        PR = GFPRIMFD(M) finds one primitive polynomial with a given degree M.
%        in GF(2).
% 
%        PR = GFPRIMFD(M, FD_FLAG) finds primitive polynomial(s) with a given
%        degree M and flag FD_FLAG.
%        FD_FLAG = 'min'  find primitive polynomial with minimum degree.
%        FD_FLAG = 'max'  find primitive polynomial with maximum degree.
%        FD_FLAG = 'all'  do an exhausting search to find all primitive 
%                            polynomials of the given degree.
%        FD_FLAG = N      find all primitive polynomials with N terms.
% 
%        If PR is an empty output, no primitive polynomial was found
%        provided the given condition.
% 
%        PR = GFPRIMFD(M, FD_FLAG, P) finds primitive polynomial(s) in GF(P).
% 
%        

function gfrank
%MATLAB Tour Partial Function Help:  comm_con
%
% GFRANK Calculates the rank of a matrix in GF(P).
%        RK = GFRANK(A) calculates the rank of matrix A in GF(2).
% 
%        RK = GFRANK(A, P) calculates the rank of matrix in GF(P).
% 
%        

function gfrepcov
%MATLAB Tour Partial Function Help:  comm_con
%
% GFREPCOV Converts GF(2) polynomial representation format.
%        Q = GFREPCOV(P) converts the representation format in GF(2).
%        A GF(2) polynomial A can be written in a descending order form:
%        A(X) = a_0 + a_1 X + ... a_n X^n
%        In GF(2), a_i is either zero or one. P is a vector that lists
%        all exponential powers in which a_i is a non-zero number. For
%        example, P=[0 5] means P(X) = 1 + x^5. Q is a vector that lists
%        all coefficient of Q(X). For example, Q = [1 0 0 0 0 1] means
%        Q(X) = 1 + X^5.
% 
%        This function is written for GF(2) only.
%        
%        

function gfroots
%MATLAB Tour Partial Function Help:  comm_con
%
% GFROOTS Find roots for GF(P) polynomial f(X) in GF(P^M).
%        RT = GFROOTS(F) finds all roots for GF(2) polynomial F(X) in the
%        GF(2^M), where M is the degree of polynomial F(X). The default
%        polynomial generating GF(2^M) is defined in GFPRIMDF. The output
%        column vector RT contains the exponential index of the roots.
%        RT = [i, j, ..., k] means that the roots of F(X) are the elements
%        alpha^i, alpha^j, ..., alpha^k in GF(2^M). 
% 
%        RT = GFROOTS(F, M) finds all roots RT for GF(2) polynomial F(X) in
%        GF(2^M). GF(2^M) is the default degree M primitive polynomial, where
%        M is a positive integer. When M is a vector in GF(2) instead of a
%        positive number, M is a primitive polynomial generated by GF(2^DEG),
%        where DEG is the degree of M(X). DEG should be greater than the
%        degree of F(X). The output roots RT is an column vector with length
%        equals the degree of F(X). The list of GF(P^M) can be found by
%        [TP, IDX] = gftuple([-1 : P^M], M, P).
% 
%        This function outputs only the distinct roots of the polynomial F(X)
%        in the field. It cannot tell the multiple number of a root.
% 
%        RT = GFROOTS(F, M, P) finds all roots RT for GF(P) polynomial F(X) in
%        GF(P^M).
% 
%        [RT, RT_TUPLE] = GFROOTS(...) outputs the roots RT and the M-tuple of
%        of RT. Each row of RT_TUPLE represents the M-tuple representation of
%        RT.
% 
%        [RT, RT_TUPLE, ALPH] = GFROOTS(...) outputs the M-tuple of all
%        exponential indices generated by the primitive polynomial.
% 
%        

function gfsub
%MATLAB Tour Partial Function Help:  comm_con
%
% GFSUB  Subtract computation of two GF(P) polynomials or GF(P^M) elements.
%        C = GFSUB(A, B) subtracts GF(2) polynomial B from A. The resulting
%        GF(2) polynomial C keeps the larger length between A and B. In this
%        case, the result is the same as using GFADD.
% 
%        C = GFSUB(A, B, P) subtracts polynomial B from A in GF(P) for a
%        scalar prime number P. When P is a matrix that lists all elements of
%        a GF(Q^M) field, this function takes A and B as GF(Q^M) exponential
%        form index. The output C is alpha^C = alpha^A - alpha^B in GF(Q^M).
%        The output C is a column vector. A list of all element in GF(Q^M)
%        can be generated by P = GFTUPLE([-1:Q^M-2]',M,Q), 
% 
%        C = GFSUB(A, B, P, LEN) subtracts Galois field polynomials B from A.
%        The resulting GF(P) polynomial C keeps the given length LEN. When 
%        LEN is a negative number, the length of C will be degree(C) + 1.
% 
%        In polynomial computation, A, B, and C are in ascending order, i.e.,
%        A = [a_0, a_1, a_2,..., a_(n-1), a_n] represents
%        A(X) = a_0 + a_1 X + a_2 X^2 +...+ a_(n-1) X^(n-1) + a_n X^n
%        a_i must be a element in GF(P).
% 
%        In power representation form, [-Inf, 0, 1, 2, ...] represents 
%        [0, 1, alpha, alpha^2, ...] in GF(p^m).
% 
%        

function gftrunc
%MATLAB Tour Partial Function Help:  comm_con
%
% GFTRUNC Truncates redundant part of a GF(P) polynomial.
%        C = GFTRUNC(A) removes the zero coefficient from the highest order
%        terms from a GF(P) polynomial A. If the highest order term coefficient
%        is a non-zero number, the output of this function equals the input.
%        The resulted GF(P) polynomial C is the same as A with a shortened
%        form.
% 
%        The GF(P) polynomial A is in ascending order, i.e.,
%          A = [a_0, a_1, a_2,..., a_(n-1), a_n] represents
%          A(X) = a_0 + a_1 X + a_2 X^2 +...+ a_(n-1) X^(n-1) + a_n X^n
%        a_i must be an element in GF(P).
% 
%        

function gftuple
%MATLAB Tour Partial Function Help:  comm_con
%
% GFTUPLE Converts GF(P) polynomial to GF(P^M) tuple and index presentation.
%        TP = GFTUPLE(A, M) converts GF(2) polynomial A to the M-tuple
%        representation TP in GF(2^M). A is a matrix with each row of A
%        representing an ascending order polynomial with 
%        A(i,:) = [a_0, a_1, ... a_n] representing
%           A_i(X) = a+0 + a_1 X + ... + a_n X^n
%        When A is a column vector or a scalar, each element represents the
%        index (logarithm number) of the power representation, i.e., 
%        A_i(X) = X^A_i. GF(2^M) is generated by the default M-degree
%        primitive polynomial, where M is a positive integer. A primitive
%        polynomial can be found by using command GFPRIMDF. When M is a 
%        binary vector instead of a positive number, M is considered a
%        primitive polynomial in GF(2^DEG), where DEG is the degree of ORD(X).
% 
%        TP = GFTUPLE(A, M, P) generates the M-tuple representation in GF(P).
%        
%        TP = GFTUPLE(A, M, P, PRIM_CK) checks the primitive of M before
%        processing.
% 
%        Using [TP, IDX] = GFTUPLE([-1 : P^M-2]', M, P), you can generate a
%        matrix that contains all elements in GF(P^M) for any given M and P.
% 
%        

function bi2de
%MATLAB Tour Partial Function Help:  comm_con
%
% BI2DE Converts binary to decimal format.
%        D = BI2DE(B) converts a binary representation vector B to a decimal
%        presentation D. When B is a matrix, the output D is a column vector
%        with each element being the transfer of a row of B.
%        The first element in B represents the lowest binary bit. For example
%        bi2de([1 0]) results in 1; bi2de([0 1]) results in 2.
% 
%        D = BI2DE(B, P) converts a P-based vector to a decimal.
% 
%        

function blkdiag
%MATLAB Tour Partial Function Help:  comm_con
%
% BLKDIAG  Block diagonal concatenation of input arguments.
% 
%                                    |A 0 .. 0|
%    Y = BLKDIAG(A,B,...)  produces  |0 B .. 0|
%                                    |0 0 ..  |
% 
%    

function callhelp
%MATLAB Tour Partial Function Help:  comm_con
%
% CALLHELP Calls a specified section of a help file to display.
%        CALLHELP(FILE) displays a entire FILE contents in the MATLAB
%        workspace.
% 
%        CALLHELP(FILE, STR) searches [STR '_help_begin'] and [STR '_help_end']
%        in FILE and displays the section in the MATLAB workspace.
% 
%        CALLHELP(FILE, STR, ADDITION) displays additional information with a
%        line break.
% 
%        ERR = CALLHELP(...) output error message.
%        ERR = 0, command is successfully executed.
%        ERR = -2, file has not been  found.
% 
%        

function checkinp
%MATLAB Tour Partial Function Help:  comm_con
%
% CHECKINP Checks input and fills in the default.
%        [y1, .., yN] = checkinp(x1, ..., xN, z1, ..., zN) checks if xi is
%        empty. If xi is empty, the function fills yi with the given default
%        value zi. Otherwise, the function assigns yi=xi. The number of
%        variable N is limited to less than 10.

function closebut
%MATLAB Tour Partial Function Help:  comm_con
%
% CLOSEBUT Close all figures and Simulink block diagrams except the figure
%          with the given handle fh. 
% 
%        

function de2bi
%MATLAB Tour Partial Function Help:  comm_con
%
% DE2BI  Converts a positive decimal numbers to binary numbers.
%        B = DE2BI(D) converts a positive integer decimal vector D to a binary
%        matrix B. Each row of the binary matrix B represents the corresponding
%        number in D.
% 
%        B = DE2BI(D, N) specifies the column number for matrix B. N is a
%        positive scalar number.
% 
%        B = DE2BI(D, N, P) converts a decimal vector D to base P matrix.
% 
%        The first element in B represents the lowest binary bit. For example
%        DE2BI(1, 2) results in [1 0]; DE2BI(2) results in [0 1].
% 
%        

function vec2mat
%MATLAB Tour Partial Function Help:  comm_con
%
% VEC2MAT Vector to matrix conversion.
%        MAT = VEC2MAT(VEC, M) converts VEC to be a M column matrix with row
%        priority arrangement. If it needs to add an element, 0 will be added
%        to the end of the input vector to form the required matrix.
% 
%        MAT = VEC2MAT(VEC, M, AD_TO) specifies the adding element to be the
%        value in AD_TO.
% 
%        [MAT, ERR] = VEC2MAT(...) outputs ERR, which specifies how many
%        elements has been added in constructing the matrix.

function commgui
%MATLAB Tour Partial Function Help:  comm_con
%
% COMMGUI A MATLAB GUI example of bit-error rate computation.

function com_case
%MATLAB Tour Partial Function Help:  comm_con
%
%com_case is a Simulink model

function com_chan
%MATLAB Tour Partial Function Help:  comm_con
%
%com_chan is a Simulink model

function com_code
%MATLAB Tour Partial Function Help:  comm_con
%
%com_code is a Simulink model

function com_frmt
%MATLAB Tour Partial Function Help:  comm_con
%
%com_frmt is a Simulink model

function com_mlac
%MATLAB Tour Partial Function Help:  comm_con
%
%com_mlac is a Simulink model

function com_modu
%MATLAB Tour Partial Function Help:  comm_con
%
%com_modu is a Simulink model

function com_sour
%MATLAB Tour Partial Function Help:  comm_con
%
%com_sour is a Simulink model

function com_sync
%MATLAB Tour Partial Function Help:  comm_con
%
%com_sync is a Simulink model

function com_util
%MATLAB Tour Partial Function Help:  comm_con
%
%com_util is a Simulink model

function comcdbch
%MATLAB Tour Partial Function Help:  comm_con
%
%comcdbch is a Simulink model

function comcdcon
%MATLAB Tour Partial Function Help:  comm_con
%
%comcdcon is a Simulink model

function comcdcyc
%MATLAB Tour Partial Function Help:  comm_con
%
%comcdcyc is a Simulink model

function comcdham
%MATLAB Tour Partial Function Help:  comm_con
%
%comcdham is a Simulink model

function comcdlin
%MATLAB Tour Partial Function Help:  comm_con
%
%comcdlin is a Simulink model

function comcdrs
%MATLAB Tour Partial Function Help:  comm_con
%
%comcdrs is a Simulink model

function comcdint
%MATLAB Tour Partial Function Help:  comm_con
%
%comcdint is a Simulink model

function com_cdmo
%MATLAB Tour Partial Function Help:  comm_con
%
%com_cdmo is a Simulink model

function com_cemo
%MATLAB Tour Partial Function Help:  comm_con
%
%com_cemo is a Simulink model

function com_ddmo
%MATLAB Tour Partial Function Help:  comm_con
%
%com_ddmo is a Simulink model

function com_ddm2
%MATLAB Tour Partial Function Help:  comm_con
%
%com_ddm2 is a Simulink model

function com_mocd
%MATLAB Tour Partial Function Help:  comm_con
%
%com_mocd is a Simulink model

function com_moce
%MATLAB Tour Partial Function Help:  comm_con
%
%com_moce is a Simulink model

function com_momp
%MATLAB Tour Partial Function Help:  comm_con
%
%com_momp is a Simulink model

function ttrigwks
%MATLAB Tour Partial Function Help:  comm_con
%
%ttrigwks is a Simulink model

function ttrigfil
%MATLAB Tour Partial Function Help:  comm_con
%
%ttrigfil is a Simulink model

function tsteyesc
%MATLAB Tour Partial Function Help:  comm_con
%
%tsteyesc is a Simulink model

function tstbterr
%MATLAB Tour Partial Function Help:  comm_con
%
%tstbterr is a Simulink model

function turand
%MATLAB Tour Partial Function Help:  comm_con
%
%turand is a Simulink model

function tgrand
%MATLAB Tour Partial Function Help:  comm_con
%
%tgrand is a Simulink model

function tirand
%MATLAB Tour Partial Function Help:  comm_con
%
%tirand is a Simulink model

function tprand
%MATLAB Tour Partial Function Help:  comm_con
%
%tprand is a Simulink model

function tbrand
%MATLAB Tour Partial Function Help:  comm_con
%
%tbrand is a Simulink model

function tstrayl
%MATLAB Tour Partial Function Help:  comm_con
%
%tstrayl is a Simulink model

function tstricia
%MATLAB Tour Partial Function Help:  comm_con
%
%tstricia is a Simulink model

function tstquans
%MATLAB Tour Partial Function Help:  comm_con
%
%tstquans is a Simulink model

function tstdpcms
%MATLAB Tour Partial Function Help:  comm_con
%
%tstdpcms is a Simulink model

function tstquant
%MATLAB Tour Partial Function Help:  comm_con
%
%tstquant is a Simulink model

function tsthammc
%MATLAB Tour Partial Function Help:  comm_con
%
%tsthammc is a Simulink model

function tsthamsq
%MATLAB Tour Partial Function Help:  comm_con
%
%tsthamsq is a Simulink model

function tstbchcd
%MATLAB Tour Partial Function Help:  comm_con
%
%tstbchcd is a Simulink model

function tutbchcd
%MATLAB Tour Partial Function Help:  comm_con
%
%tutbchcd is a Simulink model

function tstbchsq
%MATLAB Tour Partial Function Help:  comm_con
%
%tstbchsq is a Simulink model

function tstrscod
%MATLAB Tour Partial Function Help:  comm_con
%
%tstrscod is a Simulink model

function tstrscbv
%MATLAB Tour Partial Function Help:  comm_con
%
%tstrscbv is a Simulink model

function tstrsinv
%MATLAB Tour Partial Function Help:  comm_con
%
%tstrsinv is a Simulink model

function tstrsbnv
%MATLAB Tour Partial Function Help:  comm_con
%
%tstrsbnv is a Simulink model

function tstcyclc
%MATLAB Tour Partial Function Help:  comm_con
%
%tstcyclc is a Simulink model

function tstcycsq
%MATLAB Tour Partial Function Help:  comm_con
%
%tstcycsq is a Simulink model

function tstlinco
%MATLAB Tour Partial Function Help:  comm_con
%
%tstlinco is a Simulink model

function tstlinsq
%MATLAB Tour Partial Function Help:  comm_con
%
%tstlinsq is a Simulink model

function tstconcd
%MATLAB Tour Partial Function Help:  comm_con
%
%tstconcd is a Simulink model

function tutconcd
%MATLAB Tour Partial Function Help:  comm_con
%
%tutconcd is a Simulink model

function tstconsq
%MATLAB Tour Partial Function Help:  comm_con
%
%tstconsq is a Simulink model

function fig_10_9
%MATLAB Tour Partial Function Help:  comm_con
%
%fig_10_9 is a Simulink model

function exconvcd
%MATLAB Tour Partial Function Help:  comm_con
%
%exconvcd is a Simulink model

function testinterleave
%MATLAB Tour Partial Function Help:  comm_con
%
%testinterleave is a Simulink model

function tstrsbch
%MATLAB Tour Partial Function Help:  comm_con
%
%tstrsbch is a Simulink model

function testscrm
%MATLAB Tour Partial Function Help:  comm_con
%
%testscrm is a Simulink model

function dsss
%MATLAB Tour Partial Function Help:  comm_con
%
%dsss is a Simulink model

function test_am2
%MATLAB Tour Partial Function Help:  comm_con
%
%test_am2 is a Simulink model

function test_qa2
%MATLAB Tour Partial Function Help:  comm_con
%
%test_qa2 is a Simulink model

function test_fm2
%MATLAB Tour Partial Function Help:  comm_con
%
%test_fm2 is a Simulink model

function testssba
%MATLAB Tour Partial Function Help:  comm_con
%
%testssba is a Simulink model

function testamc2
%MATLAB Tour Partial Function Help:  comm_con
%
%testamc2 is a Simulink model

function tstam2cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tstam2cd is a Simulink model

function tstqa2cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tstqa2cd is a Simulink model

function tstps2cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tstps2cd is a Simulink model

function tstps3cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tstps3cd is a Simulink model

function tstfs2cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tstfs2cd is a Simulink model

function tstpk2cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tstpk2cd is a Simulink model

function tmpam2cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tmpam2cd is a Simulink model

function tmpqa2cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tmpqa2cd is a Simulink model

function tmpps2cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tmpps2cd is a Simulink model

function tmpps3cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tmpps3cd is a Simulink model

function tmpfs2cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tmpfs2cd is a Simulink model

function tmppk2cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tmppk2cd is a Simulink model

function tddmmask
%MATLAB Tour Partial Function Help:  comm_con
%
%tddmmask is a Simulink model

function tddmqask
%MATLAB Tour Partial Function Help:  comm_con
%
%tddmqask is a Simulink model

function tutcdwmo
%MATLAB Tour Partial Function Help:  comm_con
%
%tutcdwmo is a Simulink model

function tddps2cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tddps2cd is a Simulink model

function tddps3cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tddps3cd is a Simulink model

function tddmmfsk
%MATLAB Tour Partial Function Help:  comm_con
%
%tddmmfsk is a Simulink model

function tddmmpsk
%MATLAB Tour Partial Function Help:  comm_con
%
%tddmmpsk is a Simulink model

function tstam2ce
%MATLAB Tour Partial Function Help:  comm_con
%
%tstam2ce is a Simulink model

function tcemqask
%MATLAB Tour Partial Function Help:  comm_con
%
%tcemqask is a Simulink model

function tceps2cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tceps2cd is a Simulink model

function tceps3cd
%MATLAB Tour Partial Function Help:  comm_con
%
%tceps3cd is a Simulink model

function tcemmfsk
%MATLAB Tour Partial Function Help:  comm_con
%
%tcemmfsk is a Simulink model

function tcemmpsk
%MATLAB Tour Partial Function Help:  comm_con
%
%tcemmpsk is a Simulink model

function tdpsk2
%MATLAB Tour Partial Function Help:  comm_con
%
%tdpsk2 is a Simulink model

function tdpsk
%MATLAB Tour Partial Function Help:  comm_con
%
%tdpsk is a Simulink model

function tbpsk
%MATLAB Tour Partial Function Help:  comm_con
%
%tbpsk is a Simulink model

function tbpsk2
%MATLAB Tour Partial Function Help:  comm_con
%
%tbpsk2 is a Simulink model

function tqpsk
%MATLAB Tour Partial Function Help:  comm_con
%
%tqpsk is a Simulink model

function tqpskmap
%MATLAB Tour Partial Function Help:  comm_con
%
%tqpskmap is a Simulink model

function toqpsk
%MATLAB Tour Partial Function Help:  comm_con
%
%toqpsk is a Simulink model

function toqpskmp
%MATLAB Tour Partial Function Help:  comm_con
%
%toqpskmp is a Simulink model

function tmsk
%MATLAB Tour Partial Function Help:  comm_con
%
%tmsk is a Simulink model

function tsttdma
%MATLAB Tour Partial Function Help:  comm_con
%
%tsttdma is a Simulink model

function tsttdmaa
%MATLAB Tour Partial Function Help:  comm_con
%
%tsttdmaa is a Simulink model

function tstfdma
%MATLAB Tour Partial Function Help:  comm_con
%
%tstfdma is a Simulink model

function tstcdma
%MATLAB Tour Partial Function Help:  comm_con
%
%tstcdma is a Simulink model

function tstrcos
%MATLAB Tour Partial Function Help:  comm_con
%
%tstrcos is a Simulink model

function tstrcos2
%MATLAB Tour Partial Function Help:  comm_con
%
%tstrcos2 is a Simulink model

function tstsinc
%MATLAB Tour Partial Function Help:  comm_con
%
%tstsinc is a Simulink model

function tsthilbt
%MATLAB Tour Partial Function Help:  comm_con
%
%tsthilbt is a Simulink model

function tstpll
%MATLAB Tour Partial Function Help:  comm_con
%
%tstpll is a Simulink model

function testregi
%MATLAB Tour Partial Function Help:  comm_con
%
%testregi is a Simulink model

function tstdist
%MATLAB Tour Partial Function Help:  comm_con
%
%tstdist is a Simulink model

function arraymax
%MATLAB Tour Partial Function Help:  comm_con
%
% ARRAYMAX outputs the index of the maximum input.
%        [SYS, X0, STR, TS] = ARRAYMAX(T,X,U,FLAG)
%        This M-file is designed to be used in a Simulink S-function block.
%        This function will detect the maximum number from the input and 
%        output the index number where the maximum number occurred.

function arraymin
%MATLAB Tour Partial Function Help:  comm_con
%
% ARRAYMIN outputs the index of the minimum input.
%    [SYS, X0, STR, TS] = ARRAYMIN(T,X,U,FLAG)
%    This M-file is designed to be used in a Simulink S-function block.
%    This function will detect the minimum number from the input and 
%    output the index number where the minimum number occurred.

function arraysin
%MATLAB Tour Partial Function Help:  comm_con
%
% ARRAYSIN outputs function SIN for a given vector input.
%    [SYS, X0, STR, TS] = ARRAYSIN(T, X, U, FLAG, NUM)
%    This M-file is designed to be used in a Simulink S-function block.
%    This function inputs NUM-array of input signal and outputs the
%    SIN function of the same array size signal.

function asciicod
%MATLAB Tour Partial Function Help:  comm_con
%
% ASCIICOD Generate pulse signal based on ascii coding.
%      [SYS,X0] = ASCIICOD(T,X,U,FLAG,PERIOD,WIDTH,SOURCE)
%      There will be a pulse generated until a non-zero
%      input pulse is received. 

function eyediasi
%MATLAB Tour Partial Function Help:  comm_con
%
% EYEDIASI Simulink eye diagram and scatter plot.
%    [SYS, X0, STR, TS]  = ...
%        EYEDIASI(T,X,U,FLAG,TIMERANGE,BOUNDARY,STORELENGTH,EYELINE,SCATTERLINE,TWODLINE)
% 
%    This M-file is designed to be used in a Simulink S-function block.
%    It plots an eye diagram against time and the scatter plot.
%    The parameter for the block of this figure are:
% 
%    timeRange     Time range ( and offset if it is a two element variable)
%    boundary     Lower and upper boundary of the Y axis.
%    storeLength  Keep number of traces in storage for print purpose.
%    eyeLine      Line type for eye-pattern diagram (0 for no such plot)
%    scatterLine  Symbol type for scatter plot (0 for no such plot)
%    twoDLine     Line type for 2-D trace plot (for 2-D signal only, 0 for no such plot)
%    
%    This file takes scalar input and trigger signal input
%    or a 2 dimensional vector input and trigger signal input.
% 
%    Set this M-file up in an S-function block.
%    Set the function parameter up as a four element vector
%    which defines the axis of the graph. The line type must be in
%    quotes.
% 
%    

function eyesampl
%MATLAB Tour Partial Function Help:  comm_con
%
%  EYESAMPL Simulink eye diagram and scatter plot --- sampled time version.
%    [SYS, X0, STR, TS]  = EYESAMPL(T,X,U,FLAG,TIMERANGE,BOUNDARY,STORELENGTH,EYELINE,SCATTERLINE,SAMPLETIME)
% 
%    This M-file is designed to be used in a Simulink S-function block.
%    It plots eyediagram against time and the scatter plot.
%    The parameter for the block of this figure are:
% 
%    timeRange    Time range = [Digit Sample Time, Plot offset, Decision offset]
%    boundary     Lower and upper boundary of the Y axis.
%    storeLength  Keep number of traces in storage for print purpose.
%    eyeLine      Line type for eye-pattern diagram (0 for no such plot)
%    scatterLine  Symbol type for scatter plot (0 for no such plot)
%    sampleTime   [Update sample time, update offset]
%    
%    This file takes scalar input or 2 dimensional vector input
% 
%    Set this M-file up in an S-function block.
%    Set the function parameter up as a four element vector
%    which defines the axis of the graph. The line type must be in
%    quotes.
% 
%    

function pulsegen
%MATLAB Tour Partial Function Help:  comm_con
%
% PULSEGEN generates a perfect pulse for the communication toolbox.
%     [SYS,X0] = PULSEGEN(T,X,U,FLAG,HEIGHT,WIDTH,DT)

function sbiterr
%MATLAB Tour Partial Function Help:  comm_con
%
%  SBITERR: S-function for display symbol and bit error
%  This M-file is designed to be used in a Simulink S-function block.
% 
%  [SYS, X0, STR, TS] = SBITERR(T, X, U, FLAG, NUMLINE, K, TIMEDELAY, SAMPLETIME)
%     NUMLINE:   number of lines on display.
%     K:         bit number. Input/Output are in the range (0, K-1)
%     TIMEDELAY: time delay from Input to Output
%     SAMPLETIME:sample time of the input signal
% 
%  

function sbiterrs
%MATLAB Tour Partial Function Help:  comm_con
%
% SBITERRS reset the data
%     SBITERRS(H_FIG, LEN_RATE, LEN_U)

function simrdbit
%MATLAB Tour Partial Function Help:  comm_con
%
% SIMRDBIT outputs a zero vector with rand bit ones.
%        [SYS, X0, STR, TS] = SIMRDBIT(T, X, U, FLAG, N, PROB, SEED)
%        This file is designed to be used in a Simulink S-Function block.
%        When the input is non-zero, this block computes the output.
%        When the input is zero, this block outputs zero vector.

function sviternd
%MATLAB Tour Partial Function Help:  comm_con
%
% SVITERND Simulink file for convolution decoding using Viterbi algorithm.
%        This file is designed to be used in a Simulink S-Function block.
%        The function requires the system inputs
%        code_param = [N, K, M, num_state, num_std_sta]; % prepared by simviter
%        tran_func  = [A, B; C, D];                      % prepared by simviter
%        leng                                            % memory length
%        tran_prob                                       % transfer probability
%           when it is not a three row matrix, take the code as hard 
%             decision one.
%        plot_flag                                       % should plot or not.
%           when it is not a positive integer, don't plot.
%           when it is a positive integer, keep the plot have the time length
%             as required.
%        This function keeps a number of discrete-time states:
%        figure number -Inf: to be opened; 0 not need to plot; positive: handle
%        figure posit  Current figure position.
%        trace_num     current trace number.
%        trace_flag    flag to indicate that computation is not under leng.
%        stater        variable in keeping the very beinging of state.
%        trace         a LENG-by-NUM_STD_STA matrix storage of the traces.
%        solut         a LENG-by-NUM_STD_STA matrix storage of the possible msg.
%        expense       a 2-by-NUM_STD_STA matrix storage of the expense.
% 

function trigfmfl
%MATLAB Tour Partial Function Help:  comm_con
%
% TRIGFMFL reads data or a character from workspace by counting the
%         number of triggers. Different from the time driven from
%         workspace block, this is an event driven block.
%         YIN: data to be read in. Block output size is the column of
%              this block. The block outputs a row of the data each
%              time. The data is 

