cladelpino
cladelpino

Reputation: 338

Right Divison of a Vector in MatLab

Given a and b vectors:

a=[1;0;0];
b=[0;1;0];

What is the meaning of:

C=a/b

I understand "/" (Matrix Right Division) should be equivalent to

C=a*inv(b)

But of course, a vector doesn't have a "nicely" defined inverse.

Upvotes: 1

Views: 43

Answers (1)

gnovice
gnovice

Reputation: 125874

The relevant part of the documentation for mrdivide is the third bullet point. Given a system of linear equations x*A = b, then:

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.

In your example, you get the following:

>> a=[1;0;0];
>> b=[0;1;0];
>> C=a/b

C =

     0     1     0
     0     0     0
     0     0     0

And you can confirm that this is a solution for the system of equations C*b = a:

>> C*b

ans =

     1
     0
     0

Upvotes: 2

Related Questions