gensig
Create periodic signals for simulating system response.
Syntax
[u, t] = gensig(type, tau)
[u, t] = gensig(type, tau, Tf)
[u, t] = gensig(type, tau, Tf, Ts)
Input argument
type - Type of periodic signal: 'cos', 'tan', 'sin', 'pulse', 'square'
tau - Period: positive scalar
Tf - Duration: positive scalar or 5*tau (default)
Ts - positive scalar or tau/64 (default)
Output argument
u - Generated signal: column vector.
t - Time vector: column vector.
Description
The function gensig(type, tau) creates a periodic signal with unit amplitude, characterized by the specified type and period.
The resulting signal, denoted as u, and its corresponding time vector, t, can be utilized for simulating the time response of a single-input dynamic system using lsim.
For multi-input systems, you can generate signals by making repeated calls to gensig and then assemble the resulting u vectors into a matrix. When simulating a dynamic system model with u and t, note that the software interprets the time vector t with units based on the TimeUnit property of the model.
To generate a signal with a specific duration Tf, use [u, t] = gensig(type, tau, Tf).
The time vector t spans from 0 to Tf in increments of tau/64.
For a signal with a defined sample time Ts, employ [u, t] = gensig(type, tau, Tf, Ts).
In this case, the time vector t ranges from 0 to Tf in increments of Ts.
This syntax is particularly useful for generating signals tailored for discrete-time model simulations, where Ts corresponds to the sample time of the model.
Example
See also
lsim.
History
Version | Description |
---|---|
1.0.0 | initial version |
Author
Allan CORNET
Last updated