Maximum value in a matrix
Find the maximum value in the given matrix.
For example, if
A = [1 2 3; 4 7 8; 0 9 1];
then the answer is 9.
1 year 前
已解决
Solve a System of Linear Equations
Example:
If a system of linear equations in x₁ and x₂ is:
2x₁ + x₂ = 2
x₁ - 4 x₂ = 3
Then the coefficient matrix (A) is:
2 ...
1 year 前
已解决
Verify Law of Large Numbers
If a large number of fair N-sided dice are rolled, the average of the simulated rolls is likely to be close to the mean of 1,2,....
1 year 前
已解决
Roll the Dice!
Description
Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice.
Example
[x1,x2] = rollDice(...
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...
Back to basics 21 - Matrix replicating
Covering some basic topics I haven't seen elsewhere on Cody.
Given an input matrix, generate an output matrix that consists o...
1 year 前
已解决
sum of non-primes
The sum of the non-primes no larger than 10 is 1+4+6+8+9+10=38
Find the sum of all the positive non-prime integers that do no...
1 year 前
已解决
subtract central cross
Given an n-by-n square matrix, where n is an odd number, return the matrix without the central row and the central column.
1 year 前
已解决
surrounded matrix
With a given matrix A (size m x n) create a matrix B (size m+2 x n+2) so that the matrix A is surrounded by ones:
A = [1 2 ...