Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A vector is given by x = [8 25 60 46 6 18 13 20 72 27 10 59 33). Using conditional statements and loop(s),

image text in transcribed

A vector is given by x = [8 25 60 46 6 18 13 20 72 27 10 59 33). Using conditional statements and loop(s), write the code for a program that: a) counts the number of elements in vector x that have values between 14 and 42 and creates a new vector "y" that contains only the elements of x in that specified range. b) sums the values of those elements of x that are lower than 26. c) creates a vector of 7 ranges between 5 and 75, counts the number of elements in vector x that fall in each range, and assigns each count obtained above to each element of a new vector z" made also of 7 elements. Use nested loops here. Do not use the Matlab functions find" or "sum. The program should work for any vector and vector size in case vector "x" is changed

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

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

2. Show that tr (al) = na where I is the n x n identity matrix.

Answered: 1 week ago

Question

Why did Hostess Brands Inc. go into bankruptcy?

Answered: 1 week ago