Menu

[solved]-Code Already Provided Define Function Named Vector Fun Accepts Scalar Integer Value Input Q38995466

Code has already been provided to define a function named vector fun that accepts a scalar integer value as input and assigns

Code has already been provided to define a function named vector fun that accepts a scalar integer value as input and assigns it to the variable A. Add commands to do the following operations and 1. Generate a row vector that consists of even integers starting at 0 and ending at twice the value of A with increments of 2. Assign this vector to the output variable Up. 2. 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 (2A – 1) to 1. For example, if A = 5, then the expected outputs are: Up – [ 2 4 6 8 10] and UpDown = [0 2 4 6 8 10 9 7 5 3 1] Solve this problem using vectorized code (i.e. 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. Your Function C Reset MATLAB Documentation i function [Up, UpDown] – vector Fun(A) 2 %Enter the commands for your function here. Be sure to assign values 3 %to each of the output variables defined in the function command on line 1. Code to call your function C Reset 1 [up, UpDown] = vectorFun(5); Show transcribed image text Code has already been provided to define a function named vector fun that accepts a scalar integer value as input and assigns it to the variable A. Add commands to do the following operations and 1. Generate a row vector that consists of even integers starting at 0 and ending at twice the value of A with increments of 2. Assign this vector to the output variable Up. 2. 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 (2A – 1) to 1. For example, if A = 5, then the expected outputs are: Up – [ 2 4 6 8 10] and UpDown = [0 2 4 6 8 10 9 7 5 3 1] Solve this problem using vectorized code (i.e. 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. Your Function C Reset MATLAB Documentation i function [Up, UpDown] – vector Fun(A) 2 %Enter the commands for your function here. Be sure to assign values 3 %to each of the output variables defined in the function command on line 1. Code to call your function C Reset 1 [up, UpDown] = vectorFun(5);

Expert Answer


Answer to Code has already been provided to define a function named vector fun that accepts a scalar integer value as input and as… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *