[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 605
  • Last Modified:

dot calculation

Hi, experts

I am kind of confuse about the syntax in matlab below
p ./ numel(I) --> there is a dot after p
p / numel(I) --> no dot after p

what is the difference between those two? I try couple different p matrix, but I don't see the different in answer.
0
rmtogether
Asked:
rmtogether
  • 2
1 Solution
 
MacroLandCommented:
if there is dot between two like A./B then matlab divides the two matrices by their entries like A(i,j)/B(i,j)

if there is no dot between A/B  then matlab takes the inverse of B which is equivalent to A*inv(B)

Regards,
0
 
MacroLandCommented:
Example;

A=[10 12;6 3]

A =

    10    12
     6     3

>> B=[2 4;3 1]

B =

     2     4
     3     1

>> C=A./B

C =

     5(=10/2)     3(=12/4)  
     2     3

D=A/B

D =

    2.6000    1.6000
    0.3000    1.8000

>> D=A*inv(B)

D =

    2.6000    1.6000
    0.3000    1.8000

Regards,
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now