Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 5: Perform the following exercises. a) Create a 5 x 5 matrix p5a with a

ID: 3595850 • Letter: P

Question

Problem 5: Perform the following exercises. a) Create a 5 x 5 matrix p5a with a value of 0 for every element b) Copy the matrix in part a into a new matrix p5b. Modify the matrix p5b such that all elements on the second column have a value of 1. c) Transpose the matrix in part (b) and put the answer in p5c d) Rotate the matrix in part (b) 90 counterclockwise 3 times and put the answer in p5d. e) Are the matrices in part (c) and (d) the same? Put the answer in p5e. Do not use function isequal for this problem Problem 6: Explore different ways to solve a linear system of equations by typing help inv and help in command window, and then perform the following exercises. a) Create a 3 x 3 matrix A with the following values and set p6a=A. 1 5 6 A 8 34 7 2 9 b) Create a 3-element column vector b with values of 7.2 and 5. Set p6b=b. c) Using operator, solve the system of equations Ax=b for x. Set p6x. d) Using function inv, solve the systern of equations Ax=b for x. Set p6d=x. e) Is the answer in part (c) and part (d) the same? Put the answer in p6e. Hint: Check by setting te eual. f) Compute the difference between part (c) and (d) and put the answer in p6f.

Explanation / Answer

*******************************************************************************
According to Chegg guidelines, posting multiple questions is not allowed.
I have answered 4 parts of the question as per the guidelines.
Kindly find the code below.
The outputs have also been provided.
*******************************************************************************


*******************************************************************************
Code:


printf('p5a 5X5 matrix all elements 0 ');
p5a = [ 0 0 0 0 0; 0 0 0 0 0; 0 0 0 0 0; 0 0 0 0 0; 0 0 0 0 0]
printf('p5b 5X5 matrix all elements same as p5a ');
p5b = p5a
printf('p5b 5X5 matrix 2nd column all elements are 1 ');
p5b(:,2)=1;
p5b
printf('p5c 5X5 matrix transpose of p5b ');
p5c=p5b'
printf('Rotating p5b by 90 degree counterclockwise ');
p5b=rot90(p5b)
printf('Rotating p5b by 90 degree counterclockwise ');
p5b=rot90(p5b)
printf('Rotating p5b by 90 degree counterclockwise ');
p5b=rot90(p5b)
printf('Matrix p5d Rotating p5b by 90 degree counterclockwise 3 times ');
p5d=p5b

*******************************************************************************


*******************************************************************************
Sample Input/Output:

p5a 5X5 matrix all elements 0
p5a =

   0   0   0   0   0
   0   0   0   0   0
   0   0   0   0   0
   0   0   0   0   0
   0   0   0   0   0

p5b 5X5 matrix all elements same as p5a
p5b =

   0   0   0   0   0
   0   0   0   0   0
   0   0   0   0   0
   0   0   0   0   0
   0   0   0   0   0

p5b 5X5 matrix 2nd column all elements are 1
p5b =

   0   1   0   0   0
   0   1   0   0   0
   0   1   0   0   0
   0   1   0   0   0
   0   1   0   0   0

p5c 5X5 matrix transpose of p5b
p5c =

   0   0   0   0   0
   1   1   1   1   1
   0   0   0   0   0
   0   0   0   0   0
   0   0   0   0   0

Rotating p5b by 90 degree counterclockwise
p5b =

   0   0   0   0   0
   0   0   0   0   0
   0   0   0   0   0
   1   1   1   1   1
   0   0   0   0   0

Rotating p5b by 90 degree counterclockwise
p5b =

   0   0   0   1   0
   0   0   0   1   0
   0   0   0   1   0
   0   0   0   1   0
   0   0   0   1   0

Rotating p5b by 90 degree counterclockwise
p5b =

   0   0   0   0   0
   1   1   1   1   1
   0   0   0   0   0
   0   0   0   0   0
   0   0   0   0   0

Matrix p5d Rotating p5b by 90 degree counterclockwise 3 times
p5d =

   0   0   0   0   0
   1   1   1   1   1
   0   0   0   0   0
   0   0   0   0   0
   0   0   0   0   0
*******************************************************************************


*******************************************************************************
I hope this helps you.
If you find my answer helpful,
Kindly rate the answer.
All the best :)
*******************************************************************************