Column Removal
Remove the nth column from input matrix A and return the resulting matrix in output B.
So if
A = [1 2 3; 4 5 6];
and ...
約9年 前
解決済み
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...
Duplicate each element of a vector.
for an n-dimensional vector x, the function should return another vector 2n-dimension which each element is repeated twice.
Ex...
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...
約9年 前
解決済み
Solving Quadratic Equations (Version 1)
Quadratic equations have the form: ax^2 + bx + c = 0. Example: x^2 + 3x + 2 = 0, where a = 1, b = 3, and c = 2. The equation has...
約9年 前
解決済み
Flip the main diagonal of a matrix
Given a n x n matrix, M, flip its main diagonal.
Example:
>> M=magic(5);
>> flipDiagonal(M)
9 24 1 ...
約9年 前
解決済み
Implement simple rotation cypher
If given a letter from the set:
[abc...xyz]
and a shift, implement a shift cypher.
Example:
'abc'
with a shi...
約9年 前
解決済み
Pizza!
Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.]
Non-scor...
約9年 前
解決済み
row removal
Remove the nth row from input matrix M and return the resulting matrix in output N.
Pascal's triangle
<https://en.wikipedia.org/wiki/Pascal%27s_triangle>
if the order is: x = 3; the output will be:
output = [0 0 0 1 0 0 ...
約9年 前
解決済み
The last non-zero digit of a factorial
For given positive integer n, what is the last non-zero digit of n!?
Example: factorial(11) = 39916800
Last non-zero d...
約9年 前
解決済み
Number of divisors of a given number
Given a Number n, return the number of his divisors without listing them
example:
n=14
; Divisors={1,7,2,14} ; y=4
n=...
約9年 前
解決済み
Divisors of an integer
Given a number N, return a vector V of all integers that divide N.
For example,
N = 10
Then
V=[1 2 5 10]
Construct a "diagAdiag" matrix
Construct a matrix whose elements begin from 1 and end at n^2 with the order of arrangement as shown below:
For:
n = 4
...