Question: Mini - Project 1 Mini - Project 1 is composed of two problems with 2 0 points total. The following are the assessment tests assigned

Mini-Project 1
Mini-Project 1 is composed of two problems with 20 points total. The following are the assessment tests assigned to each problem:
Problem 1Assessment Tests 1 to 3
Problem 2Assessment Tests 4 to 6
Problem 1
Complete the function MiniProject1, whichtakes one positive integer (endValue) as an input argument. Within the function, generate an array of odd integers from 1 to endValue, and array of even numbers between 1 and endValue,and an array with decreasing numbers from endValueto 1, with a decrease of 1 per step.
The input Argument
endValue: a positive integer.
The output Arguments:
oddNumbers: an array of odd numbers between 1(inclusive) and endValuefrom smallest to largest
evenNumbers: an array of even numbers between 2(inclusive) and endValuefrom smallest to largest
reverseNumbers: an array of numbers decreasing by 1 from endValueto 1.
(Note: while the output arrays are double-precision 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 =13
calling the function:
[oddNumbers, evenNumbers, reverseNumbers]= ReturnNumbers(endValue)
Outputs:
oddNumbers =
135791113
evenNumbers =
24681012
reverseNumbers =
13121110987654321
The oddNumbers array contains odd numbers in the range 1 to 13.
The evenNumbers array contains even numbers in the range 2 to 12.
The reverseNumbers array contains numbers from 13 to 1 in decreasing order.
Problem 2
Complete the function MiniProject1.For a given array of numbers, return the numbers within the range -2<= x <6, and also return the positions of the selected numbers within the array.
The input argument
arrayNumbers:is a 1D double-precision row array.
The output arguments:
numbers: a 1D row array containing the numbers within the range -2<= x <6.
indices: a 1D 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 1 to the numbers of elements in the input array. Then, apply the logical indexing array on this array.
Example:
Inputs:
arrayNumbers =
-2819339
calling the function:
[numbers,indexes]= FindNumbers(arrayNumbers)
Outputs:
numbers =14 double
-2133
indices =14 double
1356
The array indicesindicates that the -2 was in the 1st Position, the 1 was in the 3rd Position, and the 3's were in the 5th and 6th positions.

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 Programming Questions!