Fit curve to nonsmooth empirical bit error rate (BER) data
fitber = berfit(empEbNo,empber)
fitber = berfit(empEbNo,empber,fitEbNo)
fitber = berfit(empEbNo,empber,fitEbNo,options)
fitber = berfit(empEbNo,empber,fitEbNo,options,
[fitber,fitprops] = berfit(...)
fitber = berfit(empEbNo,empber) fits a
curve to the empirical BER data in the vector
returns a vector of fitted bit error rate (BER) points. The values
to the Eb/N0 values,
in dB, given by
empEbNo. The vector
be in ascending order and must have at least four elements.
fitber = berfit(empEbNo,empber,fitEbNo) fits
a curve to the empirical BER data in the vector
to the Eb/N0 values,
in dB, given by
empEbNo. The function then evaluates
the curve at the Eb/N0 values,
in dB, given by
fitEbNo and returns the fitted
BER points. The length of
fitEbNo must equal or
exceed that of
fitber = berfit(empEbNo,empber,fitEbNo,options) uses
options to override the default options
used for optimization. These options are the ones used by the
You can create the
options structure using the
Particularly relevant fields are described in the table below.
|Level of display: |
|Maximum number of function evaluations before optimization ceases. The default is 104.|
|Maximum number of iterations before optimization ceases. The default is 104.|
|Termination tolerance on the closed-form function used to generate the fit. The default is 10-4.|
|Termination tolerance on the coefficient values of the closed-form function used to generate the fit. The default is 10-4.|
fitber = berfit(empEbNo,empber,fitEbNo,options, specifies
which closed-form function
berfit uses to fit
the empirical data, from the possible fits listed in Algorithms below.
'doubleExp+const'. To avoid overriding default
optimization options, use
options = .
[fitber,fitprops] = berfit(...) returns
the MATLAB structure
fitprops, which describes
the results of the curve fit. Its fields are described in the table
|The closed-form function
type used to generate the fit: |
|The coefficients used to
generate the fit. If the function cannot find a valid fit, |
|The sum squared error between the log of the fitted BER points and the log of the empirical BER points.|
|The exit condition of |
|The number of function evaluations used in minimizing the sum squared error function.|
|The number of iterations taken in minimizing the sum squared error function. This is not necessarily equal to the number of function evaluations.|
berfit(...) plots the
empirical and fitted BER data.
the empirical and fitted BER data from all the possible fits, listed
in the Algorithms below, that
return a valid fit. To avoid overriding default options, use
Note: A valid fit must be
If a fit does not confirm to this criteria, it is rejected.
The examples below illustrate the syntax of the function, but they use hard-coded or theoretical BER data for simplicity. For an example that uses empirical BER data from a simulation, see Example: Curve Fitting for an Error Rate Plot.
The code below plots the best fit for a sample set of data.
EbNo = 0:13; berdata = [.2 .15 .13 .12 .08 .09 .08 .07 .06 .04 .03 .02 .01 .004]; berfit(EbNo,berdata); % Plot the best fit.
The curve connects the points created by evaluating the fit
expression at the values in
EbNo. To make the curve
look smoother, use a syntax like
This alternative syntax uses more points when plotting the curve,
but it does not change the fit expression.
The next example demonstrates a fit for a BER curve with an
error floor. We generate the empirical BER array by simulating a channel
with a null (
ch = [0.5 0.47]) with BPSK modulation
and linear MMSE equalizer at the receiver. We run the berfit with
'all' option. The
does not provide a valid fit, and the
type does not work well for this data. The
closely match the simulated data.
EbNo = -10:3:15; empBER = [0.3361 0.3076 0.2470 0.1878 0.1212 0.0845 0.0650 0.0540 0.0474]; figure; berfit(EbNo, empBER, , , 'all');
The following code illustrates the use of the
structure as well as the
fitprops output structure.
'notify' value for the display level causes
the function to produce output when one of the attempted fits does
not converge. The
exitState field of the output
structure also indicates which fit converges and which fit does not.
M = 8; EbNo = 3:10; berdata = berfading(EbNo,'psk',M,2); % Compute theoretical BER. noisydata = berdata.*[.93 .92 1 .59 .08 .15 .01 .01]; % Say when fit fails to converge. options = optimset('display','notify'); disp('*** Trying exponential fit.') % Poor fit [fitber1,fitprops1] = berfit(EbNo,noisydata,EbNo,... options,'exp') disp('*** Trying polynomial ratio fit.') % Good fit [fitber2,fitprops2] = berfit(EbNo,noisydata,EbNo,... options,'polyRatio')
berfit function fits the BER data using
unconstrained nonlinear optimization via the
The closed-form functions that
are listed in the table below, where x is the Eb/N0 in
linear terms (not dB) and f is
the estimated BER. These functions were empirically found to provide
close fits in a wide variety of situations, including exponentially
decaying BERs, linearly varying BERs, and BER curves with error rate
of ||Functional Expression|
The sum squared error function that
to minimize is
where the fitted BER points are the
fitber and the sum is over the Eb/N0 points
empEbNo. It is important to use the log
of the BER values rather than the BER values themselves so that the
high-BER regions do not dominate the objective function inappropriately.
For a general description of unconstrained nonlinear optimization, see the following work.
 Chapra, Steven C., and Raymond P. Canale, Numerical Methods for Engineers, Fourth Edition, New York, McGraw-Hill, 2002.