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

Create a matrix \'A\' (size 100 x 100) of random numbers ranging from 0 to 10. C

ID: 3079321 • Letter: C

Question

Create a matrix 'A' (size 100 x 100) of random numbers ranging from 0 to 10. Create 2 new matrices 'A_e' and 'A_o'(both size 50 x 100), one made from the even numbered rows of A, and the other made from the odd numbered rows of A. Thus: A = [ Row 1 A_e = [ Row 2 A_o = [ Row 1 Row 2 Row 4 Row 3 Row 3 Row 6 Row 5 . . . . . . . . . Row 100] Row 100] Row 99] Create a variable S_e equal to the number of values in A_e which are greater than 9. Create a second variable S_o equal to the number of values in A_o greater than 9.

Explanation / Answer

% first note that the command rand(n,m) creates a random matrix drawn from (0, 1) % just multiply that matrix by 10. A = 10*rand(100, 100); Ae = A(2:2:100, :); % even rows Ao = A(1:2:99, :); % odd rows xe = Ae(:); % smoosh into a vector xo = Ao(:); % smoosh into a vector % now do the counting Se = sum( (xe>9) ) So = sum( (xo>9) )

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