gensig: Generate periodic signal

Description Usage Arguments Details Value See Also Examples

View source: R/gensig.R

Description

gensig generates a periodic signal. More useful when used in combination with lsim

Usage

1
gensig(signal, tau, tfinal, tsam)

Arguments

signal

A string input containing either values of: square, sin, cos, pulse in the following format:

'sq' or 'square' - Square wave

'si' or 'sine' - Sine wave

'co' or 'cos' - Cosine wave

'pu' or 'pulse' - Periodic pulse

tau

Duration of one period in seconds. Default is 5

tfinal

Duration of the signal in seconds. Default is 30

tsam

sampling time in seconds. Default is 0.01

Details

gensig generates a periodic signal of the following types: square, sin, cos, pulse

Possible usage: gensig(signal)

Value

Returns a list of two single column matrices, u and t

u is the vector of signal values

t is the time vector of the signal

See Also

lsim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run:  A square wave signal 
sig <-  gensig('square', 4, 10, 0.1)
plot(sig$t, sig$u, type = "l", col = "blue")
grid(5,5, col = "lightgray")

## Not run:  A sine wave signal 

sig <-  gensig('sin')
plot(sig$t, sig$u, type = "l", col = "blue")
grid(5,5, col = "lightgray")

benubah/control documentation built on May 10, 2020, 1:38 a.m.