please complete in mathlab 1- Create an array x of size 1 x 3 consisting of rand
ID: 3752967 • Letter: P
Question
please complete in mathlab
1- Create an array x of size 1 x 3 consisting of random integers. The integers should have values between 0 and 10. One way that you can do this is by using the function rand(1,3) to create an array of three random numbers with values between 0 and 1. Then, this array needs to be multiplied by 10. Finally, you can use the function round() to change all three numbers to integers. Repeat the above process to create an array y of size 1x 3, an array z of size 1x 4, and an array q of size 2 × 1. All these arrays should consist of random integers between 0 and 10. Concatenate these four arrays, using one line of code, to create a single array w of size 3 x 4.Explanation / Answer
The following code answers the question. Please do rate the answer if it helped. thank you
x = round(rand(1, 3) * 10)
y = round(rand(1, 3) * 10)
z = round(rand(1, 4) * 10)
q = round(rand(2, 1) * 10)
w = [[x; y] q; z]
output
========
x =
0 7 3
y =
8 3 6
z =
5 4 8 9
q =
4
3
w =
0 7 3 4
8 3 6 3
5 4 8 9
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.