Question: Mini - Project 1 Mini - Project 1 is composed of two problems with 2 0 points total. The following are the assessment tests assigned
MiniProject
MiniProject is composed of two problems with points total. The following are the assessment tests assigned to each problem:
Problem Assessment Tests to
Problem Assessment Tests to
Problem
Complete the function MiniProject whichtakes one positive integer endValue as an input argument. Within the function, generate an array of odd integers from to endValue, and array of even numbers between and endValue,and an array with decreasing numbers from endValueto with a decrease of per step.
The input Argument
endValue: a positive integer.
The output Arguments:
oddNumbers: an array of odd numbers between inclusive and endValuefrom smallest to largest
evenNumbers: an array of even numbers between inclusive and endValuefrom smallest to largest
reverseNumbers: an array of numbers decreasing by from endValueto
Note: while the output arrays are doubleprecision numbers, the input is an integer.
Restrictions: Do not use loops, sort or if else statements.
Hints: Use colon operator to construct the arrays.
For example, with the function ReturnNumbers,given the integer:
Inputs:
endValue
calling the function:
oddNumbers evenNumbers, reverseNumbers ReturnNumbersendValue
Outputs:
oddNumbers
evenNumbers
reverseNumbers
The oddNumbers array contains odd numbers in the range to
The evenNumbers array contains even numbers in the range to
The reverseNumbers array contains numbers from to in decreasing order.
Problem
Complete the function MiniProjectFor a given array of numbers, return the numbers within the range x and also return the positions of the selected numbers within the array.
The input argument
arrayNumbers:is a D doubleprecision row array.
The output arguments:
numbers: a D row array containing the numbers within the range x
indices: a D row array containing the positions of the selected values used to produce the numbersoutput array.
Restrictions: The solution must use logical indexing. Do not use loops or if else statements.
Hints: As loops cannot be used, use the internal function size on the input array arrayNumbers and use logical indexing to find the location of the identified numbers in the input array. To find the positions you could create an array of integers from to the numbers of elements in the input array. Then, apply the logical indexing array on this array.
Example:
Inputs:
arrayNumbers
calling the function:
numbersindexes FindNumbersarrayNumbers
Outputs:
numbers double
indices double
The array indicesindicates that the was in the st Position, the was in the rd Position, and the s were in the th and th positions.
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
