Question: Code has already been provided to define a function named vectorFun that accepts a scalar integer value as input and assigns it to the variable
Code has already been provided to define a function named vectorFun that accepts a scalar integer value as input and assigns it to the variable A Add commands to do the following operations and assign the results to the indicated output variable names:
Generate a row vector that consists of even integers starting at and ending at twice the value of A with increments of Assign this vector to the output variable Up
Generate a second output variable that is a vector named UpDown that consists of the elements in Up followed by odd integers counting down from to
For example, if A then the expected outputs are:
Up
and
UpDown
Solve this problem using vectorized code ie do not use a loop in your solution. Note the variable A is defined as a function input. Do not overwrite the value in your code.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
