Add a vector to a matrix
Given a matrix |mat| of size |mXn| and a row vector |v| of size |1Xs|, return a matrix with |m+1| rows that conatains |mat| over...
6年弱 前
解決済み
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...
6年弱 前
解決済み
Max of a Vector
Write a function to return the max of a vector
6年弱 前
解決済み
Factorial Numbers
Factorial is multiplication of integers. So factorial of 6 is
720 = 1 * 2 * 3 * 4* 5 *6
Thus 6 factorial = factorial(720)....
6年弱 前
解決済み
Find the largest number
Find the largest number |x| among 4 numbers given as variables |a|, |b|, |c|, and |d|.
Example:
Input: a = 4; b = 7; c ...
6年弱 前
解決済み
03 - Matrix Variables 4
Make the following variable:
<<http://samle.dk/STTBDP/Assignment1_3d.png>>
A 3x4 NaN (Not a Number) matrix
(Hint: use ...
6年弱 前
解決済み
07 - Common functions and indexing 3
Define _eMat_:
<<http://samle.dk/STTBDP/Assignment1_3e.png>>
Create the variable _eMat2_, which is equal to _eMat_ with th...
6年弱 前
解決済み
03 - Matrix Variables 1
Make the following variable:
<<http://samle.dk/STTBDP/Assignment1_3a.png>>
A 9x9 matrix full of 2's
(Hint: use *ones* o...
6年弱 前
解決済み
04 - Scalar Equations 1
Define the variable a:
<<http://samle.dk/STTBDP/Assignment1_4-a.png>>
Use this to calculate x:
<<http://samle.dk/STTBD...
Sorted highest to lowest?
Return 1 if the input is sorted from highest to lowest, 0 if not.
Example:
1:7 -> 0
[7 5 2] -> 1
6年弱 前
解決済み
Multiply a column by a row
* Given a column vector C and and a row vector R.
* Output a matrix M.
* Every column of M equals to C multiplied by correspon...
Sum the Digits of a Number
Given an integer, sum the digits repeatedly until you end up with a single value less than 10.
For example, if you add the di...
6年弱 前
解決済み
Building matrices
If you have matrix A, create matrix B using matrix A as an "element"
A = [1 2 3 4;
5 6 7 8...
Create matrix of replicated elements
Given an input element x, and the dimensions, (m, n) return a matrix of size m x n filled with element x.
Example:
Input: ...
6年弱 前
解決済み
Swap two numbers
Example
Input:
a = 10
b = 20
Output
a = 20
b = 10
6年弱 前
解決済み
Eye Squared
For a positive integer |n| create the identity matrix with |n| elements.
In case it is not possible to produce an identity ma...