Skip to contents

This function draws an rgl scene consisting of a representation of the identity matrix and a 3 x 3 matrix A, together with the corresponding representation of the matrices U, D, and V in the SVD decomposition, A = U D V'.

Usage

svdDemo(A, shape = c("cube", "sphere"), alpha = 0.7, col = rainbow(6))

Arguments

A

A 3 x 3 numeric matrix

shape

Basic shape used to represent the identity matrix: "cube" or "sphere"

alpha

transparency value used to draw the shape

col

Vector of 6 colors for the faces of the basic cube

Value

Nothing

Author

Original idea from Duncan Murdoch

Examples

A <- matrix(c(1,2,0.1, 0.1,1,0.1, 0.1,0.1,0.5), 3,3)
svdDemo(A)



if (FALSE) { # \dontrun{
B <- matrix(c( 1, 0, 1, 0, 2, 0,  1, 0, 2), 3, 3)
svdDemo(B)

# a positive, semi-definite matrix with eigenvalues 12, 6, 0
C <- matrix(c(7, 4, 1,  4, 4, 4,  1, 4, 7), 3, 3)
svdDemo(C)
} # }