division of two vectors
67 views (last 30 days)
Show older comments
What is the result of A/B ???? (if A and B are same 3x1 row vectors) Example:
A=[-1;1;7]
B=[5;7;-2]
A/B
in Matlab gives: ans =
0 -0.1429 0
0 0.1429 0
0 1.0000 0
5 Comments
Guillaume
on 9 Oct 2017
Edited: Guillaume
on 9 Oct 2017
"we can't divide two vectors". Well, obviously you can apply the / operators to two vectors since matlab give you a result.
As Adam said in his comment and as Jan showed in its answer, what it does is fully documented. It solves a system of linear equation. If the right-hand side is not a square matrix as is the case here, it is solved using least-square method. As documented:
If A is a rectangular m-by-n matrix with m ~= n, and B is a matrix with n columns, then x = B/A returns a least-squares solution of the system of equations x*A = B
I'm not sure what other answer you are looking for.
Accepted Answer
Jan
on 9 Oct 2017
C = A / B determines the matrix C such that:
C * B = A
Try it:
A = [-1;1;7];
B = [5;7;-2];
C = A / B;
C * B
>> [-1; 1; 7]
0 Comments
More Answers (2)
John D'Errico
on 9 Oct 2017
A=[-1;1;7];
B=[5;7;-2];
First of all, A and B are NOT row vectors. They are column vectors. Thus, A is a vector in column orientation.
A
A =
-1
1
7
Next, what is C=A/B?
C = A/B
C =
0 -0.142857142857143 0
0 0.142857142857143 0
0 1 0
It is a matrix, such that if possible, we will have A=C*B.
C*B
ans =
-1
1
7
In some cases of vectors or matrices of varying sizes, that will not be possible.
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!