cor.mat关联矩阵行,R语言imagefx包,时序图像特征识别
# Sun Oct 10 00:40:36 2021 edit
# 字符编码:UTF-8
# R 版本:R 4.1.1 x64 for window 11
# cgh163email@163.com
# 个人笔记不负责任,拎了个梨🍐🍈
#.rs.restartR()
require(imagefx)
rm(list = ls());gc()
? cor.mat # 关联矩阵行
## generate a time axis
tax = seq(0,10,by=0.1)
## generate two signals with a phase offset
sig1 <- sin(2*pi*1/2*tax)
sig2 <- sin(2*pi*1/2*tax + pi/2)
par(mfrow=c(3,1))
plot(sig1)
plot(sig2)
best.lag <- cor.mat(sig1,sig2)
plot(sig1,type='l',col='blue',main=paste('lag is: ',best.lag,sep=''))
lines(sig2,col='green')
dev.copy(png, "cor.mat关联矩阵行.png");dev.off()