MATLAB - Division (Left, Right) of Matrics



You can divide two matrices using left (\) or right (/) division operators. Both the operand matrices must have the same number of rows and columns.

Example

Create a script file with the following code −

a = [ 1 2 3 ; 4 5 6; 7 8 9];
b = [ 7 5 6 ; 2 0 8; 5 7 1];
c = a / b
d = a \ b

When you run the file, it displays the following result −

c =

   -0.52542   0.68644   0.66102
   -0.42373   0.94068   1.01695
   -0.32203   1.19492   1.37288

d =

   -3.27778  -1.05556  -4.86111
   -0.11111   0.11111  -0.27778
   3.05556   1.27778   4.30556
matlab_matrics.htm
Advertisements