Pseudorandom binary sequence input signal
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
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
creates a PRBS signal with parameters based on the dynamics of the linear system
input = frest.PRBS(
sys. For instance, if you have an exact linearization of your
system, you can use it to initialize the parameters.
sys— Linear dynamic system
frest.PRBS object automatically sets the
Ts properties based on the
linear system. The
properties remain at their default values. For more information, see PRBS Input Signals.
Amplitude— Signal amplitude
1e-5(default) | positive scalar
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.
Ts— Signal sample time
0.001(default) | positive scalar
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.
Order— Signal order
10(default) | positive integer
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.
NumPeriods— Number of periods
1(default) | positive integer
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.
|Frequency response estimation of Simulink models|
|Generate time-domain data for input signal|
|Plot time-domain simulation of nonlinear and linear models|
|Plot frequency response model in time- and frequency-domain|
|Final time of simulation for frequency response estimation|
Create a PRBS with the following configuration.
To use a nonperiodic PRBS set the number of periods to
Use a PRBS order of
12, producing a signal of length
Set the sample time of the signal to
Set the perturbation amplitude to
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.
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
In the Model Linearizer, to use a PRBS input signal for estimation, on the Estimation tab, select Input Signal > PRBS Pseudorandom Binary Sequence