4. Create a random vector by the following command (you do not need to understand the command) Data=reshape((randi(95,24)),576,1); This vector contains integers, (a lot of them – so don't count). a. Write a script that will find how many of those integers in the vector Data are divisible by 2. b. Then also create a histogram for the following bin sizes: 0-15 15-30 30-45 45-60 60-75 75-90 90 and above. (for loop and if statements required)

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 24SA
icon
Related questions
Question

The code must be in Matlab

**Exercise 4: Vector Creation and Analysis**

**Objective:** Create and analyze a random vector using the given commands and instructions.

Create a random vector using the following command (understanding the command is not necessary):

```matlab
Data=reshape((randi(95,24)),576,1);
```

**Instructions:**

- The vector contains a large number of integers, so manual counting is not feasible.

  **a.** Write a script to determine how many integers in the vector `Data` are divisible by 2.

  **b.** Create a histogram with the specified bin sizes:
  - 0-15
  - 15-30
  - 30-45
  - 45-60
  - 60-75
  - 75-90
  - 90 and above

  Utilize `for` loops and `if` statements to achieve the solution.
Transcribed Image Text:**Exercise 4: Vector Creation and Analysis** **Objective:** Create and analyze a random vector using the given commands and instructions. Create a random vector using the following command (understanding the command is not necessary): ```matlab Data=reshape((randi(95,24)),576,1); ``` **Instructions:** - The vector contains a large number of integers, so manual counting is not feasible. **a.** Write a script to determine how many integers in the vector `Data` are divisible by 2. **b.** Create a histogram with the specified bin sizes: - 0-15 - 15-30 - 30-45 - 45-60 - 60-75 - 75-90 - 90 and above Utilize `for` loops and `if` statements to achieve the solution.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Fundamentals of Boolean Algebra and Digital Logics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning