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

Using Matlab 1. In a single instruction, change all values from the diagonal of

ID: 3877537 • Letter: U

Question

Using Matlab

1. In a single instruction, change all values from the diagonal of a square matrix to zero.
2. In a single instruction, replace all the values of the diagonal of a square matrix with the elements of a given vector.
3. Sort the elements of a matrix from minor to major while maintaining its shape (indication: use the reshape command.
14
4. In a single instruction, reset all the negative elements of a matrix.
5. In a single instruction, reset all the elements of a matrix that is in between
-1 and 1. (The logical conjuntion is &).
6. In three different ways (each in a single instruction), find out the number of ele-
of a matrix, so that in the end we have a number.

Explanation / Answer

According to chegg guidelines, only first 4 parts are required to be answered.

1.

b = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16]

2.

b = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16]

3.

b = [90 0 100 4; 5 6 70 8; 9 10 50 12; 1 14 15 20]

4.

b = [-90 10 100 -4; 5 6 -70 8; 9 -11 -50 12; -1 -14 15 20]

b(b<0)=0

Sample Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote