1
CIEG 675 IN CLASS EXERCISE ON MATH OPERATORS Define two 3x3 matrices that have 1 through 9 as entries in the first and 9 to 1 as entries in the second. Call them A and B A=[1 2 3’ 4 5 6; 7 8 9]; B=[9 8 7; 6 5 4; 3 2 1]; Define a third 3x3 matrix, C, that consists of all 7’s C=7*ones(3,3); Write the command to develop a variable D that adds 5 to matrix C and then divides that element-wise into the product of A and B D=(A+B)./(5+C);

CIEG 675 IN CLASS EXERCISE ON MATH OPERATORS

Embed Size (px)

DESCRIPTION

CIEG 675 IN CLASS EXERCISE ON MATH OPERATORS. Define two 3x3 matrices that have 1 through 9 as entries in the first and 9 to 1 as entries in the second. Call them A and B A=[1 2 3’ 4 5 6; 7 8 9]; B=[9 8 7; 6 5 4; 3 2 1]; Define a third 3x3 matrix, C, that consists of all 7’s - PowerPoint PPT Presentation

Citation preview

Page 1: CIEG 675     IN CLASS EXERCISE ON MATH OPERATORS

CIEG 675 IN CLASS EXERCISE ON MATH OPERATORS

Define two 3x3 matrices that have 1 through 9 as entries in the first and 9 to 1 as entries in the second. Call them A and B

A=[1 2 3’ 4 5 6; 7 8 9];B=[9 8 7; 6 5 4; 3 2 1];

Define a third 3x3 matrix, C, that consists of all 7’s

C=7*ones(3,3);

Write the command to develop a variable D that adds 5 to matrix C and then divides that element-wise into the product of A and B

D=(A+B)./(5+C);