動標構

  • 予定パッケージ名
    • SphereAndSimplex
  • 関数名
    • MovingFrame
  • タイトル
MovingFrame
  • 説明
ベクトルの変化を収めた行列から動標構を作る。
列数mの行列の第1〜第n列(m>n)部分のみの処理も可能。
  • 使用例
MovingFrame(xs,n)
# Moving frameを作る、曲率も出す
MovingFrame<-function(xs,n=NULL){
	if(is.null(n)){
		n<-length(xs[1,])
	}
	Es<-array(0,c(n,length(xs[,1]),length(xs[1,])))
	Cs<-matrix(0,n,length(xs[,1]))
	Es[1,,]<-(xs)/sqrt(apply(xs^2,1,sum))
	current<-xs
	for(i in 2:n){
		tmp<-apply(current,2,diff)
		current<-tmp
		for(j in 1:length(tmp[,1])){
			tmpout<-PerpendicVector(Es[i-1,j,],tmp[j,])
			Es[i,j,]<-tmpout$vector
			Cs[i-1,j]<-tmpout$cos
		}
	}
	list(Es=Es,Cs=Cs)
}
  • Rdファイル
\name{MovingFrame}
\alias{MovingFrame}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
MovingFrame
}
\description{
ベクトルの変化を収めた行列から動標構を作る。
列数mの行列の第1〜第n列(m>n)部分のみの処理も可能。
}
\usage{
MovingFrame(xs,n)
}
%- maybe also 'usage' for other objects documented here.
\details{
%%  ~~ If necessary, more details than the description above ~~
}
\value{
\item{Es}{動標構Moving frameの単位ベクトルを束ねた行列}
\item{Cs}{入力データのMoving frameベクトル成分の、直前のMoving frameベクトル方向に対する余弦。0なら変化分は「直交」であり、1なら、変化分がない}
}
\references{
%% ~put references to the literature/web site here ~
}
\author{
%%  ~~who you are~~
}
\note{
%%  ~~further notes~~
}

%% ~Make other sections like Warning with \section{Warning }{....} ~

\seealso{
}
\examples{
# トーラスのRot
n<-4
Rot<-matrix(
c(0.003640657,0.02308859,0.05751062,-0.99807124,
0.542523942,-0.63809206,-0.54456963,-0.04416122,
 -0.062159929,0.61777600,-0.78327751,-0.03106943,
 0.837729468,0.45897523,0.29430051,0.03063146),4,4,byrow=TRUE)
# シミュレーション
E.out<-eigen(Rot)
V<-E.out[[2]]
V2<-solve(V)
S<-diag(E.out[[1]])
Niter<-10000
xs<-matrix(0,Niter,n)
xs[1,]<-runif(n)
dt<-0.005
T<-runif(Niter-1)
T<-sort(T)
dhk<-NormalBase(n)
v<-dhk[1,]
for(i in 2:Niter){
	#xs[i,]<-xs[i-1,]+v*dt*T[i-1]
	xs[i,]<-xs[i-1,]+v*dt
	
	#dhk<-(V%*%S^(dt)%*%V2) %*% dhk
	dhk<-(V%*%diag(E.out[[1]]^(dt))%*%V2) %*% dhk
	# 単位ベクトル補正
	#ll<-apply(dhk^2,1,sum)
	#dhk<-((dhk)/sqrt(ll))
	v<-dhk[1,]
}
library(rgl)
plot3d(xs[,1],xs[,2],xs[,3],col=rainbow(Niter))
library(gtools)
co<-combinations(n,3)
for(i in 1:length(co[,1])){
	open3d()
	plot3d(xs[,co[i,1]],xs[,co[i,2]],xs[,co[i,3]],col=rainbow(Niter))

}
matplot(xs,type="l")
xs<-Re(xs)
vs<-apply(xs,2,diff)
Es<-MovingFrame(vs)
matplot(t(Es[[2]]),type="l")
plot(as.data.frame(t(Es[[2]])))
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ ~kwd1 }
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line