Main Content

frest.Random

Random input signal

Description

Use afrest.Randomobject to represent a random input signal for frequency response estimation. The random signal contains uniformly distributed random numbers in the interval[0 Amplitude]or[Amplitude 0]for positive and negative amplitudes, respectively.

Random signals are useful because they can excite the system uniformly at all frequencies up to the Nyquist frequency.

You can use a random input signal for estimation at the command line, in theModel Linearizer, or with theFrequency Response Estimatorblock. The estimation algorithm injects the signal at the input point you specify for estimation, and measures the response at the output point.

当你使用一个随机输入信号al for estimation, the frequencies returned in the estimatedfrdmodel depend on the length and sampling time of the signal. They are the frequencies obtained in the fast Fourier transform of the input signal. For more information, see the Algorithm section offrestimate.

To view a plot of your input signal, typeplot(input). To create atimeseriesobject for your input signal, use thegenerateTimeseriescommand.

Creation

Description

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

example

input= frest.Random(Name,Value)creates random signal withpropertiesspecified using one or more name-value pairs. Enclose each property name in quotes.

Input Arguments

expand all

Linear dynamic system, specified as a SISOss,tf, orzpkobject. You can specify known dynamics or obtain the linear model by linearizing a nonlinear system.

The resultingfrest.Randomobject automatically sets the following properties based on the linear system:

  • Tsis set such that the Nyquist frequency of the signal is five times the upper end of the frequency range to avoid aliasing issues.

  • NumSamples设置的频率响应估计includes the lower end of the frequency range.

The remaining properties use default values.

Properties

expand all

Signal amplitude, specified as a scalar. IfAmplitudeis:

  • Positive, the random signal values are uniformly distributed in the range[0 Amplitude]

  • Negative, the random signal values are uniformly distributed in the range[Amplitude 0]

Sample time of the random signal in seconds, specified as a positive scalar.

Number of samples in the random signal, specified as a positive integer.

This property does not determine number of frequency points in the final estimation result. Thefrestimatefunction discards any frequency points with negative values for this signal.

Random number stream, specified as aRandStreamobject. The state of the stream you specify is stored with the input signal. This stored state allows the software to return the same result every time you usegenerateTimeseriesandfrestimatewith the input signal.

By default,Streamis the default stream of the current MATLAB®session.

Object Functions

frestimate Frequency response estimation of金宝appmodels
generateTimeseries Generate time-domain data for input signal
frest.simCompare Plot time-domain simulation of nonlinear and linear models
frest.simView Plot frequency response model in time- and frequency-domain
getSimulationTime Final time of simulation for frequency response estimation

Examples

collapse all

Create a Random input signal with1000samples taken at100Hz and an amplitude of0.02.

input = frest.Random('Amplitude',0.02,...'Ts',1/100,...'NumSamples',1000);

Plot the random signal.

plot(input)

Figure contains an axes object. The axes object with title Time Series Plot:Created from a frest.Random signal contains an object of type line.

Create a multiplicative lagged Fibonacci generator random stream.

stream = RandStream('mlfg6331_64','Seed',0);

Create a random input signal using this stream.

input = frest.Random('Stream',stream);

Alternative Functionality

Model Linearizer

In theModel Linearizer, to use a random input signal for estimation, on theEstimationtab, selectInput Signal>Random.

Introduced in R2009b