Answered step by step
Verified Expert Solution
Question
1 Approved Answer
As discussed in the class, the built - in MATLAB function randi can be used to generate an array of random integers with a specified
As discussed in the class, the builtin MATLAB function randi can be used to generate an array of
random integers with a specified range. For this question, create a vector vec that stores random
integers generated by the randi function, each in the range from to Then do each of the following
tasks with only a SINGLE MATLAB statement: Note: any conditional statements ifelse statement, for
and while loops are NOT allowed to use in this question.
a Create a variable newvec that stores all of the numbers that are multiplies of from the vector
vecHint: Consider the property of division and use help elfun to look for the proper
instruction
b Create a new array that contains only the positive integers from a
c Calculate the average in the array created in a without using the mean function
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started