Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
vector division

Subject: vector division

From: canxenxo

Date: 14 Feb, 2009 11:19:02

Message: 1 of 7

If you have two vectors, p.e. a=[1 2] and b=[3 4], and you divide them in the way a/b, you get ans = 0.4400. They are not divided element by element so, which operation is done?

Thanks in advanced!

Subject: vector division

From: dpb

Date: 14 Feb, 2009 14:52:50

Message: 2 of 7

canxenxo wrote:
> If you have two vectors, p.e. a=[1 2] and b=[3 4], and you divide
> them in the way a/b, you get ans = 0.4400. They are not divided
> element by element so, which operation is done?

While it isn't particularly easy to find from command line ("doc /" goes
nowhere :( ), try

doc mrdivide

--

Subject: vector division

From: canxenxo

Date: 14 Feb, 2009 17:50:02

Message: 3 of 7

dpb <none@non.net> wrote in message <gn6lua$69t$1@aioe.org>...
> canxenxo wrote:
> > If you have two vectors, p.e. a=[1 2] and b=[3 4], and you divide
> > them in the way a/b, you get ans = 0.4400. They are not divided
> > element by element so, which operation is done?
>
> While it isn't particularly easy to find from command line ("doc /" goes
> nowhere :( ), try
>
> doc mrdivide
>
> --

Thank u dpb, but after reading the doc I'm still not sure about the "internal" operation which the command / does .... I think the operation is the division of the modulus of the two vectors. can somebody confirm it?

thanks another time!

Subject: vector division

From: Matt Fig

Date: 14 Feb, 2009 18:15:04

Message: 4 of 7

For

a = [1 2];
b = [3 4];

mrdivide solves the equation

b' x = a'

in the least squares sense. Thus for these values of a and b,

mrdivide(a,b) == mldivide(b',a')

is true.





`a1R^Y+^RV`p`Tfppp~]Zpw>SXjRgRRe_pYfS_eVpaRYw\6VVZ``TRJp]`e

Subject: vector division

From: Image Analyst

Date: 14 Feb, 2009 19:45:04

Message: 5 of 7

"canxenxo
Well like Matt said, and the MATLAB documentation for "/" says: "Slash or matrix right division. B/A is roughly the same as B*inv(A). More precisely, B/A = (A'\B')'. See the reference page for mrdivide for more information."
Here's a little code that may help you out.
clc;
clear all;
a = [1 2;3 4];
b = [13 4; 15 16];
abinv1 = a/b
binverse = inv(b) % Invert the matrix.
abinv2 = a * binverse % Same as abinv1

Subject: vector division

From: Roger Stafford

Date: 14 Feb, 2009 20:38:01

Message: 6 of 7

"Image Analyst" <imageanalyst@mailinator.com> wrote in message <gn7700$t03$1@fred.mathworks.com>...
> "canxenxo
> Well like Matt said, and the MATLAB documentation for "/" says: "Slash or matrix right division. B/A is roughly the same as B*inv(A). More precisely, B/A = (A'\B')'. See the reference page for mrdivide for more information."
> Here's a little code that may help you out.
> clc;
> clear all;
> a = [1 2;3 4];
> b = [13 4; 15 16];
> abinv1 = a/b
> binverse = inv(b) % Invert the matrix.
> abinv2 = a * binverse % Same as abinv1

  Well, only very roughly. The b in this case has no inverse and the two equations with one unknown are overdetermined, so as Matt said matlab resorts to finding the least squares solution instead.

Roger Stafford

Subject: vector division

From: canxenxo

Date: 16 Feb, 2009 09:30:03

Message: 7 of 7

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gn7a39$muo$1@fred.mathworks.com>...
> "Image Analyst" <imageanalyst@mailinator.com> wrote in message <gn7700$t03$1@fred.mathworks.com>...
> > "canxenxo
> > Well like Matt said, and the MATLAB documentation for "/" says: "Slash or matrix right division. B/A is roughly the same as B*inv(A). More precisely, B/A = (A'\B')'. See the reference page for mrdivide for more information."
> > Here's a little code that may help you out.
> > clc;
> > clear all;
> > a = [1 2;3 4];
> > b = [13 4; 15 16];
> > abinv1 = a/b
> > binverse = inv(b) % Invert the matrix.
> > abinv2 = a * binverse % Same as abinv1
>
> Well, only very roughly. The b in this case has no inverse and the two equations with one unknown are overdetermined, so as Matt said matlab resorts to finding the least squares solution instead.
>
> Roger Stafford

ok guys, thank very much for your support and time!

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us