Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
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

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

Recommended Textbook for

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions