Getting the indices from a vector
This is a basic MATLAB operation. It is for instructional purposes.
---
You may already know how to <http://www.mathworks....
2年以上 前
解決済み
Generate a vector like 1,2,2,3,3,3,4,4,4,4
Generate a vector like 1,2,2,3,3,3,4,4,4,4
So if n = 3, then return
[1 2 2 3 3 3]
And if n = 5, then return
[1 2 2 3 3 3 4...
2年以上 前
解決済み
Find max
Find the maximum value of a given vector or matrix.
Finding Perfect Squares
Given a vector of numbers, return true if one of the numbers is a square of one of the numbers. Otherwise return false.
Example...
Array Concatenation (1)
Given two matrices, a and b, concatenate the two matrices horizontally, i.e., the number of columns of the result should be equa...
Returning a "greater than" vector
Given a vector, v, return a new vector , vNew, containing only values > n.
For example:
v=[1 2 3 4 5 6]
n=3
vNew =...
2年以上 前
解決済み
Bit to Gigabyte
1 bit =
1.25 × 10^-10 gigabytes | x is bit | y is gigabyte
Back and Forth Rows
Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...
2年以上 前
解決済み
Most nonzero elements in row
Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...
2年以上 前
解決済み
Doubling elements in a vector
Given the vector A, return B in which all numbers in A are doubling. So for:
A = [ 1 5 8 ]
then
B = [ 1 1 5 ...
2年以上 前
解決済み
Vector creation
Create a vector using square brackets going from 1 to the given value x in steps on 1.
Hint: use increment.
2年以上 前
解決済み
Return the 3n+1 sequence for n
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...
2年以上 前
解決済み
Generate this matrix
Generate the following matrix.
n = 2;
out = [-4 -3 -2 -1 0
-3 -2 -1 0 1
-...
2年以上 前
解決済み
The Goldbach Conjecture
The Goldbach conjecture asserts that every even integer greater than 2 can be expressed as the sum of two primes.
Given the eve...