rotm {cwhmath}R Documentation

Rotation matrix

Description

Generate a (square) rotation matrix.

Usage

rotm(n,x,y,phi)

Arguments

n Order of the square matrix.
x,y Integers describing the plane of rotation.
phi Angle (counted counter clockwise) of rotation of coordinate system.

Value

Matrix to use for pre-multiplying.

Author(s)

Christian W. Hoffmann, christian.hoffmann@wsl.ch,
http://www.wsl.ch/staff/christian.hoffmann

Examples

  par (mfrow=c(2,2))
  Data <- rbind(rnorm(100)*100,rnorm(100)*40,rnorm(100)*5,rnorm(100)*1,rnorm(100)*0.01)
  Rotdata <- rotm(dim(Data)[1],1,2,pi/3) 
  Rotdata2 <- rotm(dim(Data)[1],2,4,pi/5) 
  plot(Data[1,],Data[2,])
  plot(Rotdata[1,],Rotdata[2,],col="red")
  points(Rotdata2[1,],Rotdata2[2,],col="blue")
  plot(Rotdata2[2,],Rotdata2[3,],col="red")
  plot(Rotdata2[4,],Rotdata2[3,],col="red")

[Package cwhmath version 1.0.3 Index]