Accelerating the pace of engineering and science

Documentation

Creating Input Signals for Estimation

Supported Input Signals

Frequency response estimation uses sinestream or chirp input signals.

Sinusoidal SignalWhen to Use
SinestreamRecommended for most situations. Especially useful when:
• Your system contains strong nonlinearities.

• You require highly accurate frequency response models.

Chirp
• Your system is nearly linear in the simulation range.

• You want to quickly obtain a response for a lot of frequency points.

Creating Sinestream Input Signals

What Is a Sinestream Signal?

A sinestream signal consists of several adjacent sine waves of varying frequencies. Each frequency excites the system for a period of time.

Create Sinestream Signals Using Linear Analysis Tool

This example shows how to create a sinestream input signal based upon a linearized model using the Linear Analysis Tool.

1. Obtain a linearized model, linsys1.

For example, see Linearize Simulink Model at Model Operating Point, which shows how to linearize a model.

2. In the Linear Analysis Tool, click the Frequency Response Estimation tab. In the Input Signal list, select Sinestream.

The Create sinestream input dialog box opens.

 Note:   Selecting Sinestream creates a continuous-time signal. To generate a discrete-time signal, choose Fixed Sample Time Sinestream from the Input Signal list.
3. In the System list, select linsys1. Click Initialize frequencies and parameters.

This action adds frequency points to the Frequency content viewer.

The software automatically selects frequency points based on the dynamics of linsys1. The software also automatically determines other parameters of the sinestream signal, including:

• amplitude

• number of periods

• settling periods

• ramp periods

• number of samples at each period

4. Click OK to create the sinestream input signal. A new input signal, in_sine1, appears in the Linear Analysis Workspace.

Create Sinestream Signals (MATLAB Code)

You can create a sinestream signal from both continuous-time and discrete-time signals in Simulink® models using the following commands:

Signal at Input Linearization PointCommand
Continuousfrest.Sinestream
Discretefrest.createFixedTsSinestream

Create a sinestream signal in the most efficient way using a linear model that accurately represents your system dynamics:

`input = frest.Sinestream(sys)`

sys is the linear model you obtained using exact linearization.

You can also define a linear system based on your insight about the system using the tf, zpk, and ss commands.

For example, create a sinestream signal from a linearized model:

```magball
io(1) = linio('magball/Desired Height',1);
io(2) = linio('magball/Magnetic Ball Plant',...
1,'output');
sys = linearize('magball',io);
input = frest.Sinestream(sys)```

The resulting input signal stores the frequency values as Frequency. frest.Sinestream automatically specifies NumPeriods and SettlingPeriods for each frequency:

```      Frequency           : [0.05786;0.092031;0.14638 ...] (rad/s)
Amplitude           : 1e-005
SamplesPerPeriod    : 40
NumPeriods          : [4;4;4;4 ...]
RampPeriods         : 0
SettlingPeriods     : [1;1;1;1 ...]
ApplyFilteringInFRESTIMATE (on/off)    : on
SimulationOrder (Sequential/OneAtATime): Sequential```

You can plot your input signal using plot(input).

The mapping between the parameters of the Create sinestream input dialog box in the Linear Analysis Tool and the options of frest.Sinestream is as follows:

Create sinestream input dialog boxfrest.Sinestream option
Amplitude'Amplitude'
Number of periods'NumPeriods'
Settling periods'SettlingPeriods'
Ramp periods'RampPeriods'
Number of samples at each period'SamplesPerPeriod'

How Frequency Response Estimation Treats Sinestream Inputs

Frequency response estimation using frestimate performs the following operations on a sinestream input signal:

1. Injects the sinestream input signal you design, uest(t), at the linearization input point.

2. Simulates the output at the linearization output point.

frestimate adds the signal you design to existing Simulink signals at the linearization input point.

3. Discards the SettlingPeriods portion of the output (and the corresponding input) at each frequency.

