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 in matlab

Subject: vector division in matlab

From: rauf butt

Date: 6 Jun, 2005 06:57:02

Message: 1 of 6

i have the following problem with vector division in matlab
a=[1 2 3];
b=[4 5 6];
a/b
matlab gives
ans=
0.4156
how does matlab calculates this ?
if a and b are vectors

Subject: vector division in matlab

From: Ben Michell

Date: 6 Jun, 2005 07:00:59

Message: 2 of 6

rauf butt wrote:
>
>
> i have the following problem with vector division in matlab
> a=[1 2 3];
> b=[4 5 6];
> a/b
> matlab gives
> ans=
> 0.4156
> how does matlab calculates this ?
> if a and b are vectors

Using the / operator implicitly performs a matrix division. Using
your example typing a./b gives:

ans =

    0.2500 0.4000 0.5000

Which is what I suspect you were after.

Ben Michell
Dunlop Motorsport

Subject: vector division in matlab

From: rauf butt

Date: 6 Jun, 2005 07:21:47

Message: 3 of 6

Ben Michell wrote:
>
>
> rauf butt wrote:
>>
>>
>> i have the following problem with vector division in matlab
>> a=[1 2 3];
>> b=[4 5 6];
>> a/b
>> matlab gives
>> ans=
>> 0.4156
>> how does matlab calculates this ?
>> if a and b are vectors
>
> Using the / operator implicitly performs a matrix division. Using
> your example typing a./b gives:
>
> ans =
>
> 0.2500 0.4000 0.5000
>
> Which is what I suspect you were after.
>
> Ben Michell
> Dunlop Motorsport

i am rephrasing the query....
i have defined two vectors in matlab
when i divide these two, matlab provides an unusual answer
that is
a=[1 2 3];
b=[4 5 6];
c=a/b
the answer is 0.4156
how matlab calculated this answer?
i am actually trying to divide two vectors not two matrices.
note that i am not trying a./b which is array division
but i am trying to divide two vectors using matrix division

Subject: vector division in matlab

From: tpl@eng.cam.ac.uk (Tim Love)

Date: 6 Jun, 2005 11:28:08

Message: 4 of 6

"rauf butt" <engraufbutt@yahoo.com> writes:

>i am rephrasing the query....
I still don't understand the issue, but if you type
  help slash
you might get some useful information.

Subject: vector division in matlab

From: Titus Edelhofer

Date: 6 Jun, 2005 13:41:48

Message: 5 of 6


Hi

for a square matrix b the term a/b is equivalent (mathematically, not
numerically!) to a * inv(b).
Since b can not be inverted (vector, no matrix), one possibility to
generalize is e.g. the pseudoinverse:
pinv(b) = [0.0519;0.0649; 0.0779] as one possible "inverse",
since b*pinv(b) = 1.0. Of course there are many other choices, since we have
an underdetermined
system (b1*c1+b2*c2+b3*c3=1.0 has lots of choices for vector c!).

a*pinv(b) = 0.4156, so the same as you get with a/b.

Titus

"rauf butt" <engraufbutt@yahoo.com> schrieb im Newsbeitrag
news:ef097af.1@webx.raydaftYaTP...
> Ben Michell wrote:
>>
>>
>> rauf butt wrote:
>>>
>>>
>>> i have the following problem with vector division in matlab
>>> a=[1 2 3];
>>> b=[4 5 6];
>>> a/b
>>> matlab gives
>>> ans=
>>> 0.4156
>>> how does matlab calculates this ?
>>> if a and b are vectors
>>
>> Using the / operator implicitly performs a matrix division. Using
>> your example typing a./b gives:
>>
>> ans =
>>
>> 0.2500 0.4000 0.5000
>>
>> Which is what I suspect you were after.
>>
>> Ben Michell
>> Dunlop Motorsport
>
> i am rephrasing the query....
> i have defined two vectors in matlab
> when i divide these two, matlab provides an unusual answer
> that is
> a=[1 2 3];
> b=[4 5 6];
> c=a/b
> the answer is 0.4156
> how matlab calculated this answer?
> i am actually trying to divide two vectors not two matrices.
> note that i am not trying a./b which is array division
> but i am trying to divide two vectors using matrix division

Subject: vector division in matlab

From: rauf

Date: 7 Jun, 2005 04:25:49

Message: 6 of 6

hi
titus
thank you for your concern
it helped a lot to make my concepts clear

Titus Edelhofer wrote:
>
>
>
> Hi
>
> for a square matrix b the term a/b is equivalent (mathematically,
> not
> numerically!) to a * inv(b).
> Since b can not be inverted (vector, no matrix), one possibility to
>
> generalize is e.g. the pseudoinverse:
> pinv(b) = [0.0519;0.0649; 0.0779] as one possible "inverse",
> since b*pinv(b) = 1.0. Of course there are many other choices,
> since we have
> an underdetermined
> system (b1*c1+b2*c2+b3*c3=1.0 has lots of choices for vector c!).
>
> a*pinv(b) = 0.4156, so the same as you get with a/b.
>
> Titus
>
> "rauf butt" <engraufbutt@yahoo.com> schrieb im Newsbeitrag
> news:ef097af.1@webx.raydaftYaTP...
>> Ben Michell wrote:
>>>
>>>
>>> rauf butt wrote:
>>>>
>>>>
>>>> i have the following problem with vector division in
matlab
>>>> a=[1 2 3];
>>>> b=[4 5 6];
>>>> a/b
>>>> matlab gives
>>>> ans=
>>>> 0.4156
>>>> how does matlab calculates this ?
>>>> if a and b are vectors
>>>
>>> Using the / operator implicitly performs a matrix division.
> Using
>>> your example typing a./b gives:
>>>
>>> ans =
>>>
>>> 0.2500 0.4000 0.5000
>>>
>>> Which is what I suspect you were after.
>>>
>>> Ben Michell
>>> Dunlop Motorsport
>>
>> i am rephrasing the query....
>> i have defined two vectors in matlab
>> when i divide these two, matlab provides an unusual answer
>> that is
>> a=[1 2 3];
>> b=[4 5 6];
>> c=a/b
>> the answer is 0.4156
>> how matlab calculated this answer?
>> i am actually trying to divide two vectors not two matrices.
>> note that i am not trying a./b which is array division
>> but i am trying to divide two vectors using matrix division
>
>
>

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