解決済み


Relative ratio of "1" in binary number
Input(n) is positive integer number Output(r) is (number of "1" in binary input) / (number of bits). Example: * n=0; r=...

11年以上 前

解決済み


Given a matrix, return the last eigen value
Given a matrix, return the first eigen value For example: x = magic(5) 17 24 1 8 15 23 5 7 14 ...

11年以上 前

解決済み


Do Fast Fourier Transformation
Example Fast Fourier Transformation from vector [2,1]) ans = 3 1

11年以上 前

解決済み


Binary Coder
Take an input number and print the binary value of this number.

11年以上 前

解決済み


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 ...

11年以上 前

解決済み


Sort numbers by outside digits
Sort the array so that they are sorted as if their value was a 5 digit number made from the first three and last two digits of t...

11年以上 前

解決済み


Find nearest prime number less than input number
Find nearest prime number less than input number . For example: if the input number is 125, then the nearest prime number whi...

11年以上 前

解決済み


Change the sign of even index entries of the reversed vector
change the signs of the even index entries of the reversed vector example 1 vec = [4 -1 -2 9] ans = [9 2 -1 -4] example2...

11年以上 前

解決済み


select the primes of a vector
Find the prime numbers in a vector

11年以上 前

解決済み


The sum of the numbers in the vector
eg. [1,2,3]---->SUM=6

11年以上 前

解決済み


sum of first 'n' terms
Given n=10, find the sum of first 'n' terms Example: If n=10, then x=1,2,3,4,5,6,7,8,9,10. The sum of these n=10 terms is 55...

11年以上 前

解決済み


Alternating sum
Given vector x, calculate the alternating sum y = x(1) - x(2) + x(3) - x(4) + ...

11年以上 前

解決済み


Find the nearest integer
Given a vector of integers and a real number find the closest integer. EX: >> a = [2 4 5 6 8 10]; >> b = 4.6; >> nea...

11年以上 前

解決済み


Negative matrix
Change the sign of all elements in given matrix.

11年以上 前

解決済み


Will there be a new leader?
Simply answer the title.

11年以上 前

解決済み


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...

11年以上 前

解決済み


Equal to their cube
Tell me three real numbers that are equal to their cubes?

11年以上 前

解決済み


Basics: 'Find the eigenvalues of given matrix
Find the eigenvalues y for a given matrix x.

11年以上 前

解決済み


Number of digits in an integer
Specifies how many digits in a given integer. Example: in=100 ==> out=3

11年以上 前

解決済み


Determine the number of odd integers in a vector
Determine the number of unique odd integers in a vector. Examples: Input x = [2 5 8 3 7 1]; Output y = 4; Inp...

11年以上 前

解決済み


Output any real number that is neither positive nor negative
Output any real number that is neither positive nor negative

11年以上 前

解決済み


Sum the numbers on the main diagonal
Sum the numbers on the main diagonal of an n-by-n matrix. For input: A = [1 2 4 3 6 2 2 4 7]...

11年以上 前

解決済み


Count up then down
Create a function that produces counting up from 0 up to n then down to 0 n=2 --> 0 1 2 1 0 n=3 --> ...

11年以上 前

解決済み


Reverse the elements of an array
Reverse the order of elements in an array: eg: input X = [ 1 2 3 ; 4 5 6 ; 7 8 9 ] o...

11年以上 前

解決済み


Matrix indexing with two vectors of indices
Given a matrix M and two index vectors a and b, return a row vector x where x(i) = M(a(i),b(i)).

11年以上 前

解決済み


Is A the inverse of B?
Given a matrix A and a matrix B, is A the inverse of B? >>A=[2,4;3,5]; >>B=[-2.5,2;1.5,-1]; >>isInverse...

11年以上 前

解決済み


sum of non-primes
The sum of the non-primes below 10 is 1+4+6+8+9+10=38 Find the sum of all the non-primes below the input, N.

11年以上 前

解決済み


Make a 1 hot vector
Make a vector of length _N_ that consists of all zeros except at index _k_, where it has the value 1. Example: Input ...

11年以上 前

解決済み


Back to basics 15 - Benchmark
Covering some basic topics I haven't seen elsewhere on Cody. Return an array of the benchmark values for MATLAB.

11年以上 前

解決済み


Replace Nonzero Numbers with 1
Given the matrix x, return the matrix y with non zero elements replaced with 1. Example: Input x = [ 1 2 0 0 0 ...

11年以上 前

さらに読み込む