Answered step by step
Verified Expert Solution
Link Copied!

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 built-in 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 20 random
integers generated by the randi function, each in the range from -20 to 50. Then do each of the following
tasks with only a SINGLE MATLAB statement: (Note: any conditional statements (if-else statement, for
and while loops) are NOT allowed to use in this question.).
a. Create a variable new_vec that stores all of the numbers that are multiplies of 4 from the vector
vec.(Hint: 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

Identify the depressants, and describe their effects.

Answered: 1 week ago

Question

2. What type of team would you recommend?

Answered: 1 week ago

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago