#' @title Time Series generation from a matrix
#' @description This function produces a time Series generated by a supplied matrix
#' @param N integer - number of iterations/Length of time series
#' @param x0 double - starting value
#' @param mat matrix of type double - The generating system
#' @param skipFirst boolean - Wether the resulting time series should contain the initial value x0 or not
#' @return the time series
#' @export
discreteMap_iter = function(N,x0,mat,skipFirst = TRUE){
x0 = valToVec(val = x0,
N = dim(mat)[2])
if (skipFirst) x0 = mat %*% x0
Series = matrix(data = rep(x0,N),
nrow = length(x0),
ncol = N,
byrow = FALSE)
for (i in 2:N){
Series[,i] = mat %*% Series[,i-1]
}
result = apply(X = Series,
MARGIN = 2,
FUN = function(colVec){
vecToVal(vec = colVec)
})
return(result)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.