Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please complete Part C using nested for loops . A vector is given by x = [8 25 60 46 6 18 13 20 72

Please complete Part C using nested for loops.

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

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

Students also viewed these Databases questions