Learn R Programming

matlib (version 0.6.0)

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 = 0.5, labels = FALSE, solution = TRUE)

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)

Value

  • nothing; used for the side effect of making a plot

Examples

Run this code
# 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 DataLab