Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...
Fibonacci sequence
Calculate the nth Fibonacci number.
Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ...
Examples:
Inpu...
9 years ago
Solved
Concatenating arrays
* Assign studentIDs with concatenated row arrays groupA and groupB
9 years ago
Solved
Double colon operator: Increment by x
* Construct a row array countValues from 0 to 25, elements incremented by incrementValue.
Ex: If incrementValue is 5, countVa...
9 years ago
Solved
Volume of this donut
Given hole diameter a, and outermost diameter b, determine the volume y of the resulting donut.
9 years ago
Solved
Make a checkerboard matrix
Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1.
Examp...
9 years ago
Solved
Check if sorted
Check if sorted.
Example:
Input x = [1 2 0]
Output y is 0
Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so:
x = [1 2 3 4]
Commas are optional, s...