1) Write a script that receives a random positive integer number ? and prints the matrix ? , which is a diagonal ? × ? matrix, with the following pattern: Example: ? = 2 ? ? = ?

MENG-201

1) Write a script that receives a random positive integer number ? and prints the
matrix ? , which is a diagonal ? × ? matrix, with the following pattern:
Example: ? = 2 ? ? = ?
?2 + 1 0
0 ?3 + 2
?
? = 3 ? ? = ?
?2 + 1 0 0
0 ?3 + 2 0
0 0 ?4 + 3
?
? = 4 ? ? =
?2 + 1 0 0 0
0 ?3 + 2 0 0
0
0
0
0
?4 + 3
0
0
?5 + 4

2) Write a script that receives a random row matrix called A, if the number of elements
of the matrix is even (1 × 2? matrix) it picks elements in pairs and divides the evenly
placed element of a pair by the oddly placed element of that pair, and prints the
answers in a 1 × ? matrix called B, and if the number of the elements in the received
matrix is odd, it should print the error message as: “This operation is not possible!”
Example: A=[1, 4, 7]
Output: “The operation is not possible”
A=[1, 4, 7, 17.5, -2, 14]
Output: B=[
4
1 ,
17.5
7 ,
14
-2
]
A=[-18 ,5.5 , 3.12 , 17.8 ,16 , -1, 12 ,12]
Output: B=[
5.5
-18 ,
17.8
3.12 ,
-1
16 ,
12
12]
Note: For simplicity assume the oddly placed elements cannot be zero
3) Write down the script for plotting the function ? = 6 ln(?) – 7?-0.2? over the
interval 1 = ? = 3 , and then label the axis accordingly. Suppose ? is representing the
velocity of a cart with respect to time.
4) Write a script that receives a random ? × ? matrix, and creates a new row matrix that
lists all the even elements of the input (assume your input has at least one even value)

Order from us and get better grades. We are the service you have been looking for.