matlib (version 0.9.1)

plotEqn3d: Plot Linear Equations in 3D

Description

Shows what matrices \(A, b\) look like as the system of linear equations, \(A x = b\) with three unknowns, x1, x2, and x3, by plotting a plane for each equation.

Usage

plotEqn3d(A, b, vars, xlim = c(-2, 2), ylim = c(-2, 2), zlim,
  col = 2:(nrow(A) + 1), alpha = 1, labels = FALSE, solution = TRUE,
  axes = TRUE, lit = FALSE)

Arguments

A

either the matrix of coefficients of a system of linear equations, or the matrix cbind(A,b) The A matrix must have three columns.

b

if supplied, the vector of constants on the right hand side of the equations, of length matching the number of rows of A.

vars

a numeric or character vector of names of the variables. If supplied, the length must be equal to the number of unknowns in the equations. The default is paste0("x", 1:ncol(A).

xlim

axis limits for the first variable

ylim

axis limits for the second variable

zlim

horizontal axis limits for the second variable; if missing, zlim is calculated from the range of the set of equations over the xlim and ylim

col

scalar or vector of colors for the lines, recycled as necessary

alpha

transparency applied to each plane

labels

logical, or a vector of character labels for the equations; not yet implemented.

solution

logical; should the solution point for all equations be marked (if possible)

axes

logical; whether to frame the plot with coordinate axes

lit

logical, specifying if lighting calculation should take place on geometry; see rgl.material

Value

nothing; used for the side effect of making a plot

References

Fox, J. and Friendly, M. (2016). "Visualizing Simultaneous Linear Equations, Geometric Vectors, and Least-Squares Regression with the matlib Package for R". useR Conference, Stanford, CA, June 27 - June 30, 2016.

Examples

Run this code
# NOT RUN {
# three consistent equations in three unknowns
A <- matrix(c(13, -4, 2, -4, 11, -2, 2, -2, 8), 3,3)
b <- c(1,2,4)
plotEqn3d(A,b)
# }

Run the code above in your browser using DataCamp Workspace