summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-06-03 17:12:03 +0530
committerSuraj Yerramilli2015-06-03 17:12:03 +0530
commite8ff5e9adbdbb3328068f36d08536cd165f69e3f (patch)
tree5e2cbacf15a8405d19bc4a96ebfcb3f3e08bdc7c /R
parent72e42643b762b2ba5ed8df82f168bf49e927f941 (diff)
downloadSysID-R-code-e8ff5e9adbdbb3328068f36d08536cd165f69e3f.tar.gz
SysID-R-code-e8ff5e9adbdbb3328068f36d08536cd165f69e3f.tar.bz2
SysID-R-code-e8ff5e9adbdbb3328068f36d08536cd165f69e3f.zip
Minor corrections in error
Diffstat (limited to 'R')
-rw-r--r--R/idframe.R8
1 files changed, 4 insertions, 4 deletions
diff --git a/R/idframe.R b/R/idframe.R
index a9aa012..31b0b41 100644
--- a/R/idframe.R
+++ b/R/idframe.R
@@ -174,15 +174,15 @@ idfrd <- function(response,freq,Ts){
#' @export
plot.idfrd <- function(object){
require(ggplot2);require(reshape2);require(signal)
-
+
mag <- 20*log10(Mod(object$resp))
- phase <- unwrap(Arg(object$resp))
- sys_df <- data.frame(Frequency = object$freq,Gain = mag,Phase = -phase)
+ phase <- -180/pi*unwrap(Arg(object$resp))
+ sys_df <- data.frame(Frequency = object$freq,Gain = mag,Phase = phase)
melted_sys_df <- melt(sys_df, id.var = c("Frequency"))
bode <- ggplot(sys_df, aes(x = Frequency)) +
geom_line(colour="steelblue") + scale_x_log10() + theme_bw() +
- geom_vline(aes(xintercept=max(object$freq),size=1.2))
+ geom_vline(xintercept=max(object$freq),size=1.2)
bode_gain <- bode + aes(y = Gain)
bode_phase <- bode + aes(y = Phase)