Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Contents

frest.Sinestream

Package: frest

Signal containing series of sine waves

Syntax

input = frest.Sinestream(sys)
input = frest.Sinestream('OptionName',OptionValue)

Description

input = frest.Sinestream(sys) creates a signal with a series of sinusoids based on the dynamics of a linear system sys.

input = frest.Sinestream('OptionName',OptionValue) creates a signal with a series of sinusoids, where each sinusoid frequency lasts for a specified number of periods, using the options specified by comma-separated name/value pairs.

To view a plot of your input signal, type plot(input). To obtain a timeseries for your input signal, use the generateTimeseries command.

Input Arguments

sys

Linear system for creating a sinestream signal based on the dynamic characteristics of this system. You can specify the linear system based on known dynamics using tf, zpk, or ss. You can also obtain the linear system by linearizing a nonlinear system.

The resulting sinestream signal automatically sets these options based on the linear system:

  • 'Frequency' are the frequencies at which the linear system has interesting dynamics.

  • 'SettlingPeriods' is the number of periods it takes the system to reach steady state at each frequency in 'Frequency'.

  • 'NumPeriods' is (3 + SettlingPeriods) to ensure that each frequency excites the system at specified amplitude for at least three periods.

  • For discrete systems only, 'SamplesPerPeriod' is set such that all frequencies have the same sample time as the linear system.

Other sinestream options have default values.

'OptionName',OptionValue

Signal characteristics, specified as comma-separated pairs of option name string and the option value.

Option NameOption Value
'Frequency'Signal frequencies, specified as either a scalar or a vector of frequency values.

Default: logspace(1,3,50)
'Amplitude'Signal amplitude at each frequency, specified as either:
  • Scalar to set all frequencies to same value

  • Vector to set each frequencies to a different value


Default: 1e-5
'SamplesPerPeriod'Number of samples for each period for each signal frequency, specified as either:
  • Scalar to set all frequencies to same value

  • Vector to set each frequencies to a different value


Default: 40
'FreqUnits'Frequency units:
  • 'rad/s'—Radians per second

  • 'Hz'— Hertz


Default: 'rad/s'
'RampPeriods'Number of periods for ramping up the amplitude of each sine wave to its maximum value, specified as either:
  • Scalar to set all frequencies to same value

  • Vector to set each frequencies to a different value

Use this option to ensure a smooth response when your input amplitude changes.
Default: 0

'NumPeriods'Number of periods each sine wave is at maximum amplitude, specified as either:
  • Scalar to set all frequencies to same value

  • Vector to set each frequencies to a different value



Default: max(3–RampPeriods+SettlingPeriods,, 2)

'SettlingPeriods'Number of periods corresponding to the transient portion of the simulated response at a specific frequency, before the system reaches steady state, specified as either:
  • Scalar to set all frequencies to same value

  • Vector to set each frequencies to a different value

Before performing the estimation, frestimate discards this number of periods from the output signals.

Default: 1

'ApplyFilteringInFRESTIMATE'Frequency-selective FIR filtering of the input signal before estimating the frequency response using frestimate.
  • 'on' (default)

  • 'off'

For more information, see the frestimate algorithm.
'SimulationOrder'The order in which frestimate injects the individual frequencies of the input signal into your Simulink® model during simulation.
  • 'Sequential' (default) — frestimate injects one frequency after the next into your model in a single Simulink simulation using variable sample time. To use this option, your Simulink model must use a variable-step solver.

  • 'OneAtATime'frestimate injects each frequency during a separate Simulink simulation of your model. Before each simulation, frestimate initializes your Simulink model to the operating point specified for estimation. If you have Parallel Computing Toolbox™ installed, you can run each simulation in parallel to speed up estimation using parallel computing. For more information, see Speeding Up Estimation Using Parallel Computing.

Examples

Create a sinestream signal having several different frequencies. For each frequency, specify an amplitude, a number of periods at maximum amplitude, a ramp-up period, and a number of settling periods.

  1. Create sinestream signal.

    input = frest.Sinestream('Frequency',[1 2.5 5],...
                 'Amplitude',[1 2 1.5],...
                 'NumPeriods',[4 6 12],...
                 'RampPeriods',[0 2 6],...
                 'SettlingPeriods',[1 3 7]);
    
  2. (Optional) Plot the sinestream signal.

    plot(input)
    

 

Create a sinusoidal input signal with the following characteristics:

  • 50 frequencies spaced logarithmically between 10 Hz and 1000 Hz

  • All frequencies have amplitude of 1e-3

  • Sampled with a frequency 10 times the frequency of the signal (meaning ten samples per period)

% Create the input signal
input = frest.Sinestream('Amplitude',1e-3,'Frequency',logspace(1,3,50),...
'SamplesPerPeriod',10,'FreqUnits','Hz');

See Also

| | | | |

Was this topic helpful?