diff options
author | Suraj Yerramilli | 2016-02-22 21:19:37 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2016-02-22 21:19:37 +0530 |
commit | 9e15a697398567f90f06790440a5be4199d081d4 (patch) | |
tree | f472bbfdd3860a8c4a3117b218a2ec654fb9e9a2 /R/idframe.R | |
parent | d5c5166b9fc2e161e2554cce9e91ced8afb1ad67 (diff) | |
download | SysID-R-code-9e15a697398567f90f06790440a5be4199d081d4.tar.gz SysID-R-code-9e15a697398567f90f06790440a5be4199d081d4.tar.bz2 SysID-R-code-9e15a697398567f90f06790440a5be4199d081d4.zip |
changing data structure from vector to array
Diffstat (limited to 'R/idframe.R')
-rw-r--r-- | R/idframe.R | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/R/idframe.R b/R/idframe.R index b90eeef..2313bff 100644 --- a/R/idframe.R +++ b/R/idframe.R @@ -135,6 +135,11 @@ deltat.idframe <- function(data){ #' #' @export idfrd <- function(response,freq,Ts){ + response <- ifelse(is.vector(response), + array(response,c(0,0,length(response))), + ifelse(nrow(response)==1, + array(response,c(0,0,nrow(response))), + response)) out <- list(response=response,freq=freq,Ts=Ts) class(out) <- "idfrd" return(out) @@ -159,8 +164,8 @@ idfrd <- function(response,freq,Ts){ #' @export plot.idfrd <- function(x){ - mag <- 20*log10(Mod(x$resp)) - phase <- 180/pi*signal::unwrap(Arg(x$resp)) + mag <- 20*log10(Mod(x$resp[1,1,])) + phase <- 180/pi*signal::unwrap(Arg(x$resp[1,1,])) sys_df <- data.frame(Frequency = x$freq,Gain = mag,Phase = phase) melted_sys_df <- reshape2::melt(sys_df, id.var = c("Frequency")) |