The simulated output at each frequency has a transient portion and steady state portion. SettlingPeriods corresponds to the transient components of the output and input signals. The periods following SettlingPeriods are considered to be at steady state.

4. Filters the remaining portion of the output and the corresponding input signals at each input frequency using a bandpass filter.

When a model is not at steady state, the response contains low-frequency transient behavior. Filtering typically improves the accuracy of your model by removing the effects of frequencies other than the input frequencies. These frequencies are problematic when your sampled data has finite length. These effects are called spectral leakage.

frestimate uses a finite impulse response (FIR) filter. The software sets the filter order to match the number of samples in a period such that any transients associated with filtering appear only in the first period of the filtered steady-state output. After filtering, frestimate discards the first period of the input and output signals.

You can specify to disable filtering during estimation using the signal ApplyFilteringInFRESTIMATE property.

5. Estimates the frequency response of the processed signal by computing the ratio of the fast Fourier transform of the filtered steady-state portion of the output signal yest(t) and the fast Fourier transform of the filtered input signal uest(t):

To compute the response at each frequency, frestimate uses only the simulation output at that frequency.

Creating Chirp Input Signals

What Is a Chirp Signal?

The swept-frequency cosine (chirp) input signal excites your system at a range of frequencies, such that the input frequency changes instantaneously.

Alternatively, you can use the sinestream signal, which excites the system at each frequency for several periods. See Supported Input Signals for more information about choosing your signal.

Create Chirp Signals Using Linear Analysis Tool

This example shows how to create a chirp input signal based upon a linearized model using the Linear Analysis Tool.

1. Obtain a linearized model, linsys1.

For example, see Linearize Simulink Model at Model Operating Point, which shows how to linearize a model.

2. In the Linear Analysis Tool, click the Frequency Response Estimation tab. In the Input Signal list, select Chirp.

The Create chirp input dialog box opens.

3. In the System list, select linsys1 selected. Click Compute parameters.

The software automatically selects frequency points based on the dynamics of linsys1. The software also automatically determines other parameters of the chirp signal, including:

• frequency range at which the linear system has interesting dynamics (see the From and To boxes of Frequency Range).

• amplitude.

• sample time. To avoid aliasing, the Nyquist frequency of the signal is five times the upper end of the frequency range, $\frac{2\pi }{5*\mathrm{max}\left(FreqRange\right)}$.

• number of samples.

• initial phase.

• sweep method

• sweep shape.

4. Click OK to create the chirp input signal. A new input signal in_chirp1 appears in the Linear Analysis Workspace.

Create Chirp Signals (MATLAB Code)

Create a chirp signal in the most efficient way using a linear model that accurately represents your system dynamics:

`input = frest.Chirp(sys)`

sys can be the linear model you obtained using exact linearization techniques. You can also define a linear system based on your insight about the system using the tf, zpk, and ss commands.

For example, create a chirp signal from a linearized model:

```magball
io(1) = linio('magball/Desired Height',1);
io(2) = linio('magball/Magnetic Ball Plant',...
1,'output');
sys = linearize('magball',io);
input = frest.Chirp(sys)```

The input signal is:

```      FreqRange              : [0.0578598408615998 10065.3895573969] (rad/s)
Amplitude              : 1e-005
Ts                     : 0.00012484733494616 (sec)
NumSamples             : 1739616
InitialPhase           : 270 (deg)
SweepMethod(linear/    : linear
logarithmic)```

You can plot your input signal using plot(input).

The mapping between the parameters of the Create chirp input dialog box in the Linear Analysis Tool and the options of frest.Chirp is as follows:

Create chirp input dialog boxfrest.Chirp option
Frequency range > From First element associated with the 'FreqRange' option
Frequency range > ToSecond element associated with the 'FreqRange' option
Amplitude'Amplitude'
Sample time (sec)'Ts'
Number of samples'NumSamples'
Initial phase (deg)'InitialPhase'
Sweep method'SweepMethod'
Sweep shape'Shape'