Documentation

Create Sinestream Input Signals

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. If you do not have a linearized model in your workspace, you can manually construct a sinestream as shown in Estimate Frequency Response Using 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, in the Estimation tab, in the Input Signal drop-down list, select Sinestream.

    The Create sinestream input dialog box opens.

    Note

    Selecting Sinestream creates a continuous-time signal. To generate a discrete-time signal, in the Input Signal drop-down list, select Fixed Sample Time Sinestream.

  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 Using 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
      FreqUnits (rad/s,Hz): rad/s
      SettlingPeriods     : [1;1;1;1 ...]
      ApplyFilteringInFRESTIMATE (on/off)    : on
      SimulationOrder (Sequential/OneAtATime): Sequential

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

For more information about sinestream options, see the frest.Sinestream reference page.

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'

See Also

|

Related Topics

Was this topic helpful?