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

Generate two vectors (A and B) containing 100 randomly generated integer numbers

ID: 3620971 • Letter: G

Question


Generate two vectors (A and B) containing 100 randomly generated integer numbers from 0 to 10. Start the random number generation from state 0. That is use rand('state',0) before you start generating random numbers. Compute the following:

*The number of times the sum of A and B are greater than 10.
*The number of times the elements in A are less than corresponding elements in B.

Explanation / Answer

rand('state',0) A=ceil(10*rand(1,100)); B=ceil(10*rand(1,100)); %%*The number of times the sum of A and B are greater than 10. C=(A+B)>10; numberOfTimes=sum(C); fprintf('The number of times the sum of A and B are greater than 10 = %3.0f ',numberOfTimes) %%*The number of times the elements in A are less than corresponding elements in B. D=A
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