Anyone familar with matlab and how to write a script with ma

Anyone familar with matlab and how to write a script with matrixes

A=randi([

-

20, 20],

7, 4);

B=randi([

-

10,0],4);

C=randi(100,4);

verifies

the following mathematical relations

1)

A (B+ C) = A B+ A C

2)

A (B C)= (A B) C

3)

B + C= C+B

Show that the following relation is not true

B C = C

B

Solution

main.m

clc;
close all;
clear all;
A=randi([-20, 20],7, 4)
B=randi([-10,0],4)
C=randi(100,4)
x1=A*(B+ C)
x2= A*B+ A* C
if x1==x2
    disp(\'A (B+ C) = A B+ A C\')
end
y1=A*(B*C)
y2=(A*B)*C
if y1==y2
    disp(\'A (B C)= (A B) C\')
end
z1=B + C
z2= C+B
if z1==z2
    disp(\'B + C= C+B\')
end
w1=B*C
w2=C*B
if w1==w2
    disp(\'B C = C B\')
else
    disp(\'following relation is not true B C = C B\')
end

Output:

A =

   -18    13    12    -4
     7     9    -2    14
   -19   -14    -3    12
   -18     7    13   -18
     1     1   -17    -4
   -17    19   -15     1
    13     6   -13    -3


B =

    -3   -10    -6     0
    -4     0    -8     0
    -7    -9    -5   -10
    -6    -9    -7    -2


C =

    27    42    67    18
    43    99    54    13
    55    31    70   100
    95    71    67    18


x1 =

         295         727          40         861
        1669        1939        1551         287
         -78       -1316       -1278        -602
       -1137        -713       -1011         649
       -1109        -491       -1238       -1563
        -298        1069       -1078       -1393
        -345         538          44        -906


x2 =

         295         727          40         861
        1669        1939        1551         287
         -78       -1316       -1278        -602
       -1137        -713       -1011         649
       -1109        -491       -1238       -1563
        -298        1069       -1078       -1393
        -345         538          44        -906

A (B+ C) = A B+ A C

y1 =

       -9102        -564       -7518       -4456
      -22953      -29786      -32797      -24944
       15566       18688       21432       18341
        8121       20910       16643       13307
       33724       39140       37634       17879
       29776       43478       32118        9644
       12564       11734       10150        -542


y2 =

       -9102        -564       -7518       -4456
      -22953      -29786      -32797      -24944
       15566       18688       21432       18341
        8121       20910       16643       13307
       33724       39140       37634       17879
       29776       43478       32118        9644
       12564       11734       10150        -542

A (B C)= (A B) C

z1 =

    24    32    61    18
    39    99    46    13
    48    22    65    90
    89    62    60    16


z2 =

    24    32    61    18
    39    99    46    13
    48    22    65    90
    89    62    60    16

B + C= C+B

w1 =

        -841       -1302       -1161        -784
        -548        -416        -828        -872
       -1801       -2050       -1975        -923
       -1124       -1502       -1512        -961


w2 =

        -826       -1035        -959        -706
        -981       -1033       -1411        -566
       -1379       -2080       -1628        -900
       -1146       -1715       -1599        -706

following relation is not true B C = C B

Anyone familar with matlab and how to write a script with matrixes A=randi([ - 20, 20], 7, 4); B=randi([ - 10,0],4); C=randi(100,4); verifies the following math
Anyone familar with matlab and how to write a script with matrixes A=randi([ - 20, 20], 7, 4); B=randi([ - 10,0],4); C=randi(100,4); verifies the following math
Anyone familar with matlab and how to write a script with matrixes A=randi([ - 20, 20], 7, 4); B=randi([ - 10,0],4); C=randi(100,4); verifies the following math

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site