| Contents | Index |
| On this page… |
|---|
Frequency response estimation uses sinestream or chirp input signals.
| Sinusoidal Signal | When to Use |
|---|---|
| Sinestream | Recommended for most situations. Especially useful when:
|
| Chirp |
|
A sinestream signal consists of several adjacent sine waves of varying frequencies. Each frequency excites the system for a period of time.

This example shows how to create a sinestream input signal in the Linear Analysis Tool.
Create a sinestream signal using linsys1, which is a linearized model in the Linear Analysis Workspace of the Linear Analysis Tool.
Click the Frequency Response Estimation tab. In the Input Signal list, select Sinestream....

This action opens the Create sinestream input dialog box.

This dialog box creates a continuous-time signal.
With linsys1 chosen in the System list, click Initialize frequencies and parameters.

This action adds frequency points to the Frequency content viewer.

The points in the Frequency content viewer are obtained using linsys1. linsys1 determines the following parameters of the sinestream:
Frequencies at which the linear system has interesting dynamics (the frequency points visible in the Frequency content viewer.)
Number of periods for the system to reach steady state at each frequency (see the Settling periods box)
Total number of periods for each frequency (see the Number of periods box)

Click OK.
This action creates the sinestream input signal in_sine1 in the Linear Analysis Workspace.

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 Point | Command |
|---|---|
| Continuous | frest.Sinestream |
| Discrete | frest.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,'out');
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
FreqUnits (rad/s,Hz): rad/s
SettlingPeriods : [1;1;1;1 ...]
ApplyFilteringInFRESTIMATE (on/off) : on
SimulationOrder (Sequential/OneAtATime): SequentialFor more information about sinestream options, see the frest.Sinestream reference page.
You can plot your input signal using plot(input). Estimate a frequency response model to evaluate the quality of your input signal.
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 box | frest.Sinestream option |
| Amplitude | 'Amplitude' |
| Number of periods | 'NumPeriods' |
| Settling periods | 'SettlingPeriods' |
| Ramp periods | 'RampPeriods' |
| Number of samples at each period | 'SamplesPerPeriod' |
Frequency response estimation using frestimate performs the following operations on a sinestream input signal:
Injects the sinestream input signal you design, uest(t), at the linearization input point.
Simulates the output at the linearization output point.
frestimate adds the signal you design to existing Simulink signals at the linearization input point.

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.

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.
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.
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.

This example shows how to create a chirp input signal in the Linear Analysis Tool.
Create a chirp signal using linsys1, which is a linearized model in the Linear Analysis Workspace of the Linear Analysis Tool.
Click the Frequency Response Estimation tab. In the Input Signal list, select Chirp....

This action opens the Create chirp input dialog box.

With linsys1 selected in the System list, click Compute parameters.

This action updates the parameter values for the chirp signal in the Create chip input dialog box.
The chirp signal parameters are obtained using linsys1. linsys determines the following parameters of the chirp signal:
Frequency range at which the linear system has interesting dynamics (see the From and To boxes of Frequency Range).
Sampling time of the signal (see the Sample
time (sec) box). To avoid aliasing, the Nyquist frequency
of the signal is five times the upper end of the frequency range,
.
Number of samples in the signal is such that the frequency response estimation includes the lower end of the frequency range (see the Number of samples box).
Click OK.
This action creates the chirp input signal in_chirp1 in the Linear Analysis Workspace.

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,'out');
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)
FreqUnits (rad/s or Hz): rad/s
SweepMethod(linear/ : linear
quadratic/
logarithmic)For more information about chirp signal properties, see the frest.Chirp reference page.
You can plot your input signal using plot(input). Estimate a frequency response model to evaluate the quality of your input signal.
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 box | frest.Chirp option |
| Frequency range > From | First element associated with the 'FreqRange' option |
| Frequency range > To | Second 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' |
When the frequency response estimation produces unexpected results, you can try modifying the input signal properties in the ways described in Troubleshooting Frequency Response Estimation.
To modify an existing sinestream input signal, double click it in the data browser of the Linear Analysis Tool.
This action will open the Edit dialog box for the input signal.
In the Create sinestream dialog box of the Linear Analysis Tool:
To add frequency points in
the Frequency content viewer, click
in the Frequency content toolbar.
This action launches the Add frequencies dialog box.

To delete a frequency point in the Frequency content viewer:
In the Frequency content viewer, click on the point to delete.

This action selects the frequency point. The selected point appears blue.
Click
in the Frequency content toolbar.
This action will delete the selected frequency point from the Frequency content viewer.
To modify a parameter value for a frequency point, edit the value in the associated box.
For example, suppose that you used a sinestream input signal, and the output at a specific frequency did not reach steady state. In this case, you can modify the characteristics of the sinestream input at the corresponding frequency.
input.NumPeriods(index)=NewNumPeriods; input.SettlingPeriods(index)=NewSettlingPeriods;
where index is the frequency value index of the sine wave you want to modify. NewNumPeriods and NewSettlingPeriods are the new values of NumPeriods and SettlingPeriods, respectively.
To modify several signal properties at a time, you can use the set command. For example:
input = set(input,'NumPeriods',NewNumPeriods,...
'SettlingPeriods',NewSettlingPeriods)After modifying the input signal, repeat the estimation, as described in Estimating Frequency Response.
![]() | Estimation Requires Input and Output Signals | Estimating Frequency Response | ![]() |

Learn more about resources for designing, testing, and implementing control systems.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |