MATLAB Answers

0

Plot a single vector as a line

Asked by Anthony Mason on 26 Jun 2019
Latest activity Commented on by infinity
on 26 Jun 2019
How would you plot a 3 dimensional vector as a single line? I need to plot the null space of a matrix and having trouble finding the correct way to create the graph. Matrix is : [1,3,11;4,2,14;-2,-2,-10] , and the Null space is the vector [-2;-3;1]. It should just be a line because I am also plotting the column space of the matrix which is a plane. Any help would be greatly appreciated.

  3 Comments

infinity
on 26 Jun 2019
Hello,
What do you mean "the Null space is the vector [-2;-3;1]. It should just be a line ...." ?
To get a line, at least we need to know 2 points.
I meant that the graph was the Null space of the matrix. That is the vector when I set the free variable x3 to 1. It can be set to 0, 2, 3 , etc. Sorry for not specifying. I was saying that this graph should be a line because when graphing the column space of the matrix it should be a plane because it covers the span of all linear combinations of Ax = b. Is this not correct? I thought that column space was a plane when graphed and null space was a line.
infinity
on 26 Jun 2019
Hello,
Here you can see an example in 2D, the column space and null space are draw.
I think in your case (3D), you can plot as a answer below.

Sign in to comment.

Products


Release

R2018b

1 Answer

Answer by Vismay Raj on 26 Jun 2019
 Accepted Answer

assuming that you want to draw a vector starting from (0,0,0) and to the specified point the following code can be used
v = [-2;-3;-1] % or any vector that you've obtained
t = linspace(0,1,100)
e = v*t
plot3(e(:,1),e(:,2),e(:,3))

  0 Comments

Sign in to comment.