Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Logical Indexing and Vector Practice The provided file named HW 6 _ numbers . mat contains a vector A of unknown length with random integers

Logical Indexing and Vector Practice
The provided file named HW6_numbers . mat contains a vector A of unknown length with random integers in it. Modify the provided MATLAB script so that it
performs the operations listed below. Every task described below must use logical indexing. For your convenience, the tasks are also repeated in the comments of
the code.
Determine how many elements in A are equal to 4.
Determine how many numbers in A are divisible by 3.
Calculate the sum of all numbers in A that are greater than 45.
Calculate the mean value of the numbers in A that are less than 70.
Determine how many values in A are equal to the maximum value in A.
Create a new vector Even that contains only the even numbers in A.
Fill in the places in the code marked ... with code to accomplish the tasks. Hint: there may be a place or two where you find the mod function useful.
Script o.
% housekeeping commands would go here, but we leave them out to keep Grader happy
%bring in data from data file
...
%in one line, find how many elements of vector A are equal to 4
Num_of_4s =...
%in one line, find how many elements of vector A are divisible by 3
Div_by_3=...
%in one line, sum all of the elements of the vector A that are
%greater than 45.
Sum_Over_45=...
%in one line, find the mean value of all elements of the vector A that are
% less than 70.
Mean_Under_70=...
%in one line, find how many elements are equal to the maximum value in the
%vector A
Number_at_Max =...
%in one line, create a new vector with all the even-valued elements in A
Even =dots.
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Building The Data Lakehouse

Authors: Bill Inmon ,Mary Levins ,Ranjeet Srivastava

1st Edition

1634629663, 978-1634629669

More Books

Students also viewed these Databases questions

Question

=+5. What is the budget process?

Answered: 1 week ago

Question

6. Write a job specification.

Answered: 1 week ago

Question

1. Identify three approaches to culture.

Answered: 1 week ago

Question

2. Define communication.

Answered: 1 week ago