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:
division question

Subject: division question

From: ravi

Date: 14 Oct, 2010 00:42:03

Message: 1 of 5

Hello,

Im trying to divide A and B :

A =

        2.059 51
            2 2
           55 3.3273
            2 2
           55 3.3273
        2.059 51



B =

       51.042
       2.8284
       55.101
       2.8284
       55.101
       51.042

I want to divide the rows of A by the rows in B. When I do a simple division such as A./B , dimension problems occur. However, if I take the first rows of A and B as an example I get a solution, i.e.

[2.059 51] ./ 51.042

Can someone please suggest how can i do this for the entire matrices.

thanks

Subject: division question

From: Matt Fig

Date: 14 Oct, 2010 00:53:03

Message: 2 of 5

Have a look at BSXFUN.

Subject: division question

From: ravi

Date: 14 Oct, 2010 01:05:05

Message: 3 of 5

thanks matt

Subject: division question

From: ravi

Date: 14 Oct, 2010 01:18:03

Message: 4 of 5

Matt,

i got 2 matrices:

norm_a =

      0.04034 0.99919
      0.70711 0.70711
      0.99818 0.060386
      0.70711 0.70711
      0.99818 0.060386
      0.04034 0.99919


norm_b =

      0.99818 0.060386
      0.99818 0.060386
      0.04034 0.99919
      0.04034 0.99919
      0.70711 0.70711
      0.70711 0.70711


So I trying to do a dot product for each corresponding row in the 2 matrices.
In the help doc , since 'dot' is a function M-file, I was hoping it would work as follows:

 dotproduct = bsxfun(@dot,norm_a , norm_b)

But this doesnt seem to be the case. Can you share some info on this.

thanks again

Subject: division question

From: Oleg Komarov

Date: 14 Oct, 2010 02:07:03

Message: 5 of 5

"ravi " <ravi_071@hotmail.com> wrote in message <i95lob$kag$1@fred.mathworks.com>...
> Matt,
>
> i got 2 matrices:
>
> norm_a =
>
> 0.04034 0.99919
> 0.70711 0.70711
> 0.99818 0.060386
> 0.70711 0.70711
> 0.99818 0.060386
> 0.04034 0.99919
>
>
> norm_b =
>
> 0.99818 0.060386
> 0.99818 0.060386
> 0.04034 0.99919
> 0.04034 0.99919
> 0.70711 0.70711
> 0.70711 0.70711
>
>
> So I trying to do a dot product for each corresponding row in the 2 matrices.
> In the help doc , since 'dot' is a function M-file, I was hoping it would work as follows:
>
> dotproduct = bsxfun(@dot,norm_a , norm_b)
>
> But this doesnt seem to be the case. Can you share some info on this.
>
> thanks again

If you have two matrices and tehir dimensions are equal just use the dot operators:
.* ./

Oleg

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