generate.2order: Generation of the second order differential equation solution...

Description Usage Arguments Value Examples

View source: R/doremi.R

Description

generate.2order returns a data frame containing the time (supplied as input) and a simulated signal generated as a solution to a second order differential equation with constant coefficients that are provided as inputs:

\frac{d^2y}{dt} + 2ξω_{n}\frac{dy}{dt} + ω_{n}^2 y = ω_{n}^2 k*u(t)

Where: y(t) is the signal, \frac{dy}{dt} its derivative and \frac{d^2y}{dt} its second derivative

The excitation is also provided as input and it can be null (then the solution will be a damped linear oscillator when the initial condition is different from 0)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
generate.2order(
  time = 0:100,
  excitation = NULL,
  y0 = 0,
  v0 = 0,
  t0 = NULL,
  xi = 0.1,
  period = 10,
  k = 1,
  yeq = 0
)

Arguments

time

is a vector containing the time values corresponding to the excitation signal.

excitation

Is a vector containing the values of the excitation signal.

y0

is the initial condition for the variable y(t=t0), (0, by default), it is a scalar.

v0

is the initial condition for the derivative dy(t=t0), (0, by default), it is a scalar.

t0

is the time corresponding to the initial condition y0 and v0. Default is the minimum value of the time vector.

xi

is the damping factor. A negative value will produce divergence from equilibrium.

period

is the period T of the oscillation, T = \frac{2*π}{ω_{n}} as mentioned

k

Default is 1. It represents the proportionality between the stationary increase of signal and the excitation increase that caused it. Only relevant if the excitation is non null.

yeq

is the signal equilibrium value, i.e. the stationary value reached when the excitation term is 0.

Value

Returns a data.table containing four elements:

Examples

1
2
generate.2order(time=0:249,excitation=c(rep(0,10),rep(1,240)),period=10)
generate.2order(y0=10)

doremi documentation built on Jan. 29, 2021, 5:06 p.m.