frest.PRBS

Pseudorandom binary sequence input signal

Description

Use a frest.PRBS object to represent a pseudorandom binary sequence (PRBS) input signal for frequency response estimation. A PRBS signal is a deterministic signal that shifts between two values and has white-noise-like properties. A PRBS signal is inherently periodic with a maximum period length of 2n-1, where n is the PRBS order.

PRBS signals reduce total estimation time compared to using sinestream input signals, while producing comparable estimation results. PRBS signals are useful for estimating frequency responses for communications and power electronics systems with high-frequency switching components, such as pulse-width modulation (PWM) generators.

You can use a PRBS input signal for estimation at the command line or in the Model Linearizer app. The estimation algorithm injects the PRBS signal at the input point you specify for estimation and measures the response at the output point. For more information, see PRBS Input Signals.

To view a plot of your input signal, type plot(input). To create a timeseries object for your input signal, use the generateTimeseries command.

Creation

Description

example

input = frest.PRBS(sys) creates a PRBS signal with parameters based on the dynamics of the linear system sys. For instance, if you have an exact linearization of your system, you can use it to initialize the parameters.

example

input = frest.PRBS(Name,Value) creates a PRBS signal with properties specified using one or more name-value pairs. Enclose each property name in quotes.

Input Arguments

expand all

Linear dynamic system, specified as a SISO ss, tf, or zpk object. You can specify known dynamics or obtain the linear model by linearizing a nonlinear system.

The resulting frest.PRBS object automatically sets the Order and Ts properties based on the linear system. The Amplitude and NumPeriods properties remain at their default values. For more information, see PRBS Input Signals.

Properties

expand all

Signal amplitude, specified as a positive scalar. You must set the amplitude such that the system is properly excited for your application. If the input amplitude is too large, the signal can deviate too far from the model operating point. If the input amplitude is too small, the PRBS signal is indistinguishable from noise and ripples in your model.

Signal sample time in seconds, specified as a positive scalar. As a starting point, specify the PRBS sample time to match the sample time of your model.

For some systems, using a larger sample time than in the original model can produce a higher resolution frequency response estimation result over the low-frequency range. In this case, you must ensure that the frequency of your model at the input and output linear analysis points matches the value you specify for Ts. For an example, see Frequency Response Estimation for Power Electronics Model Using Pseudorandom Binary Signal.

Signal order, specified as a positive integer. The maximum length of the PRBS signal is 2n-1, where n is the signal order. To obtain an accurate frequency response estimation, the length of the PRBS must be sufficiently large.

For a given sample time, to obtain a higher frequency resolution, specify a larger signal order.

Number of periods in the PRBS signal, specified as a positive integer. For most frequency response estimation applications, use the default value of 1. Using a single period produces a flat frequency profile across the input signal frequency range.

The frequency range of the generated PRBS signal is from zero to FN/NumPeriods, where FN is the Nyquist frequency of the generated signal.

Object Functions

frestimateFrequency response estimation of Simulink models
generateTimeseriesGenerate time-domain data for input signal
frest.simComparePlot time-domain simulation of nonlinear and linear models
frest.simViewPlot frequency response model in time- and frequency-domain
getSimulationTimeFinal time of simulation for frequency response estimation

Examples

collapse all

Create a PRBS with the following configuration.

  • To use a nonperiodic PRBS set the number of periods to 1.

  • Use a PRBS order of 12, producing a signal of length 4095.

  • Set the sample time of the signal to 5e-6 seconds.

  • Set the perturbation amplitude to 0.05.

input = frest.PRBS('Order',12,'NumPeriods',1,'Amplitude',0.05,'Ts',5e-6)
 
The PRBS input signal:
 
      Amplitude  : 0.05
      Ts         : 5e-06 (secs)
      Order      : 12
      NumPeriods : 1
 

Examine a subset of the resulting PRBS signal.

plot(input)
xlim([0 0.001])

The signal switches between 0.025 and -0.025 in a deterministic pseudorandom manner.

Create a PRBS input signal based on the dynamics of a linear system. This approach is useful when you are using frequency response estimation to validate the linearization of your model.

Open a Simulink model.

model = 'watertank';
open_system(model)

For this example, linearize the model at a steady-state operating point to obtain a state-space model you can use to initialize the PRBS signal.

io(1) = linio('watertank/PID Controller',1,'input');
io(2) = linio('watertank/Water-Tank System',1,'openoutput');

watertank_spec = operspec(model);
opOpts = findopOptions('DisplayReport','off');
op = findop(model,watertank_spec,opOpts);

sys = linearize(model,op,io);

Create the PRBS signal.

input = frest.PRBS(sys);

frest.PRBS configures the order and sample time of the input signal based on the system dynamics. The amplitude and number of periods remain at their default values.

input
 
The PRBS input signal:
 
      Amplitude  : 1e-05
      Ts         : 7.94767061252222 (secs)
      Order      : 8
      NumPeriods : 1
 

You can change properties of the signal using dot notation. For instance, increase the signal amplitude.

input.Amplitude = 3e-5
 
The PRBS input signal:
 
      Amplitude  : 3e-05
      Ts         : 7.94767061252222 (secs)
      Order      : 8
      NumPeriods : 1
 

Alternative Functionality

Model Linearizer

In the Model Linearizer, to use a PRBS input signal for estimation, on the Estimation tab, select Input Signal > PRBS Pseudorandom Binary Sequence

Introduced in R2020a