Question: Code has already been provided to define a function named vectorFun that accepts a single input variable A that is a column vector of 1

Code has already been provided to define a function named vectorFun that accepts a single input variable A that is a column vector of 100 random numbers with values between -50 and 50. Add commands to do the following operations and assign the results to the indicated output variable names:
Generate a second column vector B that consists of only the negative numbers in A in the same order in which they occur in A.
Generate a third column vector C that consists of only the positive numbers in A but this time sorted in order from smallest to largest.
Generate a fourth scalar output D that counts how many of the elements of A are between -20 and 20.
Solve this problem using vectorized code. Your code should not include the following MATLAB functions or keywords: if, for, while. Note the variable A is defined as a function input. Do not overwrite the value in your code.
 Code has already been provided to define a function named vectorFun

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!